# jack20410/test-soa architecture

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

- Interactive diagram: https://gitdiagram.com/jack20410/test-soa
- Repository: https://github.com/jack20410/test-soa

## Overview

##### Components
- Frontend Application – Displays menus, dashboards, and order forms for different user roles (e.g., waiter, manager, kitchen staff).
- API Gateway – Acts as the central routing point to the internal services.
- Microservices:
– User Service – Manages user registration, authentication, and profiles; uses MySQL (user_db).
– Order Service – Processes and manages orders; integrates with User Service; uses MySQL (order_db).
– Kitchen Service – Handles kitchen orders and real-time order queue; uses MongoDB (kitchen_db).
- Databases:
– MySQL databases for the User and Order services.
– MongoDB for the Kitchen service.
- External Interfaces:
– Docker Compose – Orchestrates deployment.
– Service Development Environments and direct service-to-service communication (using HTTP requests).

##### Relationships and Interactions
- The Frontend connects to the API Gateway, which in turn routes requests to the appropriate microservices.
- Each microservice interacts with its own dedicated database.
- Services communicate with one another as needed (for instance, the Order Service may obtain user data from the User Service).

##### Architectural Patterns and Technologies
- Microservices architecture with clearly separated domain responsibilities.
- Use of an API Gateway to decouple the client-facing interface from the backend services.
- Containerization through Docker and composition via docker-compose.
- FastAPI (implied by how services are started with uvicorn) for backend services.
- Frontend built using modern JavaScript frameworks (React or similar, as seen from .jsx files and vite.config).

## Diagram (Mermaid)

```mermaid
flowchart TB
    Compose["Docker Compose Orchestration"]:::orchestration
    Frontend["Frontend Application"]:::frontend
    API["API Gateway"]:::gateway

    subgraph "Microservices"
        User["User Service"]:::service
        Order["Order Service"]:::service
        Kitchen["Kitchen Service"]:::service
    end

    UserDB(["MySQL: user_db"]):::database
    OrderDB(["MySQL: order_db"]):::database
    KitchenDB(["MongoDB: kitchen_db"]):::database

    Compose -->|"deploys"| Frontend
    Compose -->|"deploys"| API
    Frontend -->|"HTTP"| API

    API -->|"routes"| User
    API -->|"routes"| Order
    API -->|"routes"| Kitchen

    User -->|"data_access"| UserDB
    Order -->|"data_access"| OrderDB
    Kitchen -->|"data_access"| KitchenDB

    Order -->|"calls"| User

    click Frontend "https://github.com/jack20410/test-soa/tree/main/frontend/"
    click API "https://github.com/jack20410/test-soa/blob/main/api-gateway/main.py"
    click API "https://github.com/jack20410/test-soa/tree/main/api-gateway/routers/"
    click User "https://github.com/jack20410/test-soa/blob/main/services/user-service/main.py"
    click User "https://github.com/jack20410/test-soa/tree/main/services/user-service/routers/"
    click User "https://github.com/jack20410/test-soa/blob/main/services/user-service/database.py"
    click Order "https://github.com/jack20410/test-soa/blob/main/services/order-service/main.py"
    click Order "https://github.com/jack20410/test-soa/tree/main/services/order-service/routers/"
    click Order "https://github.com/jack20410/test-soa/blob/main/services/order-service/database_orders.py"
    click Kitchen "https://github.com/jack20410/test-soa/blob/main/services/kitchen-service/main.py"
    click Kitchen "https://github.com/jack20410/test-soa/tree/main/services/kitchen-service/routers/"
    click Kitchen "https://github.com/jack20410/test-soa/blob/main/services/kitchen-service/database.py"
    click Compose "https://github.com/jack20410/test-soa/blob/main/docker-compose.yml"

    classDef frontend fill:#b3cde0,stroke:#03396c,stroke-width:2px;
    classDef gateway fill:#ccebc5,stroke:#336b6b,stroke-width:2px;
    classDef service fill:#decbe4,stroke:#6a3d9a,stroke-width:2px;
    classDef database fill:#fbb4ae,stroke:#e31a1c,stroke-width:2px;
    classDef orchestration fill:#ffeda0,stroke:#f03b20,stroke-width:2px;
```
