# martinellich/jtaf4 architecture

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

- Interactive diagram: https://gitdiagram.com/martinellich/jtaf4
- Repository: https://github.com/martinellich/jtaf4

## Overview

##### Main System Components

a. Frontend Layer:
- Vaadin-based UI components (found in src/main/java/ch/jtaf/ui)
- Main views (Dashboard, Athletes, Clubs, Events, etc.)
- Theme components (src/main/frontend/themes/jtaf)

b. Application Layer:
- Security components (src/main/java/ch/jtaf/configuration/security)
- Domain services (src/main/java/ch/jtaf/domain)
- Reporting system (src/main/java/ch/jtaf/reporting)

c. Data Layer:
- Database (PostgreSQL, evident from scripts/start_postgres.sh)
- Data Access Objects (all *DAO.java files)
- Database migrations (src/main/resources/db/migration)

##### Key Architectural Elements

a. Core Business Components:
- Competition management
- Results calculation system
- Ranking services
- User management
- Organization management

b. Integration Points:
- Security integration
- IAAF formula integration for points calculation
- Reporting system

##### Component Relationships

Key interactions:

**[Web Browser] → [Vaadin UI Layer]**
- ↓
**[Security Layer] ← → [Application Services]**
- ↓
**[Domain Services] → [Data Access Layer] → [PostgreSQL Database]**
- ↓
**[Reporting System]**

##### Technical Stack Indicators

Technologies:
- Vaadin (UI Framework)
- Spring Boot (Application Framework)
- jOOQ (Database Access)
- Flyway (Database Migrations)
- PostgreSQL (Database)

##### Deployment Context

Deployment-related components:
- Docker container support (Dockerfile)
- Cloud deployment readiness (fly.toml)
- CI/CD pipeline (.github/workflows)

This architecture reflects a modern web application with clear separation of concerns, robust security, and scalable design suitable for managing track and field competitions.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Legend"
        UI[UI Component]:::ui
        BL[Business Logic]:::business
        DA[Data Access]:::data
        SEC[Security Component]:::security
        REP[Reporting Component]:::report
    end

    subgraph "Frontend Layer"
        Browser[Web Browser]:::external
        Browser --> VaadinUI[Vaadin UI Framework]:::ui
        VaadinUI --> MainViews[Main Views]:::ui
        VaadinUI --> Dialogs[UI Dialogs]:::ui
        VaadinUI --> Theme[Theme Components]:::ui
    end

    subgraph "Security Layer"
        SecConfig[Security Configuration]:::security
        SecContext[Security Context]:::security
        UserMgmt[User Management]:::security
    end

    subgraph "Application Layer"
        CompMgmt[Competition Management]:::business
        ResultCalc[Results Calculator]:::business
        RankingServ[Ranking Services]:::business
        OrgMgmt[Organization Management]:::business
    end

    subgraph "Reporting Layer"
        ReportGen[Report Generation]:::report
        ReportModels[Report Data Models]:::report
        CompReport[Competition Reports]:::report
        SeriesReport[Series Reports]:::report
    end

    subgraph "Data Layer"
        DAOs[Data Access Objects]:::data
        DBMigrations[Database Migrations]:::data
        DB[(PostgreSQL)]:::data
    end

    subgraph "Deployment"
        Docker[Docker Container]:::deploy
        Cloud[Cloud Deployment]:::deploy
        CICD[CI/CD Pipeline]:::deploy
    end

    VaadinUI --> SecConfig
    SecConfig --> SecContext
    SecContext --> UserMgmt
    SecContext --> CompMgmt
    CompMgmt --> DAOs
    ResultCalc --> DAOs
    RankingServ --> DAOs
    OrgMgmt --> DAOs
    DAOs --> DB
    DBMigrations --> DB
    CompMgmt --> ReportGen
    RankingServ --> ReportGen
    ReportGen --> CompReport
    ReportGen --> SeriesReport
    ReportModels --> ReportGen

    %% Click Events
    click MainViews "https://github.com/martinellich/jtaf4/tree/develop/src/main/java/ch/jtaf/ui/"
    click Theme "https://github.com/martinellich/jtaf4/tree/develop/src/main/frontend/themes/jtaf/"
    click Dialogs "https://github.com/martinellich/jtaf4/tree/develop/src/main/java/ch/jtaf/ui/dialog/"
    click SecConfig "https://github.com/martinellich/jtaf4/tree/develop/src/main/java/ch/jtaf/configuration/security/"
    click UserMgmt "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/domain/UserService.java"
    click SecContext "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/configuration/security/SecurityContext.java"
    click CompMgmt "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/domain/CompetitionDAO.java"
    click ResultCalc "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/domain/ResultCalculator.java"
    click RankingServ "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/domain/CompetitionRankingService.java"
    click DAOs "https://github.com/martinellich/jtaf4/tree/develop/src/main/java/ch/jtaf/domain/"
    click DBMigrations "https://github.com/martinellich/jtaf4/tree/develop/src/main/resources/db/migration/"
    click ReportGen "https://github.com/martinellich/jtaf4/tree/develop/src/main/java/ch/jtaf/reporting/report/"
    click ReportModels "https://github.com/martinellich/jtaf4/tree/develop/src/main/java/ch/jtaf/reporting/data/"
    click CompReport "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/reporting/report/CompetitionRankingReport.java"
    click SeriesReport "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/reporting/report/SeriesRankingReport.java"
    click OrgMgmt "https://github.com/martinellich/jtaf4/blob/develop/src/main/java/ch/jtaf/domain/OrganizationDAO.java"
    click Docker "https://github.com/martinellich/jtaf4/tree/develop/Dockerfile"
    click Cloud "https://github.com/martinellich/jtaf4/blob/develop/fly.toml"
    click CICD "https://github.com/martinellich/jtaf4/blob/develop/.github/workflows/ci.yml"

    classDef ui fill:#2196F3,stroke:#1565C0,color:white
    classDef business fill:#4CAF50,stroke:#2E7D32,color:white
    classDef data fill:#FFC107,stroke:#FFA000,color:black
    classDef security fill:#F44336,stroke:#C62828,color:white
    classDef report fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef external fill:#78909C,stroke:#546E7A,color:white
    classDef deploy fill:#FF9800,stroke:#F57C00,color:white
```
