# makdinoven/chaldea architecture

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

- Interactive diagram: https://gitdiagram.com/makdinoven/chaldea
- Repository: https://github.com/makdinoven/chaldea

## Overview

##### Main Components

a. Frontend Layer:
- React-based frontend application (located in services/frontend/app-chaldea)
- It using a web browser symbol or client interface block

b. API Gateway:
- Nginx-based gateway (in docker/api-gateway)
- Acts as the entry point for all client requests

c. Microservices (Core Services):
- User Service: Authentication and user management
- Character Service: Character management
- Character Attributes Service: Character properties
- Inventory Service: Item management
- Skills Service: Character abilities
- Locations Service: Game world locations
- Photo Service: Image management with Google Cloud Storage integration
- Notification Service: User notifications
- Admin Panel Service: Administrative functions

d. Database Layer:
- MySQL databases (indicated by docker/mysql)
- Separate database instances for different services

e. Message Broker:
- RabbitMQ (shown in docker/rabbitmq)
- Handles asynchronous communication between services

**[Client Layer]**
- ↓
**[API Gateway]**
- ↓
**[Microservices Layer]**
- ↓
**[Database Layer]**

##### Specific Elements

b. Service Details:
- Technology labels (FastAPI, React, MySQL, etc.)
- Port numbers where relevant
- Service dependencies

c. Infrastructure Elements:
- Docker containers (shown by Dockerfile presence)
- Nginx configurations
- Database backup systems

##### Notes Section

A notes section explaining:
- Service discovery mechanism
- Deployment strategy (Docker/Kubernetes)
- Backup and recovery procedures
- Monitoring and logging approaches

Remember to include the development tools and support services:
- Adminer/phpMyAdmin for database management
- CI/CD pipeline components (shown in .github/workflows)
- Development and testing environments

This system appears to be a complex character management platform with strong separation of concerns through microservices, making it crucial to show clear boundaries and interactions between components while maintaining a comprehensive view of the entire system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    Client["Web Browser"]:::client

    %% API Gateway Layer
    APIGateway["API Gateway (Nginx)"]:::gateway
    click APIGateway "https://github.com/makdinoven/Chaldea/tree/main/docker/api-gateway"

    %% Frontend Layer
    Frontend["React Frontend"]:::frontend
    click Frontend "https://github.com/makdinoven/Chaldea/tree/main/services/frontend/app-chaldea"

    %% Microservices Layer
    subgraph Services["Microservices Layer"]
        UserService["User Service"]:::service
        click UserService "https://github.com/makdinoven/Chaldea/tree/main/services/user-service"
        
        CharacterService["Character Service"]:::service
        click CharacterService "https://github.com/makdinoven/Chaldea/tree/main/services/character-service"
        
        AttributesService["Character Attributes Service"]:::service
        click AttributesService "https://github.com/makdinoven/Chaldea/tree/main/services/character-attributes-service"
        
        InventoryService["Inventory Service"]:::service
        click InventoryService "https://github.com/makdinoven/Chaldea/tree/main/services/inventory-service"
        
        SkillsService["Skills Service"]:::service
        click SkillsService "https://github.com/makdinoven/Chaldea/tree/main/services/skills-service"
        
        LocationsService["Locations Service"]:::service
        click LocationsService "https://github.com/makdinoven/Chaldea/tree/main/services/locations-service"
        
        PhotoService["Photo Service"]:::service
        click PhotoService "https://github.com/makdinoven/Chaldea/tree/main/services/photo-service"
        
        NotificationService["Notification Service"]:::service
        click NotificationService "https://github.com/makdinoven/Chaldea/tree/main/services/notification-service"
        
        AdminService["Admin Panel Service"]:::service
        click AdminService "https://github.com/makdinoven/Chaldea/tree/main/docker/admin-panel-service"
    end

    %% Message Broker
    RabbitMQ["RabbitMQ"]:::messagebroker
    click RabbitMQ "https://github.com/makdinoven/Chaldea/tree/main/docker/rabbitmq"

    %% Database Layer
    subgraph Databases["Database Layer"]
        MySQL["MySQL Databases"]:::database
        click MySQL "https://github.com/makdinoven/Chaldea/tree/main/docker/mysql"
        
        DBBackup["Database Backup System"]:::database
        click DBBackup "https://github.com/makdinoven/Chaldea/tree/main/docker/mysql/backups"
    end

    %% Database Management Tools
    subgraph DBTools["Database Management"]
        Adminer["Adminer"]:::dbtool
        click Adminer "https://github.com/makdinoven/Chaldea/tree/main/docker/adminer"
        
        phpMyAdmin["phpMyAdmin"]:::dbtool
        click phpMyAdmin "https://github.com/makdinoven/Chaldea/tree/main/docker/phpmyadmin"
    end

    %% External Services
    GCS["Google Cloud Storage"]:::external

    %% Connections
    Client --> APIGateway
    APIGateway --> Frontend
    APIGateway --> Services
    
    %% Service Interconnections
    Services <--> RabbitMQ
    Services <--> MySQL
    PhotoService <--> GCS
    DBTools --> MySQL
    MySQL --> DBBackup

    %% CI/CD
    CICD["CI/CD Pipeline"]:::cicd
    click CICD "https://github.com/makdinoven/Chaldea/blob/main/.github/workflows/ci.yml"
    CICD --> Services

    %% Styles
    classDef client fill:#E1F5FE,stroke:#0288D1
    classDef frontend fill:#E8F5E9,stroke:#388E3C
    classDef gateway fill:#FFF3E0,stroke:#F57C00
    classDef service fill:#F3E5F5,stroke:#7B1FA2
    classDef database fill:#FFEBEE,stroke:#D32F2F
    classDef messagebroker fill:#E0F2F1,stroke:#00796B
    classDef external fill:#FCE4EC,stroke:#C2185B
    classDef dbtool fill:#E8EAF6,stroke:#3F51B5
    classDef cicd fill:#FFF8E1,stroke:#FFA000

    %% Legend
    subgraph Legend
        Client_L["Client"]:::client
        Frontend_L["Frontend"]:::frontend
        Gateway_L["Gateway"]:::gateway
        Service_L["Microservice"]:::service
        Database_L["Database"]:::database
        MessageBroker_L["Message Broker"]:::messagebroker
        External_L["External Service"]:::external
        DBTool_L["DB Management"]:::dbtool
        CICD_L["CI/CD"]:::cicd
    end
```
