# coscup/coscup-volunteer architecture

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

- Interactive diagram: https://gitdiagram.com/coscup/coscup-volunteer
- Repository: https://github.com/coscup/coscup-volunteer

## Overview

##### Main Components Identification

a) Frontend Layer:
- Web Interface (templates directory)
- Static Assets (static directory)
- Documentation System (docs_dev directory)

b) Backend Layer:
- API Service (api directory)
- View Controllers (view directory)
- Business Logic Modules (module directory)
- Data Models (models directory)
- Celery Task Workers (celery_task directory)

c) Infrastructure Components:
- Nginx Web Server
- MongoDB Database
- RabbitMQ Message Broker
- Memcached
- Docker Containers

##### Component Relationships

**[Client Browsers] → [Nginx Reverse Proxy]**
- ↓
**[Frontend (Templates/Static)] ← [FastAPI Application] → [API Endpoints]**
- ↓
- [Business Logic Modules]
- ↓
- ┌─────────┴─────────┐
- ↓                   ↓
- [Data Models]        [Celery Tasks]
- ↓                   ↓
- [MongoDB]            [RabbitMQ]

##### Infrastructure Layer

Docker container organization:
- Base images (Dockerfile-base)
- Application images (Dockerfile-app)
- Development environments
- Service containers (MongoDB, RabbitMQ, Memcached)

##### Integration Points

External service integrations:
- AWS SES for email
- GSuite integration
- GitLab API
- Mattermost
- Telegram

##### Security Layer

Security components:
- API token authentication
- OAuth implementation
- Session management
- Security monitoring

##### Infrastructure deployment

This system design should reflect the volunteer platform's primary goals of handling recruitment, personnel management, and administrative processes while maintaining security and scalability.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser[Client Browser]
    end

    subgraph Infrastructure
        Nginx[Nginx Reverse Proxy]:::server
        click Nginx "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/nginx"
        Docker[Docker Containers]:::container
        click Docker "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/Dockerfile-app"
        DockerBase[Docker Base]:::container
        click DockerBase "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/Dockerfile-base"
        DockerCompose[Docker Compose]:::container
        click DockerCompose "https://github.com/coscup/COSCUP-VOLUNTEER/blob/main/docker-compose.yml"
    end

    subgraph "Frontend Components"
        Templates[Web Templates]:::frontend
        click Templates "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/templates"
        Static[Static Assets]:::frontend
        click Static "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/static"
        EmailTemplates[Email Templates]:::frontend
        click EmailTemplates "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/templates/mail"
        Documentation[Documentation]:::docs
        click Documentation "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/docs_dev"
    end

    subgraph "Application Layer"
        FastAPI[FastAPI Application]:::app
        ViewControllers[View Controllers]:::controller
        click ViewControllers "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/view"
        APIService[API Service]:::api
        click APIService "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/api"
        APIRoutes[API Routes]:::api
        click APIRoutes "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/api/routers"
        APIStructures[API Structures]:::api
        click APIStructures "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/api/apistructs"
    end

    subgraph "Business Layer"
        BusinessLogic[Business Logic]:::logic
        click BusinessLogic "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/module"
        CmdTools[Command Tools]:::logic
        click CmdTools "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/cmdtools"
        Scripts[Project Scripts]:::logic
        click Scripts "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/scripts"
    end

    subgraph "Data Layer"
        Models[Data Models]:::data
        click Models "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/models"
        MongoDB[(MongoDB)]:::database
        Memcached[(Memcached)]:::cache
    end

    subgraph "Task Processing"
        CeleryWorkers[Celery Workers]:::worker
        click CeleryWorkers "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/celery_task"
        RabbitMQ[RabbitMQ]:::queue
    end

    subgraph "Testing"
        Tests[Test Suite]:::test
        click Tests "https://github.com/coscup/COSCUP-VOLUNTEER/tree/main/tests"
    end

    %% Relationships
    Browser --> Nginx
    Nginx --> FastAPI
    FastAPI --> Templates
    FastAPI --> Static
    FastAPI --> ViewControllers
    FastAPI --> APIService
    APIService --> APIRoutes
    APIService --> APIStructures
    ViewControllers --> BusinessLogic
    BusinessLogic --> Models
    Models --> MongoDB
    BusinessLogic --> CeleryWorkers
    CeleryWorkers --> RabbitMQ
    BusinessLogic --> Memcached

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef logic fill:#e67e22,stroke:#d35400,color:white
    classDef data fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef cache fill:#e74c3c,stroke:#c0392b,color:white
    classDef worker fill:#1abc9c,stroke:#16a085,color:white
    classDef queue fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef server fill:#34495e,stroke:#2c3e50,color:white
    classDef container fill:#16a085,stroke:#1abc9c,color:white
    classDef controller fill:#8e44ad,stroke:#9b59b6,color:white
    classDef app fill:#2c3e50,stroke:#34495e,color:white
    classDef test fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef docs fill:#3498db,stroke:#2980b9,color:white
```
