# packman1783/task-manager architecture

> Architecture diagram of the GitHub repository packman1783/task-manager, 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/packman1783/task-manager
- Repository: https://github.com/packman1783/task-manager

## Overview

##### Main Components

a) Frontend Layer:
- Static Frontend (React-based, evident from the static assets)
- It to the Backend via REST API calls

b) API Layer (Controllers):
- Following controllers:
- AuthController (authentication)
- TasksController
- UsersController
- LabelsController
- TaskStatusesController
- WelcomeController

c) Service Layer:
- Services:
- CustomUserDetailsService
- TasksService
- UsersService
- LabelService
- TaskStatusService

d) Repository Layer:
- JPA repositories:
- TaskRepository
- UserRepository
- LabelRepository
- TaskStatusRepository

e) Security Components:
- SecurityConfig
- JWTUtils
- RsaKeyProperties (for JWT signing)

f) Database Layer:
- Entity relationships between:
- User
- Task
- TaskStatus

- [Frontend Layer]
- ↓
- [API Layer (Controllers)]
- ↓
- [Security Layer]
- ↓
- [Service Layer]
- ↓
- [Repository Layer]
- ↓
- [Database Layer]

##### Important Relationships

- Security filter chain flow from Security Layer
- Service-repository relationships
- Entity relationships in the database layer:
- Task → User (many-to-one for assignee)
- Task → TaskStatus (many-to-one)
- Task ↔ Label (many-to-many)

##### Additional Components

- Exception Handling (GlobalExceptionHandler)
- DTO mappings (show conversion flow)
- Configuration components (EncodersConfig, JacksonConfig)
- Specification filters for Task entities

##### Technical Details to Note

- Notes about the technology stack:
- Spring Boot
- Spring Security
- Spring Data JPA
- JWT Authentication
- React Frontend

##### Deployment Context

- Containerization boundary (Dockerfile)
- Environment-specific configurations
- Render.com deployment setup

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black
    classDef service fill:#e67e22,stroke:#d35400,color:white
    classDef repository fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef handler fill:#e74c3c,stroke:#c0392b,color:white
    classDef mapper fill:#1abc9c,stroke:#16a085,color:white

    %% Frontend Layer
    subgraph Frontend
        UI["Static Frontend (React)"]:::frontend
        Assets["Frontend Assets"]:::frontend
    end
    click UI "https://github.com/packman1783/Task-manager/blob/main/src/main/resources/static/index.html"
    click Assets "https://github.com/packman1783/Task-manager/blob/main/src/main/resources/static/assets/index-256372df.js"

    %% API Layer
    subgraph Controllers
        Auth["AuthController"]:::api
        Tasks["TasksController"]:::api
        Users["UsersController"]:::api
        Labels["LabelsController"]:::api
        TaskStatuses["TaskStatusesController"]:::api
    end
    click Auth "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/controller/api/AuthController.java"
    click Tasks "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/controller/api/TasksController.java"
    click Users "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/controller/api/UsersController.java"
    click Labels "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/controller/api/LabelsController.java"
    click TaskStatuses "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/controller/api/TaskStatusesController.java"

    %% Security Layer
    subgraph Security
        SecConfig["SecurityConfig"]:::security
        JWT["JWTUtils"]:::security
        RSA["RsaKeyProperties"]:::security
    end
    click SecConfig "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/config/SecurityConfig.java"
    click JWT "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/util/JWTUtils.java"
    click RSA "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/component/RsaKeyProperties.java"

    %% Service Layer
    subgraph Services
        UserDetails["CustomUserDetailsService"]:::service
        TaskService["TasksService"]:::service
        UserService["UsersService"]:::service
        LabelService["LabelService"]:::service
        StatusService["TaskStatusService"]:::service
    end
    click UserDetails "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/service/CustomUserDetailsService.java"
    click TaskService "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/service/TasksService.java"
    click UserService "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/service/UsersService.java"
    click LabelService "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/service/LabelService.java"
    click StatusService "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/service/TaskStatusService.java"

    %% Repository Layer
    subgraph Repositories
        TaskRepo["TaskRepository"]:::repository
        UserRepo["UserRepository"]:::repository
        LabelRepo["LabelRepository"]:::repository
        StatusRepo["TaskStatusRepository"]:::repository
    end
    click TaskRepo "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/repository/TaskRepository.java"
    click UserRepo "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/repository/UserRepository.java"
    click LabelRepo "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/repository/LabelRepository.java"
    click StatusRepo "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/repository/TaskStatusRepository.java"

    %% Database Layer
    subgraph Database
        UserEntity["User"]:::database
        TaskEntity["Task"]:::database
        LabelEntity["Label"]:::database
        StatusEntity["TaskStatus"]:::database
    end
    click UserEntity "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/model/User.java"
    click TaskEntity "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/model/Task.java"
    click LabelEntity "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/model/Label.java"
    click StatusEntity "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/model/TaskStatus.java"

    %% Exception Handling
    ExHandler["GlobalExceptionHandler"]:::handler
    click ExHandler "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/handler/GlobalExceptionHandler.java"

    %% Data Initialization
    DataInit["DataInitializer"]:::service
    click DataInit "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/component/DataInitializer.java"

    %% Mappers
    TaskMap["TaskMapper"]:::mapper
    UserMap["UserMapper"]:::mapper
    LabelMap["LabelMapper"]:::mapper
    StatusMap["TaskStatusMapper"]:::mapper
    click TaskMap "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/mapper/TaskMapper.java"
    click UserMap "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/mapper/UserMapper.java"
    click LabelMap "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/mapper/LabelMapper.java"
    click StatusMap "https://github.com/packman1783/Task-manager/blob/main/src/main/java/hexlet/code/mapper/TaskStatusMapper.java"

    %% Relationships
    UI --> Controllers
    Controllers --> Security
    Security --> Services
    Services --> Repositories
    Repositories --> Database
    Controllers --> ExHandler
    Controllers --> TaskMap & UserMap & LabelMap & StatusMap
    DataInit --> Services

    %% Database Relationships
    TaskEntity --> UserEntity
    TaskEntity --> StatusEntity
    TaskEntity --> LabelEntity

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        API_L["API"]:::api
        Security_L["Security"]:::security
        Service_L["Service"]:::service
        Repository_L["Repository"]:::repository
        Database_L["Database"]:::database
        Handler_L["Exception Handler"]:::handler
        Mapper_L["Mapper"]:::mapper
    end
```
