A complete MERN stack application for food ordering with cart functionality, built using MongoDB, Express, React, and Node.js.
- Menu Display: Beautiful grid layout showing food items with images, names, and prices
- Shopping Cart: Add/remove items, update quantities, and view total
- Order Processing: Server-side validation and order placement
- Responsive Design: Modern UI built with Tailwind CSS
- State Management: React Context API for cart state
- Real-time Updates: Dynamic cart calculations and updates
- Node.js + Express
- MongoDB + Mongoose
- CORS middleware
- Error handling
- React 19
- React Router DOM
- Tailwind CSS
- Axios for API calls
- Context API for state management
βββ server/ # Backend
β βββ models/ # MongoDB schemas
β βββ routes/ # API endpoints
β βββ server.js # Main server file
β βββ seed.js # Database seeding
β βββ package.json # Backend dependencies
βββ client/ # Frontend
β βββ src/
β β βββ components/ # Reusable components
β β βββ contexts/ # React contexts
β β βββ pages/ # Page components
β β βββ services/ # API services
β β βββ App.jsx # Main app component
β β βββ main.jsx # Entry point
β βββ tailwind.config.js # Tailwind configuration
β βββ package.json # Frontend dependencies
βββ README.md
- Node.js (v16 or higher)
- MongoDB (local or Atlas)
- npm or yarn
-
Navigate to server directory:
cd server
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the server directory:MONGODB_URI=mongodb://localhost:27017/ordering-system PORT=5000
-
Start MongoDB: Make sure MongoDB is running on your system or update the MONGODB_URI in .env
-
Seed the database:
npm run seed
-
Start the server:
npm run dev
The backend will run on
http://localhost:5000
-
Navigate to client directory:
cd client
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
The frontend will run on
http://localhost:5173
GET /api/menu
- Get all menu items
POST /api/cart
- Place order (accepts cart items)
GET /api/orders
- Get all orders
- Gradient Backgrounds: Beautiful blue to purple gradients
- Card Design: Modern cards with hover effects and shadows
- Responsive Grid: Mobile-friendly layout that adapts to screen size
- Interactive Elements: Hover effects, transitions, and animations
- Clean Typography: Consistent font hierarchy and spacing
- Add items to
server/seed.js
- Run
npm run seed
to update the database
- Modify
client/src/index.css
for custom CSS - Update
client/tailwind.config.js
for theme changes
- Edit route files in
server/routes/
- Update models in
server/models/
If you encounter any issues:
- Check the console for error messages
- Verify MongoDB connection
- Ensure all dependencies are installed
- Check API endpoints are accessible
Happy Coding! π