# artsiomshshshsk/teamder architecture

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

- Interactive diagram: https://gitdiagram.com/artsiomshshshsk/teamder
- Repository: https://github.com/artsiomshshshsk/teamder

## Overview

##### Main Components Identification
- Frontend/Client (if applicable): Although the file tree is primarily backend, the README mentions a Swagger UI endpoint and links to a web app (Teamder). You might include an “API Client / Web Frontend” component.
- Backend Service: The core Spring Boot application. This includes:
- REST Controllers (observe packages like “application”, “project”, “user”, and “security/auth”) handling HTTP requests.
- Service Layer: Business logic across modules (e.g., ApplicationService, ProjectService, UserService).
- Data Access Layer: Repositories interacting with PostgreSQL.
- Exception Handling: Global exception handling via the “advice” package.
- Security Module: JWT-based authentication and authorization (under “security” and “security/auth”).
- Database: PostgreSQL (as mentioned in the README).
- External Services & Integrations:
- AWS S3 for file storage/integration (configured in AWSConfig, S3ConfigProperties, and used in the utilities for file uploads).
- Email Service (as part of the “notification” module).
- Infrastructure & Deployment:
- Docker and docker-compose (for containerization).
- Terraform scripts (main.tf, provider.tf) to manage AWS resources like the S3 bucket.

##### Relationships and Interactions
- The API Client or frontend sends HTTP requests to the Backend’s REST Controllers.
- Controllers forward requests to the Service Layer, which applies business logic.
- Services interact with the Repository layer to perform CRUD operations on the PostgreSQL database.
- The Security layer intercepts requests (via JWT filters and authentication controllers) to ensure secure communication.
- For file uploads, the backend uses the file upload utilities which interact with AWS S3 (or mock file services, depending on the configuration).
- Exceptions raised in any layer are captured by the global exception handler (in the “advice” package) and formatted via DTOs.
- Notifications (including email) are triggered by relevant actions via the “notification/service” module.
- Infrastructure orchestration: Docker Compose brings up the containers for the service and database, while Terraform provisions external resources (like S3 via LocalStack for local development or AWS for production deployments).

##### Architectural Patterns & Design Principles
- Layered Architecture: Clear separation between Controllers, Services, Repositories, Security, and Utility functions.
- MVC (at the controller level) and RESTful API design.
- Exception Handling via Controller Advices.
- Use of Dependency Injection (Spring Boot) for inversion of control.
- Security concerns encapsulated in dedicated modules (JWT, filters, auth controllers).

