FoodFleet Documentation
A complete, production-ready food delivery SaaS platform with multi-vendor support, real-time tracking, PWA customer app, and more.
Version 1.0.0 β Stable release. All core modules included. Suitable for production deployment.
What is FoodFleet?
FoodFleet is a complete Food Delivery SaaS Platform that lets you launch your own food delivery marketplace β similar to Zomato or Swiggy β with full control over branding, pricing, and operations.
The platform includes four separate applications:
| Application | Tech | Default Port | Purpose |
|---|---|---|---|
| Customer PWA | React.js (PWA) | 3000 | End-user food ordering app |
| Admin Panel | React.js | 3001 | Super-admin platform management |
| Vendor Panel | React.js | 3002 | Restaurant owner management |
| Delivery App | React.js (PWA) | 3003 | Delivery partner mobile app |
| Backend API | Node.js + Express | 5000 | RESTful API + Socket.io server |
System Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| Node.js | 18.0.0 | 20.x LTS |
| MySQL | 8.0 | 8.0.x latest |
| RAM | 2 GB | 4 GB+ |
| Disk | 5 GB | 20 GB+ (for uploads) |
| OS | Windows 10/Ubuntu 20.04 | Ubuntu 22.04 LTS |
| XAMPP (local) | 8.2+ | Latest stable |
For Windows local development, XAMPP is recommended. For production, use a VPS running Ubuntu 22.04 with Nginx as a reverse proxy.
Installation
Extract the package
Download and extract the zip file to your web server root.
# Extract to XAMPP htdocs (Windows)
unzip foodfleet-saas.zip -d C:/xampp/htdocs/
cd C:/xampp/htdocs/foodfleet-saas
Set up the database
Create a MySQL database and import the SQL dump.
# Open MySQL (or use phpMyAdmin)
mysql -u root -p
# Create database
CREATE DATABASE foodfleet_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
EXIT;
# Import schema + seed data
mysql -u root -p foodfleet_db < database/foodfleet_seed.sql
Configure environment
Copy the example env file and fill in your credentials.
cd backend
cp .env.example .env
# Edit .env with your DB credentials, API keys, etc.
Install backend dependencies
cd backend
npm install
Install frontend dependencies for all apps
# Install all at once
cd ../customer-app && npm install
cd ../admin-panel && npm install
cd ../vendor-panel && npm install
cd ../delivery-app && npm install
Start all services
Open separate terminals for each service, or use the included startup script.
# Option A: Start all with script
npm run start:all
# Option B: Start individually
# Terminal 1 - Backend API
cd backend && npm start # Port 5000
# Terminal 2 - Customer App
cd customer-app && npm start # Port 3000
# Terminal 3 - Admin Panel
cd admin-panel && npm start # Port 3001
# Terminal 4 - Vendor Panel
cd vendor-panel && npm start # Port 3002
# Terminal 5 - Delivery App
cd delivery-app && npm start # Port 3003
Ensure XAMPP MySQL service is running before starting the backend. The backend will fail to connect if MySQL is not available on port 3306.
First Run Guide
After all services are started, open your browser and navigate to http://localhost:3001 to access the Admin Panel.
Log in to Admin Panel
Use the default super-admin credentials: [email protected] / Admin@123
Configure platform settings
Go to Settings β Platform to set your platform name, logo, currency, and timezone.
Add your first city and zone
Navigate to Zones β Add City. Define the delivery radius and service area on the map.
Approve the demo restaurant
Go to Vendors β Click on Spice Garden β Set status to Active.
Place a test order
Open http://localhost:3000, log in as the demo customer, and place a test order to verify the full flow.
Demo Accounts
All four demo accounts are pre-seeded in the database. Use them to explore each module.
System Architecture Overview
FoodFleet follows a microservice-inspired monorepo architecture with a single Node.js backend serving all four frontend applications via REST API and Socket.io.
Real-time Event Flow
Order lifecycle events are propagated via Socket.io rooms. Each order has a unique room that the customer, vendor, admin, and delivery partner all subscribe to.
Module Descriptions
| Module | Location | Description |
|---|---|---|
| customer-app/ | /customer-app | React PWA for end customers. Order food, track orders, manage wallet. |
| admin-panel/ | /admin-panel | Super-admin dashboard. Complete platform control, analytics, config. |
| vendor-panel/ | /vendor-panel | Restaurant owner panel. Menu, orders, KDS, reports, payouts. |
| delivery-app/ | /delivery-app | Delivery partner PWA. Order acceptance, navigation, earnings. |
| backend/ | /backend | Node.js API server. All business logic, socket events, auth, DB. |
| database/ | /database | SQL schema + seed data. Import once to get started. |
Tech Stack
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| Frontend | React.js | 18.x | UI for all 4 panels |
| State Management | Redux Toolkit | 2.x | Global state |
| Real-time | Socket.io | 4.x | Live orders, tracking |
| Backend | Node.js + Express | 20 / 4.x | REST API server |
| Database | MySQL | 8.0 | Primary data store |
| ORM | Sequelize | 6.x | DB queries/migrations |
| Cache | Redis | 7.x | Sessions, rate limiting |
| Auth | JWT + bcrypt | β | Secure authentication |
| Maps | Google Maps API | β | Live tracking, routing |
| Storage | Multer + Local/S3 | β | Image uploads |
| Nodemailer | 6.x | Transactional emails | |
| Push | Firebase FCM | β | Push notifications |
API Authentication
All protected API endpoints require a Bearer JWT token in the Authorization header.
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Authentication Endpoints
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/auth/login | Login (all roles) | No |
| POST | /api/auth/register | Customer registration | No |
| POST | /api/auth/refresh | Refresh access token | No |
| POST | /api/auth/logout | Logout and invalidate token | Yes |
| POST | /api/auth/forgot-password | Send password reset email | No |
| POST | /api/auth/reset-password | Reset password with token | No |
Login Request Example
{
"email": "[email protected]",
"password": "Customer@123",
"role": "customer"
}
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"name": "Demo Customer",
"email": "[email protected]",
"role": "customer",
"wallet_balance": 250.00
}
}
}
Customer API Endpoints
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/restaurants | List restaurants (with geo filter) | No |
| GET | /api/restaurants/:id/menu | Get restaurant menu | No |
| POST | /api/orders | Place new order | Yes |
| GET | /api/orders | Get customer order history | Yes |
| GET | /api/orders/:id/track | Real-time order tracking | Yes |
| GET | /api/customer/profile | Get customer profile | Yes |
| PUT | /api/customer/profile | Update profile | Yes |
| GET | /api/customer/addresses | Get saved addresses | Yes |
| POST | /api/customer/addresses | Add new address | Yes |
| GET | /api/customer/wallet | Get wallet balance and history | Yes |
| POST | /api/customer/wallet/add | Add money to wallet | Yes |
| POST | /api/reviews | Submit order review | Yes |
| POST | /api/coupons/validate | Validate coupon code | Yes |
| GET | /api/recommendations | AI food recommendations | Yes |
Vendor API Endpoints
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/vendor/orders | Get incoming orders | Vendor |
| PUT | /api/vendor/orders/:id/status | Accept/reject/ready order | Vendor |
| GET | /api/vendor/menu | Get restaurant menu | Vendor |
| POST | /api/vendor/menu/items | Add menu item | Vendor |
| PUT | /api/vendor/menu/items/:id | Update menu item | Vendor |
| DELETE | /api/vendor/menu/items/:id | Delete menu item | Vendor |
| GET | /api/vendor/analytics | Revenue and order analytics | Vendor |
| GET | /api/vendor/earnings | Payout and earnings ledger | Vendor |
| GET | /api/vendor/profile | Restaurant profile | Vendor |
| PUT | /api/vendor/profile | Update restaurant details | Vendor |
| PUT | /api/vendor/toggle-status | Open/close restaurant | Vendor |
Admin API Endpoints
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/admin/dashboard | Platform overview stats | Admin |
| GET | /api/admin/vendors | List all vendors | Admin |
| PUT | /api/admin/vendors/:id/status | Approve/suspend vendor | Admin |
| GET | /api/admin/customers | List all customers | Admin |
| GET | /api/admin/orders | All platform orders | Admin |
| GET | /api/admin/analytics | Full platform analytics | Admin |
| POST | /api/admin/coupons | Create coupon | Admin |
| POST | /api/admin/banners | Add homepage banner | Admin |
| GET | /api/admin/zones | Manage delivery zones | Admin |
| GET | /api/admin/settings | Get platform settings | Admin |
| PUT | /api/admin/settings | Update platform settings | Admin |
| GET | /api/admin/payouts | Pending payout requests | Admin |
| POST | /api/admin/payouts/:id/process | Process vendor payout | Admin |
Delivery API Endpoints
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| PUT | /api/delivery/toggle-availability | Go online/offline | Delivery |
| GET | /api/delivery/orders/pending | Pending order requests | Delivery |
| POST | /api/delivery/orders/:id/accept | Accept order | Delivery |
| POST | /api/delivery/orders/:id/decline | Decline order | Delivery |
| POST | /api/delivery/orders/:id/picked-up | Mark as picked up | Delivery |
| POST | /api/delivery/orders/:id/deliver | Confirm delivery (OTP) | Delivery |
| POST | /api/delivery/location | Update GPS location | Delivery |
| GET | /api/delivery/earnings | Earnings dashboard | Delivery |
Customer PWA Guide
The Customer App is a React-based PWA that customers can install on iOS and Android directly from the browser. It supports offline menu browsing via service workers.
Key Files
customer-app/
βββ public/
β βββ manifest.json # PWA manifest
β βββ sw.js # Service worker
βββ src/
β βββ pages/ # Route pages
β βββ components/ # Shared UI components
β βββ redux/ # State management
β βββ hooks/ # Custom React hooks
β βββ utils/ # Helpers, axios config
βββ .env # API URL, Google Maps key
PWA Installation
The customer app includes a built-in install prompt. When users open the app in Chrome or Safari, a banner prompts them to "Add to Home Screen" for a native app-like experience.
For iOS Safari, users must manually tap Share β Add to Home Screen. The install prompt API is not available on iOS.
Vendor Panel Guide
The Vendor Panel gives restaurant owners full control over their business on the platform.
Key Features Walkthrough
Menu Management
Navigate to Menu β Categories to create categories. Under each category, add items with photos, prices, variants (sizes), and addons (toppings).
KDS (Kitchen Display)
Go to Orders β KDS View for a full-screen kitchen display. New orders auto-appear with audio alert. Mark items as prepared in sequence.
Operating Hours
Under Settings β Hours, set day-wise open/close times. Toggle "Holiday Mode" to instantly close with a custom message.
Admin Panel Guide
The Admin Panel is the nerve center of the platform. All operational, financial, and configuration controls are here.
Commission Management
Go to Finance β Commissions. Set platform-wide default commission rate or override per-vendor. Commission is automatically deducted from vendor earnings on each order.
Multi-City Setup
Navigate to Zones β Cities β Add City. Define the city polygon on the map, set default delivery fee formula, and assign an admin manager if needed.
Delivery App Guide
The Delivery App is optimized for mobile browsers. Delivery partners work entirely from the PWA β no native app needed.
Order Flow
Go Online
Tap the big toggle on the home screen. Location tracking starts automatically via browser Geolocation API.
Receive Order
A card appears with restaurant and customer location. Accept within 30 seconds or the system tries another partner.
Navigate to Restaurant
Tap "Navigate to Restaurant" to open turn-by-turn directions in Google Maps (or preferred app).
Confirm Delivery
Ask customer for the 4-digit OTP, enter it to confirm delivery. Earnings are credited instantly.
Environment Variables
Copy backend/.env.example to backend/.env and fill in your values.
Payment Gateway Setup
Razorpay (Recommended for India)
Create Razorpay account
Sign up at razorpay.com and complete KYC verification.
Get API keys
Go to Settings β API Keys β Generate Test Keys. Copy Key ID and Secret to your .env file.
Set in Admin Panel
Navigate to Admin β Settings β Payments. Enter your Razorpay credentials and toggle Razorpay to Active.
Always use Test Keys during development. Switch to Live Keys only when deploying to production after Razorpay approves your account.
Platform Settings
Access via Admin Panel β Settings. Key configurable options:
| Setting | Default | Description |
|---|---|---|
| Platform Name | FoodFleet | Displayed across all apps |
| Default Commission | 18% | Platform commission on each order |
| Min Order Amount | βΉ99 | Minimum cart value to place order |
| Default Delivery Fee | βΉ30 | Base delivery charge |
| Free Delivery Threshold | βΉ299 | Orders above this get free delivery |
| GST Rate | 5% | Tax applied to food items |
| Referral Bonus | βΉ50 | Wallet credit for successful referral |
| Delivery OTP | Enabled | Require OTP for delivery confirmation |
| Auto-assign Delivery | Enabled | Auto-assign nearest available partner |
Branding & Customization
Update the following files to rebrand the platform:
# Logo files
customer-app/public/logo.png # Customer app favicon/logo
admin-panel/public/logo.png # Admin panel logo
vendor-panel/public/logo.png # Vendor panel logo
# App name (update in each app)
customer-app/public/manifest.json # PWA manifest name
customer-app/src/constants/config.js # APP_NAME constant
# Theme colors (CSS variables)
customer-app/src/styles/theme.css # --primary-color: #FF6B35;
admin-panel/src/styles/theme.css
vendor-panel/src/styles/theme.css
Alternatively, use the Admin Panel β Settings β Branding section to upload logos and change the color scheme without touching code.
White-label Setup
For complete white-labeling with a custom domain:
Point domain DNS
Create A records pointing your domain/subdomains to your server IP:
app.yourdomain.com β Customer App (3000)
admin.yourdomain.com β Admin Panel (3001)
Configure Nginx reverse proxy
server {
listen 80;
server_name app.yourdomain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
}Install SSL certificate
Use Certbot (Let's Encrypt): sudo certbot --nginx -d app.yourdomain.com
FAQ & Troubleshooting
Backend fails to start β "ER_ACCESS_DENIED_ERROR"
Your MySQL credentials in .env are incorrect. Verify DB_USER and DB_PASSWORD match your MySQL setup. On fresh XAMPP installs, the default is root with no password.
Socket.io connection refused on delivery tracking
Ensure CLIENT_URL in .env matches the exact origin of your customer app including the port. CORS blocks socket connections if origins don't match exactly.
Google Maps not loading
Verify your Google Maps API key has the following APIs enabled: Maps JavaScript API, Geocoding API, Directions API, and Places API. Also ensure the key is not restricted to specific domains during local testing.
PWA install prompt not appearing
The install prompt requires HTTPS in production. Locally, it works on localhost but not on 192.168.x.x IP addresses. Ensure the manifest.json has all required fields and a valid 512x512 icon.
Still stuck? Email support at [email protected] with your error log, Node.js version, and OS details. Enterprise customers get a dedicated Slack channel.
Common Error Reference
| Error | Likely Cause | Fix |
|---|---|---|
| ECONNREFUSED 3306 | MySQL not running | Start MySQL service in XAMPP control panel |
| JWT malformed | Corrupted/expired token | Clear localStorage and log in again |
| CORS policy error | Wrong CLIENT_URL in .env | Match CLIENT_URL exactly to frontend origin |
| Cannot find module | npm install not run | Run npm install in the affected directory |
| Port 3000 in use | Another process on same port | Kill process or change port in .env |
| Orders not updating live | Socket.io disconnected | Check Redis is running; verify socket connection in browser DevTools |