A full-stack MERN application with a stunning modern UI for food delivery. Built with React, TypeScript, Express.js, MongoDB, and Tailwind CSS.
- Responsive Design: Mobile-first approach with beautiful animations
- Modern Components: Built with Tailwind CSS and Framer Motion
- Dark/Light Theme: Elegant color schemes and gradients
- Smooth Animations: Micro-interactions and page transitions
- RESTful API: Complete CRUD operations for all entities
- JWT Authentication: Secure user authentication and authorization
- MongoDB Integration: Scalable database with Mongoose ODM
- File Upload: Support for restaurant and menu item images
- Rate Limiting: API protection and security
- Input Validation: Comprehensive data validation with Joi
- Restaurant Listings: Browse restaurants with filters and search
- Menu Management: Detailed menu items with customizations
- Shopping Cart: Real-time cart updates with local storage
- Order Tracking: Real-time order status updates
- User Profiles: Complete user management system
- Reviews & Ratings: Customer feedback system
- React 18 with TypeScript
- Vite for fast development
- Tailwind CSS for styling
- Framer Motion for animations
- React Router for navigation
- React Query for server state management
- React Hook Form for form handling
- Zod for validation
- Heroicons for icons
- Node.js with Express.js
- MongoDB with Mongoose
- JWT for authentication
- Bcrypt for password hashing
- Multer for file uploads
- Joi for validation
- Helmet for security
- CORS for cross-origin requests
- Node.js (v16 or higher)
- MongoDB (local or cloud)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd food-delivery-app
-
Install backend dependencies
cd backend npm install -
Install frontend dependencies
cd ../frontend npm install -
Set up environment variables
Create
backend/.envfile:PORT=5000 NODE_ENV=development MONGODB_URI=mongodb://localhost:27017/food-delivery JWT_SECRET=your-super-secret-jwt-key-change-this-in-production JWT_EXPIRE=7d FRONTEND_URL=http://localhost:5173 MAX_FILE_SIZE=5242880 UPLOAD_PATH=uploads/
Create
frontend/.envfile:VITE_API_URL=http://localhost:5000/api
-
Start MongoDB
# If using local MongoDB mongod -
Start the backend server
cd backend npm run dev -
Start the frontend development server
cd frontend npm run dev -
Open your browser
- Frontend: http://localhost:5173
- Backend API: http://localhost:5000/api
food-delivery-app/
βββ backend/
β βββ models/ # MongoDB models
β βββ routes/ # API routes
β βββ middleware/ # Custom middleware
β βββ utils/ # Utility functions
β βββ server.js # Main server file
βββ frontend/
β βββ src/
β β βββ components/ # React components
β β βββ pages/ # Page components
β β βββ contexts/ # React contexts
β β βββ hooks/ # Custom hooks
β β βββ services/ # API services
β β βββ types/ # TypeScript types
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
βββ README.md
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current userPUT /api/auth/profile- Update profilePUT /api/auth/password- Update password
GET /api/restaurants- Get all restaurantsGET /api/restaurants/:id- Get restaurant by IDGET /api/restaurants/nearby- Get nearby restaurantsPOST /api/restaurants- Create restaurant (Owner/Admin)PUT /api/restaurants/:id- Update restaurant (Owner/Admin)DELETE /api/restaurants/:id- Delete restaurant (Owner/Admin)
GET /api/menu- Get all menu itemsGET /api/menu/:id- Get menu item by IDGET /api/menu/restaurant/:id- Get restaurant menuPOST /api/menu- Create menu item (Owner/Admin)PUT /api/menu/:id- Update menu item (Owner/Admin)DELETE /api/menu/:id- Delete menu item (Owner/Admin)
GET /api/orders- Get user ordersGET /api/orders/:id- Get order by IDPOST /api/orders- Create orderPUT /api/orders/:id/status- Update order status (Owner/Admin)PUT /api/orders/:id/rating- Rate order
The app includes a comprehensive set of reusable components:
- Layout Components: Navbar, Footer, Sidebar
- UI Components: Button, Input, Card, Modal, Toast
- Form Components: LoginForm, RegisterForm, ProfileForm
- Restaurant Components: RestaurantCard, RestaurantList, RestaurantDetail
- Menu Components: MenuItem, MenuList, MenuCategory
- Cart Components: CartItem, CartSummary, CartActions
Backend:
npm run dev- Start development server with nodemonnpm start- Start production servernpm test- Run tests
Frontend:
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
- ESLint for code linting
- Prettier for code formatting
- TypeScript for type safety
- Conventional Commits for commit messages
- Set up MongoDB Atlas or your preferred MongoDB hosting
- Update environment variables for production
- Deploy to Heroku, Vercel, or your preferred platform
- Build the production bundle:
npm run build - Deploy to Vercel, Netlify, or your preferred platform
- Update API URL in environment variables
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Tailwind CSS for the amazing utility-first CSS framework
- Framer Motion for smooth animations
- Heroicons for beautiful icons
- React Query for server state management
- MongoDB for the flexible database solution
If you have any questions or need help, please:
- Open an issue on GitHub
- Contact us at support@foodiehub.com
Made with β€οΈ for food lovers everywhere! πππ