# gentbajko/reports-system architecture

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

- Interactive diagram: https://gitdiagram.com/gentbajko/reports-system
- Repository: https://github.com/gentbajko/reports-system

## Overview

##### Main Components

a) Web Layer:
- Frontend (Templates Layer)
- HTML templates structure (calendar, log, project, task, user sections)
- It's using a templating engine (likely Jinja2 based on the structure)

b) Application Layer:
- Controllers Layer
- Calendar, Dashboard, Log, Project, Task, and User controllers
- Views Layer
- Separate view handlers for different entities
- Dependencies
- Authentication
- Database session management

c) Core Domain Layer:
- Core Models
- User, Project, Task, Log, Calendar entities
- Enums
- Permissions and Task Status

d) Data Access Layer:
- Database Adapters
- MySQL implementation
- Repositories
- Entity-specific repositories
- Models/Mappers
- ORM mappings for each entity
- Session Management
- SQLAlchemy session handling

e) Infrastructure:
- MySQL Database
- Alembic Migrations
- Email Service (indicated by email templates)

**[Web Browser] → [Templates Layer]**
- ↓
**[Controllers Layer] ← → [Views Layer]**
- ↓
**[Core Domain Layer (Models & Enums)]**
- ↓
**[Data Access Layer (Repositories & Mappers)]**
- ↓
**[Database (MySQL)]**

##### Important Relationships

- Authentication flow through the dependencies
- How the email service integrates with the system
- Database migration path using Alembic

##### Technical Details

- Python 3.12 runtime
- FastAPI/ASGI server (implied by the structure)
- SQLAlchemy ORM
- Alembic migrations
- Jinja2 templating
- MySQL database
- UV package management

##### Deployment Components

- Docker container for MySQL
- Application server
- Environment configuration

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Browser
        WB[Web Browser]
    end

    subgraph Templates
        TL[Templates Layer]
        CT["Calendar Templates"]
        LT["Log Templates"]
        PT["Project Templates"]
        TT["Task Templates"]
        UT["User Templates"]
        ET["Email Templates"]
        TL --> |Contains| CT & LT & PT & TT & UT & ET
    end

    subgraph Application
        CL[Controllers Layer]
        VL[Views Layer]
        DP[Dependencies]
        Auth[Authentication]
        DBS[Database Session]
        
        DP --> Auth
        DP --> DBS
        CL <--> VL
        VL --> DP
    end

    subgraph Domain
        CM[Core Models]
        EN[Enums]
        PE["Permissions Enum"]
        TS["Task Status Enum"]
        
        EN --> PE
        EN --> TS
    end

    subgraph DataAccess
        DA[Database Adapter]
        RP[Repositories]
        EM[Entity Mappers]
        SM[Session Management]
        
        RP --> DA
        RP --> EM
        DA --> SM
    end

    subgraph Infrastructure
        DB[(MySQL Database)]
        AM[Alembic Migrations]
        ES[Email Service]
        CF[Configuration]
    end

    subgraph Utils
        PG[Pagination]
        TU[Template Utils]
        EP[Excel Parser]
    end

    WB --> TL
    TL --> CL
    CL --> CM
    VL --> CM
    CM --> RP
    RP --> DB
    AM --> DB
    ES --> ET

    %% Component Mappings
    click TL "https://github.com/GentBajko/reports-system/tree/master/src/backend/templates/"
    click CT "https://github.com/GentBajko/reports-system/tree/master/src/backend/templates/calendar/"
    click LT "https://github.com/GentBajko/reports-system/tree/master/src/backend/templates/log/"
    click PT "https://github.com/GentBajko/reports-system/tree/master/src/backend/templates/project/"
    click TT "https://github.com/GentBajko/reports-system/tree/master/src/backend/templates/task/"
    click UT "https://github.com/GentBajko/reports-system/tree/master/src/backend/templates/user/"
    click ET "https://github.com/GentBajko/reports-system/tree/master/src/backend/templates/email/"
    click CL "https://github.com/GentBajko/reports-system/tree/master/src/backend/controllers/"
    click VL "https://github.com/GentBajko/reports-system/tree/master/src/backend/views/"
    click DP "https://github.com/GentBajko/reports-system/tree/master/src/backend/dependencies/"
    click Auth "https://github.com/GentBajko/reports-system/blob/master/src/backend/dependencies/auth.py"
    click DBS "https://github.com/GentBajko/reports-system/blob/master/src/backend/dependencies/db_session.py"
    click CM "https://github.com/GentBajko/reports-system/tree/master/src/core/models/"
    click PE "https://github.com/GentBajko/reports-system/blob/master/src/core/enums/premissions.py"
    click TS "https://github.com/GentBajko/reports-system/blob/master/src/core/enums/task_status.py"
    click DA "https://github.com/GentBajko/reports-system/blob/master/src/database/adapters/mysql.py"
    click RP "https://github.com/GentBajko/reports-system/tree/master/src/database/repositories/"
    click EM "https://github.com/GentBajko/reports-system/tree/master/src/database/models/"
    click SM "https://github.com/GentBajko/reports-system/blob/master/src/database/sessions/sqlalchemy_session.py"
    click AM "https://github.com/GentBajko/reports-system/tree/master/alembic/"
    click ES "https://github.com/GentBajko/reports-system/blob/master/src/backend/utils/send_emails.py"
    click CF "https://github.com/GentBajko/reports-system/blob/master/src/config/env.py"
    click PG "https://github.com/GentBajko/reports-system/blob/master/src/backend/utils/pagination.py"
    click TU "https://github.com/GentBajko/reports-system/blob/master/src/backend/utils/templates.py"
    click EP "https://github.com/GentBajko/reports-system/blob/master/src/backend/utils/xlsx_parser.py"

    classDef browser fill:#f9f,stroke:#333,stroke-width:2px
    classDef templates fill:#9cf,stroke:#333,stroke-width:2px
    classDef application fill:#9f9,stroke:#333,stroke-width:2px
    classDef domain fill:#ff9,stroke:#333,stroke-width:2px
    classDef dataaccess fill:#f90,stroke:#333,stroke-width:2px
    classDef infrastructure fill:#ccc,stroke:#333,stroke-width:2px
    classDef utils fill:#c9f,stroke:#333,stroke-width:2px

    class WB browser
    class TL,CT,LT,PT,TT,UT,ET templates
    class CL,VL,DP,Auth,DBS application
    class CM,EN,PE,TS domain
    class DA,RP,EM,SM dataaccess
    class DB,AM,ES,CF infrastructure
    class PG,TU,EP utils
```