##### Relevant Technologies, Frameworks, and Tools
- Java 17 & Spring Boot (and related Spring modules like Security and Data).
- PostgreSQL.
- Hibernate (for ORM).
- JWT for authentication.
- Docker and Docker Compose for containerization.
- Terraform for infrastructure management.
- AWS (S3) integration and local emulation via LocalStack.
- Testing frameworks: JUnit, Mockito.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Components
    Client["API Client / Web Frontend"]:::frontend

    %% Backend Service Subgraph
    subgraph "Spring Boot Application"
        direction TB
        Backend["Spring Boot Application"]:::backend
        
        %% Controllers Subgraph
        subgraph "Controllers"
            direction TB
            AC["Application Controller"]:::controller
            PC["Project Controller"]:::controller
            UC["User Controller"]:::controller
            AuthC["Authentication Controller"]:::controller
        end

        %% Services Subgraph
        subgraph "Services"
            direction TB
            AS["Application Service"]:::service
            PS["Project Service"]:::service
            US["User Service"]:::service
            AuthS["Authentication Service"]:::service
        end

        %% Repositories Subgraph
        subgraph "Repositories"
            direction TB
            AR["Application Repository"]:::repository
            PR["Project Repository"]:::repository
            UR["User Repository"]:::repository
        end

        %% Exception Handling
        EH["Global Exception Handler"]:::exception

        %% Security Module
        Sec["Security Module (JWT, Config)"]:::security

        %% External Integrations Subgraph
        subgraph "External Integrations"
            direction TB
            AWS["AWS S3 & File Upload Utilities"]:::external
            Email["Email Notification Service"]:::external
        end
    end

    %% Persistence Layer (Database)
    DB["PostgreSQL Database"]:::database

    %% Infrastructure & Deployment
    Docker["Docker & Docker Compose"]:::infrastructure
    Terraform["Terraform Infrastructure"]:::infrastructure

    %% Database Scripts
    Schema["Database Schema & Data Scripts"]:::database

    %% Interactions / Data Flow
    Client -->|"HTTP_Request"| AC
    Client -->|"HTTP_Request"| PC
    Client -->|"HTTP_Request"| UC
    Client -->|"HTTP_Request"| AuthC

    AC -->|"calls"| AS
    PC -->|"calls"| PS
    UC -->|"calls"| US
    AuthC -->|"calls"| AuthS

    AS -->|"interacts"| AR
    PS -->|"interacts"| PR
    US -->|"interacts"| UR

    AR -->|"CRUD_operations"| DB
    PR -->|"CRUD_operations"| DB
    UR -->|"CRUD_operations"| DB

    AS -->|"file_upload"| AWS
    PS -->|"notification"| Email
    US -->|"notification"| Email

    %% Security interception
    Client ---|"secured_by"| Sec
    AuthS ---|"validate_jwt"| Sec

    %% Exception Handling connections
    AC ---|"handled_by"| EH
    PC ---|"handled_by"| EH
    UC ---|"handled_by"| EH
    AuthC ---|"handled_by"| EH

    %% Infrastructure connections
    Docker ---|"containers"| Backend
    Docker ---|"containers"| DB
    Terraform ---|"provisions"| AWS
    Terraform ---|"provisions"| Email
    Schema --> DB

    %% Click Events
    click Backend "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/FindProjectApplication.java"
    click AC "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/application/ApplicationController.java"
    click PC "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/project/ProjectController.java"
    click UC "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/user/UserController.java"
    click AuthC "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/security/auth/AuthenticationController.java"
    
    click AS "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/application/ApplicationService.java"
    click PS "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/project/ProjectService.java"
    click US "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/user/UserService.java"
    click AuthS "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/security/auth/AuthenticationService.java"
    
    click AR "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/application/ApplicationRepository.java"
    click PR "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/project/ProjectRepository.java"
    click UR "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/user/UserRepository.java"
    
    click EH "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/advice/AppExceptionHandler.java"
    click AWS "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/config/AWSConfig.java"
    click Email "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/java/com/github/artsiomshshshsk/findproject/notification/service/EmailService.java"
    click Schema "https://github.com/artsiomshshshsk/teamder/blob/main/src/main/resources/db/schema.sql"
    click Docker "https://github.com/artsiomshshshsk/teamder/tree/main/Dockerfile"
    click Terraform "https://github.com/artsiomshshshsk/teamder/blob/main/main.tf"

    %% Styles
    classDef frontend fill:#ffebcd,stroke:#8b4513,stroke-width:2px;
    classDef backend fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef controller fill:#ffe4e1,stroke:#cd5c5c,stroke-width:1px;
    classDef service fill:#e0ffe0,stroke:#228b22,stroke-width:1px;
    classDef repository fill:#ffe4ff,stroke:#8a2be2,stroke-width:1px;
    classDef exception fill:#ffc0cb,stroke:#db7093,stroke-width:1px;
    classDef security fill:#fffacd,stroke:#daa520,stroke-width:1px;
    classDef external fill:#e6e6fa,stroke:#9370db,stroke-width:1px;
    classDef database fill:#f0fff0,stroke:#32cd32,stroke-width:1px;
    classDef infrastructure fill:#d3d3d3,stroke:#696969,stroke-width:1px;
```
