# gabr4ca/webf88 architecture

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

- Interactive diagram: https://gitdiagram.com/gabr4ca/webf88
- Repository: https://github.com/gabr4ca/webf88

## Overview

##### Project type and purpose
- This is a full-stack web application for a food ordering system.
- There are two React front-end clients:
- “frontend” for customers placing orders
- “admin” for staff to manage menu items, orders, and users
- The backend is implemented as a set of Node.js services behind an API gateway, each service handling one domain (users, food items, carts, orders).
- MongoDB is the database for all services.

##### File structure
- Top-level:
- “frontend”: React/Vite SPA for customers
- “admin”: React/Vite SPA for administrators
- “backend”: contains an “api-gateway”, a legacy “backup-monolith”, plus four microservices under “services” (cart, food, order, user).
- “Mongo/playground…”: local MongoDB scripts
- Each microservice has its own package.json, config/db.js, models, controllers, routes, and auth middleware. They connect to MongoDB (likely separate DB or separate collections).
- The API gateway (backend/api-gateway/server.js) routes client requests to the appropriate microservice.
- There are shell scripts (start.sh, lol.sh) for starting services.

##### README for additional insights
- You infer the stack: React + Vite, Node.js + Express, MongoDB, JWT/OAuth middleware.

##### Elements
- API layer in another (e.g., dark grey)
- Microservices in green
- Database in orange
- Rectangles for services/servers

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        CF["Customer Frontend SPA"]:::frontend
        AF["Admin Frontend SPA"]:::frontend
    end

    %% API Layer
    subgraph "API Layer"
        APIGW["API Gateway"]:::api
    end

    %% Service Layer
    subgraph "Service Layer"
        US["User Service"]:::service
        FS["Food Service"]:::service
        CS["Cart Service"]:::service
        OS["Order Service"]:::service
    end

    %% Data Layer
    subgraph "Data Layer"
        MDBUser[(MongoDB User DB)]:::db
        MDBFood[(MongoDB Food DB)]:::db
        MDBCart[(MongoDB Cart DB)]:::db
        MDBOrder[(MongoDB Order DB)]:::db
    end

    %% Shared Storage
    SharedUploads[(Shared Uploads Directory)]:::storage

    %% Legacy Monolith (deprecated)
    subgraph "Legacy Monolith (Deprecated)"
        LM["Backup Monolith"]:::legacy
    end

    %% Connections
    CF -->|"HTTPS/REST"| APIGW
    AF -->|"HTTPS/REST"| APIGW
    APIGW -->|"Routes to User"| US
    APIGW -->|"Routes to Food"| FS
    APIGW -->|"Routes to Cart"| CS
    APIGW -->|"Routes to Order"| OS

    US -->|"CRUD"| MDBUser
    FS -->|"CRUD + Uploads"| MDBFood
    CS -->|"CRUD"| MDBCart
    OS -->|"CRUD"| MDBOrder

    FS -->|"stores files"| SharedUploads

    %% Click Events
    click CF "https://github.com/gabr4ca/webf88/tree/main/frontend/"
    click AF "https://github.com/gabr4ca/webf88/tree/main/admin/"
    click APIGW "https://github.com/gabr4ca/webf88/blob/main/backend/api-gateway/server.js"
    click US "https://github.com/gabr4ca/webf88/tree/main/backend/services/user-service/"
    click FS "https://github.com/gabr4ca/webf88/tree/main/backend/services/food-service/"
    click CS "https://github.com/gabr4ca/webf88/tree/main/backend/services/cart-service/"
    click OS "https://github.com/gabr4ca/webf88/tree/main/backend/services/order-service/"
    click LM "https://github.com/gabr4ca/webf88/tree/main/backend/backup-monolith/"
    click SharedUploads "https://github.com/gabr4ca/webf88/tree/main/backend/uploads/"

    %% Styles
    classDef frontend fill:#ACE7FF,stroke:#000,stroke-width:1px
    classDef api fill:#CCCCCC,stroke:#000,stroke-width:1px
    classDef service fill:#C2FABC,stroke:#000,stroke-width:1px
    classDef db fill:#FFD37E,stroke:#000,stroke-width:1px
    classDef storage fill:#FFDDC1,stroke:#000,stroke-width:1px
    classDef legacy fill:none,stroke:#FF0000,stroke-width:2px,stroke-dasharray:5 5
```
