1. Requirements
RecipeHub was built with HTML for front-end, CSS for UI styling, PHP and JS for back-end, and uses a MySQL database.
To build and host RecipeHub, you would need:
- PHP 8.0 or higher
- MySQL / MariaDB
- XAMPP, MAMP, or live server
- Internet access (for Spoonacular API)
2. Installation Steps
- Start Apache and MySQL.
- Clone or download the project into your `htdocs/` folder (XAMPP) or your web host's public directory.
- Create your RecipeHub database in phpMyAdmin.
- Open your browser and run the PHP script:
/config/db_setup.php
to create the necessary tables. - Update DB credentials in
/config/db_config.php
. - Edit
/config/constants.php
to match your server's URL and folder paths. - Include your Spoonacular API key in the PHP script:
/assets/scripts/php/fetch_api_recipes.php
. - Open your browser and open
/assets/scripts/php/fetch_api_recipes.php
to populate the resipes table with Spoonacular recipes. - Access
http://localhost/your-folder/public/index.php
in your browser.
3. Folder Structure
The RecipeHub folder structure is organized for modularity, scalability, and ease of development. Assets, configurations, and public-facing scripts are clearly separated to support team collaboration, maintain clean code practices, and simplify deployment.
/root
│
├── /assets → Static files (media, scripts, styles)
│ ├── /img → Image assets
│ │ ├── /profiles → User profile pictures
│ │ ├── /thumbnails → Recipe thumbnails
│ │ └── /wiki → Wiki-related images
│ ├── /includes → PHP snippet files (navbar, footer, etc.)
│ ├── /scripts
│ │ ├── /js → JavaScript script
│ │ └── /php → Reusable backend PHP scripts
│ └── /styles
│ ├── /templates → Shared CSS templates (e.g., header, sidebar)
│ └── /themes → Theme-specific stylesheets
│
├── /config → Site and database configuration
│ ├── constants.php → URL paths and global constants
│ ├── db_config.php → Database connection settings
│ └── db_setup.php → Auto-create database schema
│
├── /docs → Project documentation
│ └── /wiki → All wiki/help pages
│
├── /public → Public-facing entry points
│ ├── /admin → Admin-only tools and dashboard
│ ├── /recipe → Add/view/edit recipes
│ ├── /user → Profile, settings, and user pages
│ ├── about.php → About the website
│ ├── contact.php → Contact website creator
│ ├── index.php → Homepage
│ ├── login.php → Login form
│ └── register.php → Registration form
└──
4. Database Schema (Simplified)
Table: users
Stores all user account information including login credentials, profile details, and admin status.
id
(INT, PK, AUTO_INCREMENT)first_name
,last_name
(VARCHAR)username
(UNIQUE),email
(UNIQUE)password
(hashed),profile_pic
(image path)about_me
(TEXT),is_admin
(BOOLEAN)created_at
(TIMESTAMP)
Table: recipes
Contains all user-submitted and API-sourced recipes, including dietary filters, metadata, and ownership.
id
(INT, PK, AUTO_INCREMENT)created_by
(FK → users.id)title
,image_url
,cuisine_type
,difficulty
vegetarian
,gluten_free
,dairy_free
meal_type
(ENUM),servings
,ready_in_minutes
preparation_time
,cooking_time
ingredients
,instructions
(TEXT)is_api
(BOOLEAN),is_admin
(BOOLEAN)favourite_count
(INT),created_at
(TIMESTAMP)
Table: favourites
Tracks which users have favorited which recipes to enable personalized recipe collections.
id
(INT, PK, AUTO_INCREMENT)user_id
(FK → users.id)recipe_id
(FK → recipes.id)favourited_at
(TIMESTAMP)- UNIQUE constraint on
(user_id, recipe_id)
Table: comments
Stores user comments on recipes to support community feedback and discussion.
id
(INT, PK, AUTO_INCREMENT)user_id
(FK → users.id)recipe_id
(FK → recipes.id)comment
(TEXT),created_at
(TIMESTAMP)
5. User Features
- Create an account and log in to access your dashboard
- Post your own recipes with ingredients, instructions, and thumbnail image
- Browse and search recipes submitted by other users or pulled from the Spoonacular API
- Favorite recipes you like and view them on your profile
- Comment on other users' recipes to give feedback or ask questions
- Edit your profile, update your “About Me”, and upload a profile picture
- Switch between visual themes (e.g., pink, blue, green) for a customized experience
- Delete your account permanently through the Settings page
6. Admin Features
- Manage users: search, view, delete
- Manage recipes: search, view, and edit/delete inappropriate content
- View site health and service statuses on the Monitor page
- Track user and recipe activity via the monitor page graph
- Delete user comments on recipes
7. API Integration
This app uses the Spoonacular API to fetch recipes for the Explore page.
Your API key should be saved in your fetch_api_recipes.php script and referenced when needed. Avoid exposing it in public repositories.
8. Customization
- Change themes in
/public/user/user-settings.php
- Edit navigation or sidebar menu structure via
assets/includes/navbar.php and assets/includes/sidebar.php
- Enable email/OAuth by customizing login and register forms
- Update constants like URLs and asset paths in
constants.php