Skip to content

anandtayde/exploremenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Explore Menu Platform

A comprehensive restaurant menu management system with an admin dashboard and customer-facing menu board.

πŸ—οΈ Architecture Overview

This project consists of:

  • Backend API: Node.js + Express.js + Sequelize (MySQL)
  • Frontend: React.js with Material-UI
  • Database: MySQL

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v14 or higher)
  • MySQL (v5.7 or higher)
  • npm or yarn

πŸš€ Setup Instructions

1. Database Setup

  1. Start your MySQL server
  2. Open MySQL command line or MySQL Workbench
  3. Run the database schema:
mysql -u root -p < database/schema.sql

Or manually execute the SQL file in your MySQL client.

2. Backend Setup

  1. Navigate to the server directory:
cd server
  1. Install dependencies:
npm install
  1. Create a .env file in the server directory:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=explore_menu
DB_PORT=3306

JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
JWT_EXPIRE=7d

PORT=5000
NODE_ENV=development

MAX_FILE_SIZE=5242880
UPLOAD_PATH=./uploads
  1. Start the server:
npm start

For development with auto-reload:

npm run dev

The server will run on http://localhost:5000

3. Frontend Setup

  1. Navigate to the client directory:
cd client
  1. Install dependencies:
npm install
  1. Create a .env file in the client directory (optional):
REACT_APP_API_URL=http://localhost:5000/api/v1
  1. Start the development server:
npm start

The frontend will run on http://localhost:3000

πŸ“ Project Structure

explore-menu/
β”œβ”€β”€ database/
β”‚   └── schema.sql              # Database schema
β”œβ”€β”€ server/                     # Backend
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── database.js         # Database configuration
β”‚   β”œβ”€β”€ controllers/            # Route controllers
β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”œβ”€β”€ restaurantController.js
β”‚   β”‚   β”œβ”€β”€ categoryController.js
β”‚   β”‚   └── menuItemController.js
β”‚   β”œβ”€β”€ models/                 # Sequelize models
β”‚   β”‚   β”œβ”€β”€ User.js
β”‚   β”‚   β”œβ”€β”€ Restaurant.js
β”‚   β”‚   β”œβ”€β”€ Category.js
β”‚   β”‚   β”œβ”€β”€ MenuItem.js
β”‚   β”‚   β”œβ”€β”€ Setting.js
β”‚   β”‚   └── index.js
β”‚   β”œβ”€β”€ routes/                 # API routes
β”‚   β”‚   β”œβ”€β”€ authRoutes.js
β”‚   β”‚   β”œβ”€β”€ restaurantRoutes.js
β”‚   β”‚   β”œβ”€β”€ categoryRoutes.js
β”‚   β”‚   └── menuItemRoutes.js
β”‚   β”œβ”€β”€ middleware/             # Custom middleware
β”‚   β”‚   β”œβ”€β”€ authMiddleware.js
β”‚   β”‚   └── uploadMiddleware.js
β”‚   β”œβ”€β”€ uploads/                # Uploaded images
β”‚   β”œβ”€β”€ server.js               # Entry point
β”‚   └── package.json
β”œβ”€β”€ client/                     # Frontend
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   └── admin/          # Admin components
β”‚   β”‚   β”œβ”€β”€ pages/              # Page components
β”‚   β”‚   β”œβ”€β”€ services/           # API services
β”‚   β”‚   β”œβ”€β”€ App.js
β”‚   β”‚   └── index.js
β”‚   └── package.json
└── README.md

πŸ”‘ API Endpoints

Authentication

  • POST /api/v1/auth/register - Register a new user
  • POST /api/v1/auth/login - Login
  • GET /api/v1/auth/verify - Verify token (protected)

Restaurants

  • GET /api/v1/restaurants/:id - Get restaurant (protected)
  • PUT /api/v1/restaurants/:id - Update restaurant (protected)
  • GET /api/v1/restaurants/:id/menu - Get public menu (public)

Categories

  • GET /api/v1/categories/restaurant/:restaurant_id - Get categories (protected)
  • POST /api/v1/categories - Create category (protected)
  • PUT /api/v1/categories/:id - Update category (protected)
  • DELETE /api/v1/categories/:id - Delete category (protected)
  • PUT /api/v1/categories/:id/reorder - Reorder category (protected)

Menu Items

  • GET /api/v1/menu-items/restaurant/:restaurant_id - Get menu items (protected)
  • GET /api/v1/menu-items/category/:category_id - Get items by category (protected)
  • POST /api/v1/menu-items - Create menu item (protected, multipart/form-data)
  • PUT /api/v1/menu-items/:id - Update menu item (protected, multipart/form-data)
  • DELETE /api/v1/menu-items/:id - Delete menu item (protected)
  • PUT /api/v1/menu-items/:id/toggle-availability - Toggle availability (protected)

🎯 Features

Admin Dashboard

  • βœ… User authentication (JWT)
  • βœ… Dashboard with statistics
  • βœ… Category management (CRUD)
  • βœ… Menu item management (CRUD with image upload)
  • βœ… Restaurant settings
  • βœ… Real-time menu updates

Customer Menu Board

  • βœ… Public menu display
  • βœ… Category-based navigation
  • βœ… Search functionality
  • βœ… Dietary filter indicators
  • βœ… Responsive design

πŸ”’ Security Features

  • JWT-based authentication
  • Password hashing with bcrypt
  • Protected routes with middleware
  • File upload validation
  • SQL injection prevention (Sequelize ORM)
  • CORS configuration

πŸ§ͺ Testing the Application

  1. Register a new user:

    • Navigate to /admin/login
    • Click "Register" or use the API to create an account
    • The registration will create a restaurant if you provide restaurant_name
  2. Login:

    • Use your credentials to login
    • You'll be redirected to the dashboard
  3. Create Categories:

    • Go to "Categories" in the sidebar
    • Click "Add Category"
    • Fill in the form and save
  4. Add Menu Items:

    • Go to "Menu Items" in the sidebar
    • Click "Add Menu Item"
    • Fill in details, upload an image, and save
  5. View Public Menu:

    • Navigate to /menu/:restaurant_id
    • Replace :restaurant_id with your restaurant ID

πŸ› Troubleshooting

Database Connection Issues

  • Ensure MySQL is running
  • Check your .env file has correct database credentials
  • Verify the database explore_menu exists

Port Already in Use

  • Change the PORT in .env file
  • Or kill the process using the port

Image Upload Issues

  • Ensure the server/uploads directory exists
  • Check file size limits in .env
  • Verify file types (only images allowed)

πŸ“ Notes

  • Images are stored in server/uploads/ directory
  • JWT tokens are stored in localStorage (consider httpOnly cookies for production)
  • The application uses Sequelize ORM for database operations
  • Material-UI is used for the frontend components

πŸš€ Future Enhancements

  • Multi-restaurant support for admin users
  • Advanced menu themes and customization
  • QR code generation for tables
  • Online ordering integration
  • Analytics dashboard
  • Mobile app
  • Real-time updates using WebSockets

πŸ“„ License

This project is open source and available for educational purposes.

πŸ‘₯ Support

For issues or questions, please check the code comments or create an issue in the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors