# phamvantu090303/tro architecture

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

- Interactive diagram: https://gitdiagram.com/phamvantu090303/tro
- Repository: https://github.com/phamvantu090303/tro

## Overview

##### Frontend Layer
- **React Application**
- Components
- Pages
- State Management
- Routing

##### Backend Layer
- **Node.js Server**
- Controllers
- Services
- Models
- Middlewares

##### Database
- **Database Server** (e.g., MongoDB, PostgreSQL)

##### Infrastructure
- **Nginx**
- Reverse Proxy
- Static File Serving
- **Docker Containers**
- Frontend Container
- Backend Container
- Nginx Container

##### Interactions
- Frontend communicates with Backend through APIs.
- Backend interacts with the Database.
- Nginx routes traffic to Frontend or Backend as needed.
- Docker Compose manages the lifecycle of all containers.

##### Final Recommendations

- **Keep It Organized:** Align components logically to represent the flow of data and interactions without clutter.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global entities
    subgraph "Frontend (React)" 
        FE_Components["UI Components"]:::frontend
        FE_Pages["Pages"]:::frontend
        FE_Context["Context API"]:::frontend
        FE_Store["Store"]:::frontend
        FE_Router["Routing"]:::frontend
        FE_Assets["Assets"]:::frontend
    end

    subgraph "Backend (Node.js)" 
        BE_Controllers["Controllers"]:::backend
        BE_Services["Services"]:::backend
        BE_Models["Models"]:::backend
        BE_Middlewares["Middlewares"]:::backend
        BE_Utilities["Utilities"]:::backend
    end

    subgraph "Database" 
        DB["Database"]:::database
    end

    subgraph "Infrastructure" 
        FE_Docker["Frontend Dockerfile"]:::infra
        BE_Docker["Backend Dockerfile"]:::infra
        DockerCompose["Docker Compose"]:::infra
        Nginx_Config["Nginx Configuration"]:::infra
        Nginx["Nginx"]:::infra
        Docker["Docker"]:::infra
    end

    %% Connections
    FE_Components --> FE_Pages
    FE_Pages --> FE_Context
    FE_Context --> FE_Store
    FE_Store --> FE_Router
    FE_Router -->|Routes to| BE_Controllers
    BE_Controllers --> BE_Services
    BE_Services --> BE_Models
    BE_Models --> DB
    BE_Controllers --> BE_Middlewares
    BE_Services --> BE_Utilities
    FE_Router -->|API Calls| BE_Controllers
    Nginx --> FE_Router
    Nginx --> BE_Controllers
    DockerCompose --> FE_Docker
    DockerCompose --> BE_Docker
    DockerCompose --> Nginx
    DockerCompose --> Docker
    Docker --> Nginx
    Docker --> FE_Components
    Docker --> BE_Controllers

    %% Click Events
    click FE_Components "https://github.com/phamvantu090303/tro/tree/main/FE/src/components"
    click FE_Pages "https://github.com/phamvantu090303/tro/tree/main/FE/src/pages"
    click FE_Context "https://github.com/phamvantu090303/tro/tree/main/FE/src/Context"
    click FE_Store "https://github.com/phamvantu090303/tro/tree/main/FE/src/Store"
    click FE_Router "https://github.com/phamvantu090303/tro/tree/main/FE/src/Router"
    click FE_Assets "https://github.com/phamvantu090303/tro/tree/main/FE/src/assets"
    click BE_Controllers "https://github.com/phamvantu090303/tro/tree/main/BE/src/controllers"
    click BE_Services "https://github.com/phamvantu090303/tro/tree/main/BE/src/services"
    click BE_Models "https://github.com/phamvantu090303/tro/tree/main/BE/src/models"
    click BE_Middlewares "https://github.com/phamvantu090303/tro/tree/main/BE/src/middlewares"
    click BE_Utilities "https://github.com/phamvantu090303/tro/tree/main/BE/src/utils"
    click FE_Docker "https://github.com/phamvantu090303/tro/tree/main/FE/Dockerfile"
    click BE_Docker "https://github.com/phamvantu090303/tro/tree/main/BE/Dockerfile"
    click DockerCompose "https://github.com/phamvantu090303/tro/blob/main/docker-compose.yml"
    click Nginx_Config "https://github.com/phamvantu090303/tro/blob/main/nginx/default.conf"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000;
    classDef backend fill:#90EE90,stroke:#000;
    classDef database fill:#FFD700,stroke:#000;
    classDef infra fill:#D3D3D3,stroke:#000;

    class FE_Components,FE_Pages,FE_Context,FE_Store,FE_Router,FE_Assets frontend;
    class BE_Controllers,BE_Services,BE_Models,BE_Middlewares,BE_Utilities backend;
    class DB database;
    class FE_Docker,BE_Docker,DockerCompose,Nginx_Config,Nginx,Docker infra;
```
