# yogeshnagre00/cloud_kitchen architecture

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

- Interactive diagram: https://gitdiagram.com/yogeshnagre00/cloud_kitchen
- Repository: https://github.com/yogeshnagre00/cloud_kitchen

## Overview

##### Project type and purpose
- This is a full-stack web application named “Cloud_Kitchen.”
- Purpose: Provide customers a UI to browse/menu items, manage a cart and place orders, while the backend handles authentication, order processing, file uploads (e.g., menu images), and data persistence.

##### File structure
- Top-level:
- backend: Node.js/Express API server
- frontend: React application (using Vite)
- docker-compose.yml: orchestrates services (backend, database, possibly storage)
- claud_Kitchen_db.dump: DB schema/data dump
- backend:
- server.js: app entry point
- db.js: database connection setup
- controllers/orderController.js: business logic for orders
- middleware/authMiddleware.js: authentication guard
- routes/auth.js, order.js, upload.js: API endpoints
- uploads/: storage for user-uploaded files
- Dockerfile & .env: containerization & config
- frontend:
- src/: React components, pages (dashboard, viewCart), hooks, context (AuthContext), services (api, logger)
- public/_redirects: routing for SPA
- Dockerfile & multiple .env: build & environment settings
- vite.config.js, index.html, CSS assets

##### README
- Minimal content; we infer architecture from file layout and naming.

##### Detailed capture of essential elements
- Within the Backend container, sub-divide:
- Routes (auth, order, upload) → Controllers → DB + Storage
- Middleware layer (authMiddleware) guarding specific routes
- In the Frontend container, highlight:
- Pages (Dashboard, ViewCart), Components (Header, Footer, Login, Signup)
- Context & Hooks (AuthContext, useAuth)
- Services module (api.js for HTTP calls, logger.js for error tracking)
- Docker-compose orchestration:
- Service definitions: api, db, volumes for uploads, network linking

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer" 
        direction TB
        ReactApp["React App"]:::frontend
        subgraph "Entry & Config" 
            direction TB
            MainJS["main.jsx"]:::frontend
            AppJS["App.jsx"]:::frontend
            HTML["index.html"]:::frontend
            CSS["index.css"]:::frontend
            VITE["vite.config.js"]:::frontend
            ENV_Frontend[".env / .env.*"]:::frontend
            DOCKERF_FE["Dockerfile"]:::frontend
        end
        subgraph "Services & State" 
            direction TB
            APIService["api.js"]:::frontend
            LoggerService["logger.js"]:::frontend
            AuthContext["AuthContext.jsx"]:::frontend
            UseAuth["useAuth.jsx"]:::frontend
        end
        subgraph "Components & Pages"
            direction TB
            Header["header.jsx"]:::frontend
            Footer["footer.jsx"]:::frontend
            Login["login.jsx"]:::frontend
            Signup["signup.jsx"]:::frontend
            Profile["profile.jsx"]:::frontend
            DashboardPage["dashboard.jsx"]:::frontend
            ViewCartPage["ViewCart.jsx"]:::frontend
        end
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        API["Express API Server"]:::backend
        subgraph "Config & Entry"
            direction TB
            ServerJS["server.js"]:::backend
            DBModule["db.js"]:::backend
            ENV_Backend[".env"]:::backend
            DOCKERF_BE["Dockerfile"]:::backend
        end
        subgraph "Routes & Controllers"
            direction TB
            AuthRoutes["auth.js"]:::backend
            OrderRoutes["order.js"]:::backend
            UploadRoutes["upload.js"]:::backend
            OrderController["orderController.js"]:::backend
        end
        AuthMiddleware["authMiddleware.js"]:::backend
        FileStorage["uploads/"]:::storage
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Postgres["PostgreSQL DB"]:::db
        DBSchema["claud_Kitchen_db.dump"]:::db
    end

    %% Orchestration Layer
    subgraph "docker-compose"
        direction TB
        API
        Postgres
        FileStorage
    end

    %% Connections
    ReactApp -->|HTTPS/JSON| API
    APIService -->|calls REST| API
    API -->|SQL Queries| Postgres
    API -->|File I/O| FileStorage
    AuthContext -->|provides token| APIService
    AuthMiddleware -->|guards routes| AuthRoutes
    UploadRoutes -->|uses| FileStorage

    %% Click Events
    click ReactApp "https://github.com/yogeshnagre00/cloud_kitchen/tree/main/frontend/"
    click MainJS "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/main.jsx"
    click AppJS "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/App.jsx"
    click HTML "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/index.html"
    click CSS "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/index.css"
    click VITE "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/vite.config.js"
    click ENV_Frontend "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/.env"
    click DOCKERF_FE "https://github.com/yogeshnagre00/cloud_kitchen/tree/main/frontend/Dockerfile"
    click APIService "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/services/api.js"
    click LoggerService "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/services/logger.js"
    click AuthContext "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/context/AuthContext.jsx"
    click UseAuth "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/hooks/useAuth.jsx"
    click Header "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/components/header.jsx"
    click Footer "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/components/footer.jsx"
    click Login "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/components/login.jsx"
    click Signup "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/components/signup.jsx"
    click Profile "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/components/profile.jsx"
    click DashboardPage "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/pages/dashboardPage/dashboard.jsx"
    click ViewCartPage "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/frontend/src/pages/viewCartPage/ViewCart.jsx"
    click API "https://github.com/yogeshnagre00/cloud_kitchen/tree/main/backend/"
    click ServerJS "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/server.js"
    click DBModule "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/db.js"
    click ENV_Backend "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/.env"
    click DOCKERF_BE "https://github.com/yogeshnagre00/cloud_kitchen/tree/main/backend/Dockerfile"
    click AuthRoutes "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/routes/auth.js"
    click OrderRoutes "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/routes/order.js"
    click UploadRoutes "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/routes/upload.js"
    click OrderController "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/controllers/orderController.js"
    click AuthMiddleware "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/backend/middleware/authMiddleware.js"
    click FileStorage "https://github.com/yogeshnagre00/cloud_kitchen/tree/main/backend/uploads/"
    click Postgres "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/claud_Kitchen_db.dump"
    click DBSchema "https://github.com/yogeshnagre00/cloud_kitchen/blob/main/claud_Kitchen_db.dump"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#009;
    classDef backend fill:#D0FFD8,stroke:#090;
    classDef db fill:#FFE0B2,stroke:#E65100;
    classDef storage fill:#FFF3E0,stroke:#E65100;
```
