# team-aliens/dms-backend architecture

> Architecture diagram of the GitHub repository team-aliens/dms-backend, 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/team-aliens/dms-backend
- Repository: https://github.com/team-aliens/dms-backend

## Overview

##### High-Level Architecture Components

a) External Layer (Adapters):

b) Application Layer:
- Use Cases (Facade pattern)
- Domain Services
- Domain Models

c) Ports Layer:
- Input Ports (Primary/Driving)
- Output Ports (Secondary/Driven)

##### Domain Components

Create distinct sections for each core domain:
- Auth (Authentication/Authorization)
- Student Management
- Room Management
- Points Management
- Meal Management
- Notice System
- Study Room Management
- Outing Management
- Volunteer Management
- Notification System

##### Technical Components

Supporting technical components:
- AWS Services (S3, SES)
- Firebase Cloud Messaging
- Redis
- PostgreSQL Database
- Security Layer (JWT)
- Event System

##### Flow Representations

- Request flow: Web Adapter → Use Case → Domain Service → Persistence
- Event flow: Domain Events → Event Handlers
- External service interactions

##### Specific Implementation Details

Annotations showing:
- Kotlin/Spring Boot as the primary technology
- Hexagonal Architecture patterns
- DDD concepts (Aggregates, Entities, Value Objects)
- CQRS pattern (Command/Query separation)

##### Clean Architecture aspects
- Clear boundaries between layers
- Dependency rules (dependencies point inward)
- How the core domain is isolated

##### Service Structure
- CheckService
- GetService
- CommandService
- How they interact with Use Cases

##### Database Interactions
- ERD connection
- How persistence adapters implement ports

##### Security Flow
- JWT authentication flow
- Authorization checks
- School-specific validations

Remember to use standardized UML or C4 model notation where appropriate, but prioritize clarity and understanding over strict adherence to any particular notation system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#2b4c7e,color:white
    classDef external fill:#6b8bae,color:white
    classDef persistence fill:#86a6c6,color:white
    classDef infrastructure fill:#b9d1e7,color:white
    classDef database fill:#d3d3d3,color:black
    classDef service fill:#98fb98,color:black

    %% Main Layers
    subgraph ExternalLayer["External Layer (Adapters)"]
        WebAdapters["Web Adapters"]
        PersistenceAdapters["Persistence Adapters"]
        InfrastructureAdapters["Infrastructure Adapters"]
    end

    subgraph CoreLayer["Core Layer"]
        UseCases["Use Cases (Facade)"]
        DomainServices["Domain Services"]
        DomainModels["Domain Models"]
    end

    subgraph DomainComponents["Domain Components"]
        Auth["Auth Domain"]:::core
        StudentMgmt["Student Management"]:::core
        RoomMgmt["Room Management"]:::core
        PointsMgmt["Points Management"]:::core
        MealMgmt["Meal Management"]:::core
        NoticeSys["Notice System"]:::core
        StudyRoomMgmt["Study Room Management"]:::core
        OutingMgmt["Outing Management"]:::core
        VolunteerMgmt["Volunteer Management"]:::core
        NotificationSys["Notification System"]:::core
    end

    subgraph TechnicalComponents["Technical Components"]
        Security["Security Layer (JWT)"]:::infrastructure
        EventSystem["Event System"]:::infrastructure
        AWS["AWS Services"]:::service
        Firebase["Firebase FCM"]:::service
        Redis[(Redis)]:::database
        PostgreSQL[(PostgreSQL)]:::database
    end

    %% Relationships
    WebAdapters --> UseCases
    UseCases --> DomainServices
    DomainServices --> DomainModels
    DomainServices --> PersistenceAdapters
    PersistenceAdapters --> PostgreSQL
    InfrastructureAdapters --> AWS
    InfrastructureAdapters --> Firebase
    EventSystem --> NotificationSys
    Security --> Auth

    %% Click Events
    click CoreLayer "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/"
    click WebAdapters "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-presentation/src/main/kotlin/team/aliens/dms/domain/"
    click PersistenceAdapters "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-persistence/src/main/kotlin/team/aliens/dms/persistence/"
    click InfrastructureAdapters "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-infrastructure/src/main/kotlin/team/aliens/dms/"
    click Auth "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/auth/"
    click StudentMgmt "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/student/"
    click RoomMgmt "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/room/"
    click PointsMgmt "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/point/"
    click MealMgmt "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/meal/"
    click NoticeSys "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/notice/"
    click StudyRoomMgmt "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/studyroom/"
    click OutingMgmt "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/"
    click VolunteerMgmt "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/volunteer/"
    click NotificationSys "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-core/src/main/kotlin/team/aliens/dms/domain/notification/"
    click Security "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-infrastructure/src/main/kotlin/team/aliens/dms/global/security/"
    click EventSystem "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-infrastructure/src/main/kotlin/team/aliens/dms/event/"
    click AWS "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-infrastructure/src/main/kotlin/team/aliens/dms/thirdparty/"
    click Firebase "https://github.com/team-aliens/DMS-Backend/tree/develop/dms-infrastructure/src/main/kotlin/team/aliens/dms/thirdparty/notification/"
    click Redis "https://github.com/team-aliens/DMS-Backend/blob/develop/dms-persistence/src/main/kotlin/team/aliens/dms/global/config/RedisConfig.kt"
```
