# abhijeetmukund07/food-delivery-app architecture

> Architecture diagram of the GitHub repository abhijeetmukund07/food-delivery-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhijeetmukund07/food-delivery-app
- Repository: https://github.com/abhijeetmukund07/food-delivery-app

## Overview

##### Main Components
- Frontend: Built with React.js. Its structure is organized into pages (e.g., Home, Orders, PlaceOrder, Cart), reusable components (Navbar, Header, Footer, FoodItemCard, etc.), asset directories for images and style sheets, and state management via Redux.
- Backend: Developed with Node.js and Express.js. Notice the subdirectories for APIs (with route handlers like addFood.js, userApi.js, etc.) and Middlewares (for token verification using JWT).
- Database: MongoDB is the data store used for managing user data, restaurant information, orders, etc.
- External/Supporting Services: While not explicitly shown, JWT-based authentication and environment variables (for DB connections and secret keys) are integral parts of the system.

##### Relationships & Interactions
- The Backend processes requests, applies necessary middlewares (for example, VerifyToken for authentication), and communicates with the MongoDB database.
- Data flow should illustrate that after processing, the backend sends responses back to the frontend, which then updates its UI accordingly.

##### Architectural Features
- RESTful API: Show that the backend organizes endpoints (as seen in backend/APIs/Routes) for specific functionalities (adding food, user operations, etc.).
- Authentication Flow: Highlight how JWT is integrated via the middleware (backend/Middlewares/VerifyToken.js) to secure API endpoints.
- Modular Structure: Both the frontend and backend are broken into smaller, dedicated directories (pages, components for frontend and routes, middlewares for backend) that support scalability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Section
    subgraph "Frontend"
        a1["React Client"]:::frontend
        a2["Pages"]:::frontend
        a3["Reusable Components"]:::frontend
        a4["Redux State Management"]:::frontend
        a1 --> a2
        a1 --> a3
        a1 --> a4
    end

    %% Backend Section
    subgraph "Backend"
        b2["API Endpoints"]:::backend
        b3["JWT Verification Middleware"]:::backend
        b1["Server Entry"]:::backend
        b2 -->|"JWTFlow"| b3
        b3 -->|"Process"| b1
    end

    %% Database Section
    db["MongoDB Database"]:::database

    %% Interactions between Frontend, Backend, and Database
    a1 -->|"HTTPRequest"| b2
    b1 -->|"DBOperations"| db
    b1 -->|"HTTPResponse"| a1

    %% Click Events for Frontend components
    click a1 "https://github.com/abhijeetmukund07/food-delivery-app/tree/main/frontend/"
    click a2 "https://github.com/abhijeetmukund07/food-delivery-app/tree/main/frontend/src/pages/"
    click a3 "https://github.com/abhijeetmukund07/food-delivery-app/tree/main/frontend/src/components/"
    click a4 "https://github.com/abhijeetmukund07/food-delivery-app/tree/main/frontend/src/redux/"

    %% Click Events for Backend components
    click b1 "https://github.com/abhijeetmukund07/food-delivery-app/blob/main/backend/server.js"
    click b2 "https://github.com/abhijeetmukund07/food-delivery-app/tree/main/backend/APIs/Routes/"
    click b3 "https://github.com/abhijeetmukund07/food-delivery-app/blob/main/backend/Middlewares/VerifyToken.js"

    %% Styles
    classDef frontend fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef database fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
```
