How vichea-collab/food-delivery-app works
Project type and purpose
• This is a full-stack MERN (MongoDB, Express.js, React, Node.js) food-delivery application called QuickEats with three separately deployed frontends (User Panel, Admin Panel, and API server) and one database.
File structure
• Top-level folders:
– backend: Express.js REST API, controllers, routes, models, middleware, uploads, configuration.
– frontend: React/Vite user-facing site (browsing menu, cart, orders, payments).
– admin: React/Vite admin dashboard (product CRUD, order management).
• Patterns: MVC on the server (models/controllers/routes), Context API on clients for state, JWT auth middleware, Stripe integration, Multer file uploads.
README for additional insights
• Authentication: JWT + Bcrypt + RBAC
• Payments: Stripe
• File Upload: Multer
• Deployment: Render, MongoDB Atlas
• Environment variables define URLs connecting frontends ↔ backend
Main components & their interactions
a. Components
– User Frontend (React App)
– Admin Frontend (React App)
– Backend API (Node.js + Express)
• Route layer (cartRoute, foodRoute, orderRoute, userRoute)
• Controller layer (cartController, foodController, orderController, userController)
• Model layer (MongoDB schemas via Mongoose)
• Auth middleware (JWT, RBAC)
• File upload (Multer)
• Hashing utility (bcrypt)
– Database (MongoDB Atlas)
– External services: Stripe API, optional email service (if implemented)
b. Relationships
– Both frontends send HTTP requests (REST) to the Backend API over HTTPS.
– Backend uses Mongoose to read/write MongoDB.
– Backend calls Stripe for payment processing.
– Backend stores uploaded images via Multer (local/uploads or cloud).
– Backend issues JWTs on login; clients store token and include in Authorization header.
c. Architectural patterns & principles
– Separation of concerns: UI vs API vs data store
– MVC pattern on server side
– Context API for state management on clients
– Token-based authentication and role-based access control
– Middleware pipeline in Express
d. Key technologies
– React + Vite for fast client build (admin + user)
– Node.js + Express for API
– MongoDB + Mongoose for persistence
– JWT, Bcrypt, RBAC for security
– Stripe for payments
– Multer for image uploads
Detailed capture of essential architecture
• Middleware layer intercepting requests (auth, Multer).
• Environment variables connecting clients ↔ backend base URL.