How abhayrajsingh23/foody-circle works
Project type and purpose
• This is a full-stack web application using the MERN stack (MongoDB, Express.js, React.js, Node.js).
• It’s an online food delivery app (“Foody Circle”) that lets users browse a menu, register/login, place orders, and process payments via Razorpay.
File structure
• Top level:
• backend/ → Node.js + Express code
• public/ → static assets and the HTML entry point
• src/ → React application
• package.json (root)
• backend/:
• index.js → server bootstrap
• db.js → MongoDB connection logic
• models/ → Mongoose schemas (User.js, Order.js)
• Routes/ → API endpoints (CreateUser.js, DisplayData.js, OrderData.js)
• src/:
• App.js, Urls.js, Modal.js → core React components
• components/ → UI elements (Card, Navbar, Footer, ContextReducer, carousal)
• screens/ → page-level views (Home, Cart, MyOrder, Login, Signup)
• public/index.html → React mount point
• Configuration and scripts:
• backend/package.json, package-lock.json
• root-level package.json for monorepo scripts (if any)
README for additional insights
• Tech stack: React, Bootstrap-dark-5, Express, MongoDB Atlas, bcryptjs, JWT, Razorpay.
• Features: authentication, dynamic menu, checkout & payment, responsive UI.
• Deployment notes: free-tier backend host may sleep.
Main components
a. Frontend (React application)
– Public static files served by a simple web server (webpack-dev-server in dev)
– React components, state management via ContextReducer
– Communicates with backend over REST (HTTPS)
b. Backend (Node.js + Express)
– API layer with three main route groups: user auth (CreateUser), menu retrieval (DisplayData), order placement (OrderData)
– Business logic for hashing passwords (bcryptjs) and generating JWTs
– Razorpay integration module (calls out to payment gateway)
c. Database
– MongoDB Atlas cluster
– Mongoose models: User, Order
d. External services
– Razorpay payment gateway (payment API)
e. Optional utility/service
– JWT token validation middleware (in backend before protected routes)
Relationships and interactions
• User’s browser → HTTP(S) → Frontend React app
• React app → REST API calls → Express server
• Express server → CRUD operations → MongoDB Atlas
• Express server → API call → Razorpay → payment confirmation → Express → React
• JWT flow: on login/signup, Express returns JWT → stored by React (localStorage) → attached to Authorization header on protected calls
Architectural patterns and design principles
• Client–Server (separation of concerns)
• RESTful API layer
• Layered architecture in backend: Routes → Controllers/Services → Data layer (Mongoose)
• Stateless authentication with JWT
• Single-page application (SPA) on the frontend
Technologies and libraries to annotate
• Frontend: React.js, Bootstrap-dark-5, Context API, Razorpay.js SDK
• Backend: Node.js, Express.js, bcryptjs, jsonwebtoken (JWT), Mongoose
• Database: MongoDB Atlas
• Deployment: nodemon (dev), npm scripts