Restaurant Food Ordering Management System - React, Express.js FullStack MERN Project (including Business-Insights Dashboard)
A comprehensive, modern food ordering platform built with the MERN stack (MongoDB, Express.js, React, Node.js) featuring real-time order management, payment processing, analytics dashboard, and advanced search capabilities.
- Frontend-Live: https://food-mern-ordering.vercel.app/
- Backend-Live: https://food-ordering-backend.arnobmahmud.com
- Features
- Technology Stack
- Project Structure
- Getting Started
- Environment Variables
- API Documentation
- Component Library
- Key Features Walkthrough
- Deployment
- Contributing
- License
- Restaurant Management: Complete CRUD operations for restaurants
- Menu Management: Dynamic menu creation and management
- Order Processing: Real-time order tracking and status updates
- Payment Integration: Secure Stripe payment processing
- User Authentication: Auth0-based secure authentication
- Analytics Dashboard: Business insights with charts and metrics
- Advanced Search: Multi-filter search with real-time results
- API Documentation: Interactive Swagger-like API docs
- Performance Monitoring: Real-time system health monitoring
- Order Status Tracking: Comprehensive order lifecycle management
- Responsive Design: Mobile-first responsive layout
- Modern UI: Shadcn/ui components with Tailwind CSS
- Real-time Updates: Live order status and notifications
- Toast Notifications: Professional status feedback
- Dark/Light Mode: Theme switching capability
- React 18.2.0 - Modern React with hooks and concurrent features
- TypeScript 5.3.3 - Type-safe development
- Vite - Fast build tool and development server
- Tailwind CSS - Utility-first CSS framework
- Shadcn/ui - Modern component library
- React Query - Server state management
- React Router - Client-side routing
- React Hook Form - Form handling with validation
- Zod - Schema validation
- Auth0 - Authentication and authorization
- Stripe - Payment processing
- Lucide React - Beautiful icons
- Node.js - JavaScript runtime
- Express.js - Web application framework
- TypeScript - Type-safe backend development
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- Stripe - Payment processing API
- Auth0 - Authentication middleware
- Cloudinary - Image upload and management
- Multer - File upload handling
- Express Validator - Request validation
- CORS - Cross-origin resource sharing
- ESLint - Code linting
- Prettier - Code formatting
- Nodemon - Development server with auto-reload
- Concurrently - Run multiple commands simultaneously
food-ordering/
βββ food-ordering-frontend/ # React frontend application
β βββ src/
β β βββ components/ # Reusable UI components
β β β βββ ui/ # Shadcn/ui components
β β β βββ EnhancedOrdersTab.tsx
β β β βββ OrderStatusDetail.tsx
β β β βββ AdvancedSearchBar.tsx
β β β βββ ...
β β βββ pages/ # Page components
β β β βββ HomePage.tsx
β β β βββ ManageRestaurantPage.tsx
β β β βββ AnalyticsDashboardPage.tsx
β β β βββ ...
β β βββ api/ # API integration
β β βββ auth/ # Authentication logic
β β βββ config/ # Configuration files
β β βββ forms/ # Form components
β β βββ layouts/ # Layout components
β β βββ lib/ # Utility functions
β β βββ types.ts # TypeScript type definitions
β β βββ AppRoutes.tsx # Application routing
β βββ package.json
β βββ vite.config.ts
β
βββ food-ordering-backend/ # Node.js backend application
β βββ src/
β β βββ controllers/ # Request handlers
β β βββ middleware/ # Custom middleware
β β βββ models/ # MongoDB schemas
β β βββ routes/ # API routes
β β βββ index.ts # Server entry point
β βββ package.json
β βββ .env.example
β
βββ README.md # This file- Node.js (v18 or higher)
- MongoDB Atlas account
- Auth0 account
- Stripe account
- Cloudinary account
- Clone the repository
git clone https://github.com/yourusername/food-ordering.git
cd food-ordering- Install backend dependencies
cd food-ordering-backend
npm install- Install frontend dependencies
cd ../food-ordering-frontend
npm install-
Set up environment variables (see Environment Variables section)
-
Start the development servers
Backend:
cd food-ordering-backend
npm run devFrontend:
cd food-ordering-frontend
npm run devThe application will be available at:
- Frontend: http://localhost:5173
- Backend: http://localhost:7001
Create a .env file in the food-ordering-backend directory:
# MongoDB Connection
MONGODB_CONNECTION_STRING="mongodb+srv://username:password@cluster.mongodb.net/food-ordering?retryWrites=true&w=majority"
# Auth0 Configuration
AUTH0_AUDIENCE="your-auth0-api-identifier"
AUTH0_ISSUER_BASE_URL="https://your-domain.us.auth0.com/"
# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"
# Stripe Configuration
FRONTEND_URL="http://localhost:5173"
STRIPE_API_KEY="sk_test_your-stripe-secret-key"
STRIPE_WEBHOOK_SECRET="whsec_your-webhook-secret"Create a .env file in the food-ordering-frontend directory:
# API Configuration
VITE_API_BASE_URL="http://localhost:7001"
# Auth0 Configuration
VITE_AUTH0_DOMAIN="your-domain.us.auth0.com"
VITE_AUTH0_CLIENT_ID="your-client-id"
VITE_AUTH0_CALLBACK_URL="http://localhost:5173/auth-callback"- Create a MongoDB Atlas account
- Create a new cluster
- Get your connection string
- Replace the placeholder in
.env
- Create an Auth0 account
- Create a new application (Single Page Application)
- Create a new API
- Configure callback URLs
- Get your domain, client ID, and audience
- Create a Stripe account
- Get your test API keys
- Set up webhook endpoints
- Configure webhook secrets
- Create a Cloudinary account
- Get your cloud name, API key, and secret
- Configure upload presets
// All protected routes require Auth0 JWT token
Authorization: Bearer<jwt_token>;// Get all restaurants
GET /api/restaurant/search
Query Parameters:
- city?: string
- cuisineType?: string
- searchQuery?: string
- sortOption?: string
- page?: number
// Get restaurant by ID
GET /api/restaurant/:restaurantId
// Create restaurant (Protected)
POST /api/my/restaurant
Content-Type: multipart/form-data
// Update restaurant (Protected)
PUT /api/my/restaurant
Content-Type: multipart/form-data
// Get my restaurant (Protected)
GET /api/my/restaurant// Create order (Protected)
POST /api/order/checkout
// Get my orders (Protected)
GET /api/my/order
// Get restaurant orders (Protected)
GET /api/my/restaurant/order
// Update order status (Protected)
PATCH /api/my/restaurant/order/:orderId/status
Body: { status: OrderStatus }
// Stripe webhook
POST /api/order/checkout/webhook// Get current user (Protected)
GET / api / my / user;
// Update user profile (Protected)
PUT / api / my / user;import EnhancedOrdersTab from "@/components/EnhancedOrdersTab";
<EnhancedOrdersTab orders={orders} showStatusSelector={true} />;Features:
- Real-time order management
- Status filtering and search
- Dashboard statistics
- Responsive grid/list views
- Order status overview with progress bars
import AdvancedSearchBar from "@/components/AdvancedSearchBar";
<AdvancedSearchBar onSearch={handleSearch} filters={filters} />;Features:
- Multi-filter search
- Real-time suggestions
- Price range slider
- Cuisine type filtering
- Advanced sorting options
import { showOrderStatusToast } from "@/components/OrderStatusToast";
showOrderStatusToast({
status: "delivered",
customerName: "John Doe",
orderId: "order123",
});Features:
- Dynamic status messages
- Color-coded notifications
- Professional styling
- Auto-dismiss functionality
All components are built on top of Shadcn/ui for consistency:
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Input } from "@/components/ui/input";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";Location: food-ordering-frontend/src/pages/ManageRestaurantPage.tsx
Features:
- Complete restaurant CRUD operations
- Image upload with Cloudinary
- Menu item management
- Real-time order tracking
- Enhanced order status management
Usage:
// Restaurant form with image upload
const handleSubmit = async (formData: FormData) => {
await createRestaurant(formData);
};Location: food-ordering-frontend/src/pages/AnalyticsDashboardPage.tsx
Features:
- Revenue analytics
- Order trends
- Customer insights
- Performance metrics
- Interactive charts
Components:
- Revenue charts
- Order statistics
- Customer demographics
- Performance indicators
Location: food-ordering-frontend/src/pages/SearchPage.tsx
Features:
- Multi-criteria search
- Real-time filtering
- Price range selection
- Cuisine type filtering
- Sort and pagination
Implementation:
const searchParams = {
city: selectedCity,
cuisineType: selectedCuisine,
searchQuery: searchTerm,
sortOption: sortBy,
page: currentPage,
};Location: food-ordering-frontend/src/pages/OrderStatusPage.tsx
Features:
- Real-time order status
- Order history
- Delivery tracking
- Status notifications
- Order details
Status Flow:
placed β paid β inProgress β outForDelivery β deliveredIntegration: Stripe with webhook handling
Features:
- Secure payment processing
- Webhook verification
- Order confirmation
- Payment status tracking
Implementation:
// Frontend checkout
const handleCheckout = async () => {
const response = await createCheckoutSession({
cartItems,
deliveryDetails,
restaurantId,
});
window.location.href = response.url;
};-
Build the application
cd food-ordering-frontend npm run build -
Deploy to Vercel
vercel --prod
3. **Set environment variables in Vercel dashboard**
### Backend Deployment (Railway/Render)
1. **Prepare for production**
```bash
cd food-ordering-backend
npm run build
-
Deploy to Railway/Render
3. **Update frontend API URL**
### Environment Variables for Production
```env
# Production URLs
FRONTEND_URL="https://your-app.vercel.app"
VITE_API_BASE_URL="https://your-api.railway.app"
# Production Stripe keys
STRIPE_API_KEY="sk_live_your-production-key"
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature- Commit your changes
git commit -m 'Add amazing feature'- Push to the branch
git push origin feature/amazing-feature- Open a Pull Request
- Follow TypeScript best practices
- Use ESLint and Prettier
- Write meaningful commit messages
- Add tests for new features
- Update documentation
This project is licensed under the MIT License - see the LICENSE file for details.
Food Delivery, Restaurant Management, Order Processing, Payment Integration, Real-time Tracking, Analytics Dashboard, Advanced Search, User Authentication, Responsive Design, TypeScript, React, Node.js, MongoDB, Stripe, Auth0, Cloudinary, Shadcn/ui, Tailwind CSS, MERN Stack, Full Stack Development, Web Application, E-commerce, Restaurant Technology, Order Management System, Customer Portal, Restaurant Dashboard, Payment Gateway, Image Upload, Real-time Notifications, Performance Monitoring, API Documentation
This is an open-source project - feel free to use, enhance, and extend this project further!
If you have any questions or want to share your work, reach out via GitHub or my portfolio at https://www.arnobmahmud.com/.
Enjoy building and learning! π
Thank you! π












