# siatstudy/p1b architecture

> Architecture diagram of the GitHub repository siatstudy/p1b, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/siatstudy/p1b
- Repository: https://github.com/siatstudy/p1b

## Overview

##### Main Components Identification

a) Frontend Layer:
- Login Page Application (src/main/loginpage)
- Main Page Application (src/main/mainpage)
- Both are React-based applications

b) Backend Layer:
- Spring Boot Application (src/main/java/com/example/P1B)
- Contains controllers, services, repositories, and domain models

c) Database Layer:
- Implied by the presence of repositories (UserRepository, TodosRepository, EmailRepository)

##### Key Architectural Elements

a) Frontend Components:
- Login Module (Authentication flows)
- Main Application Module (Todo management, Calendar, Graph views)
- REST API communication with backend

b) Backend Components:
- Controllers Layer:
- AppController
- LoginController
- MailController
- TodosController
- UsersController

- Service Layer:
- EmailService
- TodosService
- UserService

- Repository Layer:
- EmailRepository
- TodosRepository
- UserRepository

- Domain Models:
- User
- Todos
- Email
- Role

c) Configuration & Security:
- EtagConfig
- WebConfig
- ETagValidationFilter

##### Additional Elements

Important aspects:

- API Gateway/Entry points
- Authentication flow
- Data flow between components
- External service interactions (email service)
- Client-side storage (IndexedDB, Web Storage)

##### Notes

Annotations for:
- Security mechanisms
- Caching strategies (ETag)
- Key business logic flows
- Important configuration details

Remember to maintain a balance between detail and clarity, focusing on the key architectural decisions and patterns while avoiding overwhelming detail at the implementation level.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#b3d1ff,stroke:#333
    classDef backend fill:#90EE90,stroke:#333
    classDef database fill:#d3d3d3,stroke:#333
    classDef config fill:#ffeb99,stroke:#333
    classDef security fill:#ffb3b3,stroke:#333
    classDef storage fill:#e6ccff,stroke:#333
    classDef api fill:#ffd700,stroke:#333

    %% Frontend Layer
    subgraph Frontend
        LP["Login Page"]
        MP["Main Page"]
        CS["Client Storage"]
        subgraph ClientStorage
            IDB["IndexedDB"]
            WS["Web Storage"]
        end
    end

    %% Backend Layer
    subgraph Controllers
        AC["App Controller"]
        LC["Login Controller"]
        MC["Mail Controller"]
        TC["Todos Controller"]
        UC["Users Controller"]
    end

    subgraph Services
        ES["Email Service"]
        TS["Todos Service"]
        US["User Service"]
    end

    subgraph Repositories
        ER["Email Repository"]
        TR["Todos Repository"]
        UR["User Repository"]
    end

    subgraph Config
        EC["ETag Config"]
        WC["Web Config"]
        EV["ETag Validation Filter"]
    end

    subgraph Domain
        EM["Email"]
        RO["Role"]
        TO["Todos"]
        US2["User"]
    end

    %% Databases
    DB[(Database)]

    %% Relationships
    LP --> AC
    MP --> AC
    CS --> IDB
    CS --> WS

    AC --> ES
    AC --> TS
    AC --> US
    LC --> US
    MC --> ES
    TC --> TS
    UC --> US

    ES --> ER
    TS --> TR
    US --> UR

    ER --> DB
    TR --> DB
    UR --> DB

    EC --> EV
    WC --> EV

    %% Click Events
    click LP "https://github.com/SiatStudy/P1B/tree/main/src/main/loginpage/"
    click MP "https://github.com/SiatStudy/P1B/tree/main/src/main/mainpage/"
    click IDB "https://github.com/SiatStudy/P1B/tree/main/src/main/mainpage/src/service/indexedDB/"
    click WS "https://github.com/SiatStudy/P1B/tree/main/src/main/mainpage/src/service/webstorage/"
    click AC "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/controller/AppController.java"
    click LC "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/controller/LoginController.java"
    click MC "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/controller/MailController.java"
    click TC "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/controller/TodosController.java"
    click UC "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/controller/UsersController.java"
    click ES "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/service/EmailService.java"
    click TS "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/service/TodosService.java"
    click US "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/service/UserService.java"
    click ER "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/repository/EmailRepository.java"
    click TR "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/repository/TodosRepository.java"
    click UR "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/repository/UserRepository.java"
    click EM "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/domain/Email.java"
    click RO "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/domain/Role.java"
    click TO "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/domain/Todos.java"
    click US2 "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/domain/User.java"
    click EC "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/config/EtagConfig.java"
    click WC "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/config/WebConfig.java"
    click EV "https://github.com/SiatStudy/P1B/blob/main/src/main/java/com/example/P1B/config/validator/ETagValidationFilter.java"

    %% Styling
    class LP,MP,CS frontend
    class AC,LC,MC,TC,UC backend
    class ES,TS,US backend
    class ER,TR,UR backend
    class DB database
    class EC,WC,EV config
    class IDB,WS storage
    class EM,RO,TO,US2 backend
```
