How jynxxor/food-del works
Project Type and Purpose
• This is a full-stack MERN (MongoDB, Express, React, Node.js) online food ordering platform.
• It comprises three main applications:
• frontend (customer-facing React app)
• admin (React dashboard for restaurant management)
• backend (Node/Express REST API with MongoDB)
File Structure
• Top-level directories:
• /frontend – customer React app (pages, components, context)
• /admin – admin React app (pages, components)
• /backend – Express server (routes, controllers, models, middleware, config)
• Patterns and frameworks:
• React component tree in both frontend and admin
• Express MVC pattern (routes → controllers → models)
• Mongoose ODM for MongoDB
• JWT auth middleware
• Stripe integration in backend
• Config & deployment:
• dotenv for environment variables (MongoDB URL, JWT_SECRET, STRIPE_SECRET_KEY)
• Vite for frontend build, npm scripts to start each service
Key Architectural Insights from README
• Separate “customer” and “admin” frontends talking via RESTful API
• Role-based access control (users vs. admins) enforced by JWT and middleware
• External services: MongoDB Atlas and Stripe payment API
• Future real-time enhancements (WebSockets) planned
a. Main Components
1. Customer Frontend (React App)
2. Admin Dashboard (React App)
3. Backend Server (Node.js + Express)
4. MongoDB Database (Atlas)
5. Stripe Payment Service
6. Authentication Service (JWT logic inside backend)
b. Relationships & Data Flows
• Customer/Admin UIs ←→ HTTP(S) REST API → MongoDB
• API → Stripe for payment processing
• UI sends credentials → API → returns JWT → UI stores in context/localStorage
• All CRUD operations (menu, cart, orders, users) flow through API controllers/models
c. Architectural Patterns & Principles
• MVC on backend: Routes → Controllers → Models
• Component-based architecture on frontends (React)
• Single SPA per app (separate frontend & admin apps)
• RESTful services, stateless JWT auth
d. Key Technologies & Libraries
• React (Vite), Context API for state (frontend)
• React (Vite) for admin dashboard
• Node.js, Express.js for API
• Mongoose for MongoDB models
• jsonwebtoken for JWT auth
• stripe SDK for payments
Detail
• Major endpoints: /food, /cart, /order, /user.
• Role checks in auth middleware between routes and controllers.