SwadKart is a production-grade, scalable multi-vendor food delivery platform built with the MERN stack (MongoDB, Express.js, React, Node.js). Designed and developed at Jagannath University, Jaipur, it connects users with local restaurants through a sophisticated multi-role ecosystem โ Admin, Restaurant Owner, Delivery Partner, and Customer.
- ๐ Not a clone โ Production-hardened with 30+ API routes, fraud detection, and enterprise security
- ๐ค AI-Powered โ Groq LLM chatbot for natural language food recommendations
- ๐ฃ๏ธ Voice Search โ "Show me biryani under โน200" works in English & Hindi
- ๐ Real-Time Tracking โ Live GPS driver tracking via Socket.io
- ๐ Biometric Auth โ Fingerprint/FaceID login via WebAuthn (no password needed)
- ๐ณ Razorpay Payments โ UPI, Cards, Wallets, and COD support
- ๐ PWA โ Installable on iOS/Android with offline support & push notifications
- Smart Discovery โ AI-powered restaurant & dish recommendations with natural language search
- Voice Search โ Hands-free search in English & Hindi using Web Speech API
- Dynamic Cart โ Real-time price calculation with surge pricing, coupons, and SwadPass discounts
- Secure Auth โ Triple authentication: JWT + Firebase Google OAuth + WebAuthn Biometric
- Live Order Tracking โ GPS driver tracking from "Preparing" โ "Out for Delivery" โ "Delivered"
- Smart Reorder โ One-tap reorder from frequently ordered items
- Chatbot Action Tools โ AI Genie executes actions (order status, cancel, reorder, coupons, delivery ETA, FAQ) via Groq function-calling pipeline
- Live Analytics โ Revenue, order volume, active users, and restaurant performance trends
- Demand Heatmap โ Interactive Leaflet.js map visualizing high-demand zones
- User Management โ Full RBAC (Role-Based Access Control)
- Coupon Engine โ Create, manage, and track coupon usage with auto-validation
- Fraud Detection โ Heuristics engine flags suspicious orders, repeat addresses, coupon abuse
- Menu Lab โ Stock management, variant toggling, real-time availability
- Delivery Dashboard โ Accept/reject orders, GPS tracking, OTP-verified delivery handoff
- ETA Prediction โ Dynamic delivery time based on distance, traffic, and order queue
- Free Delivery โ Unlimited free delivery on all orders
- Exclusive Discounts โ Additional 10% off every order
- Priority Support โ Fast-track customer service
- Order Streaks โ 3-day, 7-day, and 30-day streak badges
- SwadCoins โ Earn coins on every order, redeem for discounts
- Achievement Badges โ First Bite, Week Warrior, Month Master, Explorer, Top 10
- Referral System โ Invite friends and earn rewards on their first paid order
- Surge Pricing โ Dynamic delivery fee multiplier based on demand vs supply
- Group Ordering โ Split bills with friends via invite code (equal or item-wise)
- Table Reservations โ Book tables with QR code confirmation
- GDPR Compliance โ One-click data export (JSON) and account deletion with anonymization
- Multi-Language โ Full i18n support (English & Hindi)
- PWA โ Installable app with offline support, push notifications, service worker caching
The project follows a clean MVC (Model-View-Controller) architecture. See docs/ARCHITECTURE.md for full system design.
| Layer | Technology |
|---|---|
| Framework | React 19 + Vite 7 |
| State Management | Redux Toolkit 2 |
| Styling | Tailwind CSS 3 + Lucide React Icons |
| Routing | React Router 7 (Lazy Loading) |
| Real-time | Socket.io-client 4 |
| Maps | Leaflet.js 1.9 |
| Charts | Recharts 3 |
| AI | Groq SDK (LLM chatbot + recommendations) |
| Voice | Web Speech API (en-IN / hi-IN) |
| Auth | Firebase Auth + Google OAuth + WebAuthn |
| i18n | i18next (English + Hindi) |
| Build | Vite PWA (vite-plugin-pwa 0.19) |
| jsPDF + jsPDF-autotable | |
| Push | Firebase Cloud Messaging (FCM) |
| Layer | Technology |
|---|---|
| Runtime | Node.js 22 + Express 5 |
| Database | MongoDB Atlas (Mongoose 9 ODM) |
| Cache | Redis (ioredis) / In-Memory Fallback |
| Auth | JWT (httpOnly cookies) + WebAuthn + Firebase Admin |
| Real-time | Socket.io 4 (room-based authorization) |
| Payments | Razorpay 2 (UPI/Card/Wallet/COD) |
| Brevo API + Nodemailer (BullMQ queue) | |
| Storage | Cloudinary (multer + sharp image processing) |
| AI | Groq SDK (Llama 3 chat + dish recommendations + function-calling tools) |
| Testing | fast-check (property-based testing for chatbot tools) |
| Validation | express-validator + Custom NoSQL Sanitizer |
| Rate Limiting | express-rate-limit (strict on auth/orders) |
| Security | Helmet 8, CORS, CSRF protection |
| Job Queue | BullMQ (Redis-backed email worker) |
| Document | Description |
|---|---|
| docs/API.md | Complete REST API reference (30+ endpoints, auth & error patterns) |
| docs/ARCHITECTURE.md | System design, middleware pipeline, security & caching layers |
| docs/DB_SCHEMA.md | 14 MongoDB collections: models, fields, relations & ER diagram |
| docs/DEPLOYMENT.md | Production deployment: Vercel + Render + MongoDB Atlas + Cloudinary |
| docs/EDGE_CASES.md | Security & performance edge cases, graceful degradation, failure modes |
| docs/TECH_STACK.md | Layer-by-layer dependency inventory: frontend, backend, DevOps |
| docs/WORKFLOW.md | User journey, admin ops & delivery driver Mermaid workflows |
| docs/AI_DISCOVERABILITY_FRAMEWORKS.md | AI discoverability: AEO, GEO, LLMO, AI-SEO, E-E-A-T & traditional SEO |
- Node.js v18+ (Download)
- MongoDB Connection String (MongoDB Atlas)
- Firebase Project (Firebase Console)
git clone https://github.com/theunstopabble/swadkart.git
cd swadkartcd backend
npm installCreate a .env file in /backend:
# Server
PORT=8000
NODE_ENV=development
# Database
MONGO_URI=your_mongodb_connection_string
# JWT (MUST be 32+ chars)
JWT_SECRET=your_super_secure_random_jwt_secret_here_at_least_32_chars
# Frontend URL (CORS)
FRONTEND_URL=http://localhost:5173
# Email Service
SMTP_HOST=smtp.gmail.com
SMTP_PORT=465
SMTP_MAIL=your_email@gmail.com
SMTP_PASSWORD=your_app_password
BREVO_API_KEY=your_brevo_api_key
# Biometric Auth (WebAuthn)
RP_ID=localhost
RP_NAME=SwadKart
# Redis Cache (Optional โ falls back to in-memory)
REDIS_URL=your_upstash_or_redis_url
# Payment Gateway (Razorpay)
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxxx
RAZORPAY_KEY_SECRET=your_razorpay_secret
RAZORPAY_WEBHOOK_SECRET=your_webhook_secret
# Cloudinary (Image Uploads)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# AI (Groq LLM)
GROQ_API_KEY=gsk_your_groq_api_key
# Firebase Admin SDK
FIREBASE_SERVICE_ACCOUNT={"type":"service_account",...}Start the backend:
node server.jscd frontend
npm installCreate a .env file in /frontend:
VITE_API_URL=http://localhost:8000/api/v1
VITE_GOOGLE_CLIENT_ID=your_google_oauth_client_id.apps.googleusercontent.com
VITE_FIREBASE_API_KEY=your_firebase_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_idStart the development server:
npm run devVisit http://localhost:5173 to see SwadKart running locally.
swadkart/
โโโ backend/
โ โโโ config/ # DB, Cloudinary, Redis, WebAuthn configuration
โ โโโ controllers/ # 30+ controllers (User, Order, Admin, Delivery, AI, GDPR)
โ โโโ middleware/ # Auth, Error, Rate Limit, Fraud Detection, Cache
โ โโโ models/ # 14 Mongoose Schemas with compound indexes
โ โโโ routes/ # 30+ RESTful API route modules
โ โโโ services/
โ โ โโโ chat/ # AI Chatbot pipeline
โ โ โโโ tools/ # Action tools (orderStatus, cancel, coupon, ETA, FAQ, reorder)
โ โ โโโ *.js # Pipeline, intent, sentiment, language, retrieval
โ โโโ tests/
โ โ โโโ properties/ # Property-based tests (fast-check)
โ โโโ utils/ # Token generators, email templates, cache helpers
โ โโโ server.js # Express app entry point
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ components/ # Reusable UI (Navbar, ChatBot, VoiceSearch, PWA Install)
โ โ โโโ pages/ # 20+ pages (all user roles)
โ โ โโโ redux/ # Global State (Cart, User slices with RTK)
โ โ โโโ utils/ # Firebase config, biometric service, socket, invoice
โ โ โโโ locales/ # i18n translations (en, hi)
โ โ โโโ App.jsx # Router + lazy loading + biometric lock + role guards
โ โโโ assets/ # Screenshots and branding assets
โ โโโ public/ # PWA assets (manifest, icons, hero image)
โ
โโโ docs/ # ๐ Full project documentation
โ โโโ ARCHITECTURE.md # System design & security layers
โ โโโ WORKFLOW.md # 10 Mermaid diagrams (user journey, admin, driver)
โ โโโ API.md # Complete endpoint reference (30+ routes)
โ โโโ DB_SCHEMA.md # All 14 collections & ER diagram
โ โโโ DEPLOYMENT.md # Vercel + Render + MongoDB + Cloudinary setup
โ โโโ TECH_STACK.md # Layer-by-layer dependency tree
โ โโโ EDGE_CASES.md # 20 security/performance edge cases
โ
โโโ .github/workflows/ # CI/CD pipeline (lint + build + syntax check)
| Feature | Implementation | Status |
|---|---|---|
| JWT Security | 32+ char secret, httpOnly cookies, secure + sameSite |
โ |
| CORS | Strict allowlist, dynamic origin validation | โ |
| Rate Limiting | Auth: 10/10min, API: 300/15min, Orders: 20/15min | โ |
| NoSQL Injection Prevention | Custom $ and . sanitizer + parameter binding |
โ |
| CSRF Protection | Origin + Referer header validation | โ |
| XSS Prevention | Helmet headers + Content Security Policy | โ |
| Fraud Detection | Non-blocking heuristics on order creation | โ |
| Graceful Shutdown | SIGTERM โ close HTTP โ close MongoDB โ exit(0) | โ |
| Health Checks | /health endpoint with MongoDB + Redis status |
โ |
| MongoDB Pool | 50 connections, writeConcern: majority, heartbeat 10s |
โ |
| Query Optimization | .lean() on all read-heavy endpoints (3-5x faster) |
โ |
| Response Caching | Redis/in-memory cache on GET endpoints (1-5 min TTL) | โ |
| Lazy Loading | All pages lazy-loaded via React Router + Suspense | โ |
| PWA Caching | Service worker precaches 80+ assets | โ |
| Component | Platform | URL |
|---|---|---|
| Frontend | Vercel | swadkart.vercel.app |
| Backend | Render | swadkart-5wtf.onrender.com |
| Database | MongoDB Atlas | Cluster (M0 Free Tier compatible) |
| Cache | Redis Cloud | Optional โ in-memory fallback |
| Images | Cloudinary | Auto-optimized delivery |
| Payments | Razorpay | Test + Live keys supported |
CI/CD Pipeline (GitHub Actions):
- Backend syntax check (
node --checkon all files) - Frontend lint (
npx eslint src/) - Frontend build test (
npm run build) - Auto-deploy to Vercel on green build
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your 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
Author: Gautam Kumar โ Full-Stack Developer | Solo-shipped SaaS Products | AI Integration
If you find SwadKart useful, please consider giving it a star โญ on GitHub โ it helps others discover this project!
๐ Live Demo ยท ๐ Documentation ยท ๐ Report Bug ยท โจ Request Feature
Built with โค๏ธ by Gautam Kumar (from Sitamarhi, Bihar) at Jagannath University, Jaipur
| Project | Description | Link |
|---|---|---|
| Portfolio | Personal portfolio & developer profile | gautam-kr.vercel.app |
| InterviewMinds | Production-grade AI Mock Interview Platform | interviewminds.vercel.app |
| Satark-AI | Deepfake detection & speaker verification platform | satark-deepfake.vercel.app |
| TexFolio | AI-powered LaTeX resume builder with RBAC | texfolio.vercel.app |






