# checku-dev/checku-server architecture

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

- Interactive diagram: https://gitdiagram.com/checku-dev/checku-server
- Repository: https://github.com/checku-dev/checku-server

## Overview

##### Main Components

a. Client Layer:
- Mobile Application (Android/iOS clients)
- As the entry point for user interactions

b. Server Layer (Spring Boot Application):
- API Gateway/Load Balancer (Nginx)
- Core Application Components divided into domains:
- User Management
- Subject Management
- Notification System
- Bookmark System
- Portal Integration
- Schedule Management

c. External Services:
- Firebase Cloud Messaging (FCM) for push notifications
- University Portal System (integrated via Feign Client)

d. Data Layer:
- MySQL Database (AWS RDS)
- Redis Cache (for portal sessions)

##### Component Relationships

- Client → Nginx → Spring Boot Application
- Spring Boot Application → AWS RDS
- Spring Boot Application → Redis
- Spring Boot Application → FCM
- Spring Boot Application → University Portal

##### Detailed Architecture Breakdown

a. Application Layer (organize by domains):
**Domain Components:**
- User Domain (Authentication/Authorization)
- Subject Domain (Course Information)
- Notification Domain (Alert System)
- Bookmark Domain (User Preferences)
- Portal Domain (University Integration)
- Schedule Domain (Time Management)
- Topic Domain (Notification Topics)

b. Infrastructure Layer:
**Infrastructure Components:**
- AWS EC2 (Application Hosting)
- AWS RDS (Database)
- Redis (Caching)
- Jenkins (CI/CD)
- Docker (Containerization)

##### Important Architectural Patterns to Highlight

- Domain-Driven Design (DDD) structure
- Layered architecture (Controller → Service → Repository)
- Aspect-Oriented Programming (AOP) for cross-cutting concerns
- Feign Client for external service integration
- Caching strategy with Redis
- Asynchronous processing for notifications

##### Additional Elements

- Security layer (Jasypt encryption)
- Error handling flow
- Logging system (with different appenders)
- Health check endpoints
- Docker containerization boundary
- Load balancing with Nginx

##### Specific Implementation Details

- Interaction between the notification system and FCM
- Portal session management with Redis
- Demonstrate the bookmark and subject tracking flow
- Async notification processing pattern

This system design should effectively communicate how the application handles real-time course registration monitoring, user notifications, and integration with the university's portal system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph CL[Client Layer]
        MA[Mobile App]:::client
    end

    %% Load Balancer
    LB[Nginx Load Balancer]:::infra

    %% Application Layer
    subgraph AL[Application Layer]
        %% Domain Components
        subgraph DC[Domain Components]
            UM["User Management"]:::domain
            SM["Subject Management"]:::domain
            NS["Notification System"]:::domain
            BS["Bookmark System"]:::domain
            PI["Portal Integration"]:::domain
            SCH["Schedule Management"]:::domain
            TM["Topic Management"]:::domain
        end

        %% Cross-cutting Components
        subgraph CC[Cross-cutting Components]
            EH["Error Handler"]:::support
            LS["Logging System"]:::support
            HM["Health Monitor"]:::support
        end
    end

    %% Infrastructure Layer
    subgraph IL[Infrastructure Layer]
        %% Data Storage
        DB[(AWS RDS)]:::storage
        RC[(Redis Cache)]:::storage

        %% External Services
        FCM[Firebase Cloud Messaging]:::external
        UP[University Portal]:::external
    end

    %% Relationships
    MA --> LB
    LB --> AL
    
    %% Domain Component Relations
    UM --> DB
    SM --> DB
    NS --> FCM
    BS --> DB
    PI --> UP
    PI --> RC
    SCH --> DB
    TM --> DB

    %% Cross-cutting Relations
    AL --> EH
    AL --> LS
    AL --> HM

    %% Click Events
    click UM "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/domain/user/"
    click SM "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/domain/subject/"
    click NS "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/domain/notification/"
    click BS "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/domain/bookmark/"
    click PI "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/domain/portal/"
    click SCH "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/domain/schedule/"
    click TM "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/domain/topic/"
    click FCM "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/infra/push/"
    click RC "https://github.com/CHECKU-dev/checku-server/blob/main/src/main/java/dev/checku/checkuserver/global/config/RedisConfig.java"
    click EH "https://github.com/CHECKU-dev/checku-server/tree/main/src/main/java/dev/checku/checkuserver/global/error/"
    click LS "https://github.com/CHECKU-dev/checku-server/blob/main/src/main/java/dev/checku/checkuserver/global/aop/LogAspect.java"
    click UP "https://github.com/CHECKU-dev/checku-server/blob/main/src/main/java/dev/checku/checkuserver/domain/portal/infra/PortalFeignClient.java"
    click HM "https://github.com/CHECKU-dev/checku-server/blob/main/src/main/java/dev/checku/checkuserver/HealthController.java"

    %% Styles
    classDef client fill:#2374ab
    classDef infra fill:#878787
    classDef domain fill:#57a773
    classDef support fill:#484848
    classDef storage fill:#ffd151
    classDef external fill:#ff8484

    %% Legend
    subgraph Legend
        C1[Client]:::client
        I1[Infrastructure]:::infra
        D1[Domain Service]:::domain
        S1[Support Service]:::support
        ST1[(Storage)]:::storage
        E1[External Service]:::external
    end
```
