Foodogram is a dynamic online food ordering platform that lets users browse menus, add items to cart, place orders, and track them in real-time. Admins can manage menu items, orders, and users through a connected MySQL database.
β‘ "Foodogram bridges the gap between restaurants and customers with seamless online ordering."
-β
User registration, login, and authentication
-β
Browse menus with search and filters
-β
Add to cart and checkout system
-β
Ratings and reviews for menu items
-β
User profile and order history
-β
Live chat/help page
-β
Admin panel for menu and order management
-β
Responsive, mobile-friendly design
| Layer | Technology |
|---|---|
| Frontend | HTML, CSS, JavaScript |
| Backend | PHP |
| Database | MySQL |
| Hosting | InfinityFree |
| Version Control | Git & GitHub |
π οΈ How to Run Locally
Before running the project locally, ensure you have the following installed:
- PHP: Version 7.4 or higher (with extensions: mysqli, pdo, pdo_mysql).
- MySQL: Version 5.7 or higher (or MariaDB).
- Web Server: Apache (recommended) or Nginx. Alternatively, use XAMPP, WAMP, or MAMP for an all-in-one solution.
- Git: For cloning the repository.
- Composer (optional): For dependency management if needed in the future.
- Browser: Any modern browser for testing.
-
Clone the repository:
git clone https://github.com/Mrigakshi-Rathore/Foodogram.git cd Foodogram -
Set up the web server:
- If using XAMPP/WAMP/MAMP:
- Place the
Foodogramfolder in thehtdocs(XAMPP) orwww(WAMP/MAMP) directory.
- Place the
- If using Apache directly:
- Configure a virtual host pointing to the
Foodogramdirectory.
- Configure a virtual host pointing to the
- If using XAMPP/WAMP/MAMP:
-
Create a MySQL database:
- Open your MySQL client (e.g., phpMyAdmin, MySQL Workbench, or command line).
- Create a new database named
foodogram(or as per your preference, but updatedb_connect.phpaccordingly). - Import the database schema (if provided in the repo; otherwise, create tables based on the code):
- Tables typically include:
users,menu,orders,cart,reviews, etc. - Example SQL for
userstable:CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
- Repeat for other tables based on the application's needs.
- Tables typically include:
-
Update database credentials:
- Open
db_connect.php. - Replace the placeholders with your local MySQL details:
$host = "localhost"; // Your MySQL host $username = "your_username"; // Your MySQL username $password = "your_password"; // Your MySQL password $dbname = "foodogram"; // Your database name
- Ensure the database connection is secure and not exposed in production.
- Open
-
Start your web server and MySQL:
- If using XAMPP/WAMP, start Apache and MySQL from the control panel.
- Access the application at
http://localhost/Foodogram(or your configured URL).
-
Test the setup:
- Visit the home page (
index.php) in your browser. - Try registering a user, logging in, browsing the menu, and placing an order.
- Check the database to ensure data is being inserted correctly.
- Visit the home page (
- Database connection errors: Verify credentials in
db_connect.phpand ensure MySQL is running. - PHP errors: Check PHP error logs and ensure required extensions are enabled.
- Port conflicts: If using a different port, update your server configuration.
- Permissions: Ensure the web server has read/write access to the project directory.
- For production, host on a server like InfinityFree, Hostinger, or AWS.
- Use HTTPS and secure database credentials.
- Consider using environment variables for sensitive data.
The application uses MySQL for data storage. Below is an overview of the key tables. Create these tables in your database during setup.
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
email VARCHAR(100) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL, -- Use hashed passwords
phone VARCHAR(15),
address TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);CREATE TABLE menu (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
description TEXT,
price DECIMAL(10,2) NOT NULL,
category ENUM('appetizers', 'main-courses', 'desserts', 'drinks') NOT NULL,
image VARCHAR(255),
is_veg BOOLEAN DEFAULT TRUE,
rating DECIMAL(2,1) DEFAULT 0,
is_available BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE orders (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
total_amount DECIMAL(10,2) NOT NULL,
status ENUM('pending', 'confirmed', 'preparing', 'out_for_delivery', 'delivered', 'cancelled') DEFAULT 'pending',
delivery_address TEXT,
order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);CREATE TABLE order_items (
id INT AUTO_INCREMENT PRIMARY KEY,
order_id INT NOT NULL,
menu_id INT NOT NULL,
quantity INT NOT NULL,
price DECIMAL(10,2) NOT NULL,
FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE,
FOREIGN KEY (menu_id) REFERENCES menu(id) ON DELETE CASCADE
);CREATE TABLE cart (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
session_id VARCHAR(255), -- For guest users
menu_id INT NOT NULL,
quantity INT NOT NULL,
added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (menu_id) REFERENCES menu(id) ON DELETE CASCADE
);CREATE TABLE reviews (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
menu_id INT NOT NULL,
rating INT CHECK (rating >= 1 AND rating <= 5),
comment TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (menu_id) REFERENCES menu(id) ON DELETE CASCADE
);Note: Adjust table structures based on actual application needs. Ensure foreign key constraints are handled properly in your PHP code.
|
Mrigakshi Rathore
|
π¨βπ» Developed By
β€οΈ Mrigakshi Rathore β€οΈ
Open an Issue | Watch Live Demo
We welcome contributions from the community! Here's how you can get involved:
- Fork the repository on GitHub.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
- Make your changes and ensure they follow the project's coding standards.
- Test your changes thoroughly.
- Commit your changes with a descriptive message:
git commit -m "Add: Brief description of your changes" - Push to your branch:
git push origin feature/your-feature-name
- Create a Pull Request on GitHub, describing your changes and why they should be merged.
- Follow PHP PSR standards for code style.
- Write clear, concise commit messages.
- Add comments to complex code sections.
- Ensure your code is secure (e.g., use prepared statements for DB queries).
- Test on multiple browsers and devices for UI changes.
- Update documentation if needed.
- Bug fixes and code improvements
- New features (e.g., payment integration, advanced search)
- UI/UX enhancements
- Documentation updates
- Security improvements
- Performance optimizations
Please be respectful and inclusive. We follow a standard code of conduct to ensure a positive environment for all contributors.
If you have questions, issues, or suggestions:
- Open an Issue on GitHub: Issues
- Contact the Developer: Reach out via LinkedIn or email.
- Live Demo: Check out the live version at https://foodogram.infinityfreeapp.com
Let's make Foodogram even better together! π




