# l1a-crew/zzekak-api architecture

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

- Interactive diagram: https://gitdiagram.com/l1a-crew/zzekak-api
- Repository: https://github.com/l1a-crew/zzekak-api

## Overview

##### Main Components

a. Core Architecture Layers:
- API Module (External Interface)
- Core Module (Domain Logic)
- Infrastructure Module (Data & External Services)
- Batch Module (Scheduled Tasks)

b. Key Domain Components:
- User Management
- Appointment System
- Address/Location Services
- Mission System
- Push Notification System

**External Clients ─► API Layer**

- ▼
- Core Layer

- ▼
- Infrastructure Layer

- ▼
- External Services

##### Detailed Component Breakdown

a. API Layer (Blue Components):
- REST Controllers
- Security Config (JWT Authentication)
- Exception Handling
- Swagger Documentation
- Health Check Endpoints

b. Core Layer (Green Components):
- Domain Models
- Use Cases
- Repository Interfaces
- Business Logic
- Domain Events

c. Infrastructure Layer (Orange Components):
- Database Repositories
- External Service Integrations
- S3 Storage
- Push Notification Infrastructure
- Entity Mappings

d. Batch Processing (Purple Components):
- Scheduler Configuration
- Push Notification Batch Jobs
- Batch Services

##### Important Relationships to Highlight

- JWT authentication flow
- Appointment creation and management flow
- User authentication and authorization paths
- Demonstrate push notification delivery system
- Address/location service integration

##### Technical Details

- Database connections
- External API integrations (for address/location services)
- AWS S3 integration
- Push notification service
- Scheduled batch jobs

##### Additional Elements

- Security layer showing JWT filter and token provider
- Exception handling flow
- Audit logging path
- Batch scheduling timeline
- Push notification delivery flow

##### Specific Implementation Notes

- Clean architecture separation between api/core/infra modules
- Domain-driven design approach in the core module
- Demonstrate the repository pattern implementation
- Batch processing schedule and triggers

Remember to:
- Use consistent notation
- Brief descriptions for complex flows
- Version numbers for major components
- Error handling paths

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Clients
    Client(("External Clients")):::client

    %% API Layer
    subgraph API
        Controllers["REST Controllers"]:::api
        Security["Security Config"]:::api
        Exception["Exception Handler"]:::api
        Swagger["Swagger Docs"]:::api
        Health["Health Check"]:::api
    end

    %% Core Layer
    subgraph Core
        DomainModels["Domain Models"]:::core
        UseCases["Use Cases"]:::core
        RepoInterfaces["Repository Interfaces"]:::core
        BusinessLogic["Business Logic"]:::core

        subgraph DomainComponents
            UserMgmt["User Management"]:::domain
            AppointmentSys["Appointment System"]:::domain
            AddressService["Address Services"]:::domain
            MissionSystem["Mission System"]:::domain
            PushNotification["Push Notification"]:::domain
        end
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        DBRepos["Database Repositories"]:::infra
        S3Integration["S3 Storage"]:::infra
        EntityMap["Entity Mappings"]:::infra
        Auditing["Audit System"]:::infra
        DB[(Database)]:::database
    end

    %% Batch Processing
    subgraph Batch
        SchedulerConfig["Scheduler Config"]:::batch
        PushJobs["Push Notification Jobs"]:::batch
    end

    %% External Services
    ExternalAPIs[("External APIs")]:::external
    S3[("AWS S3")]:::external

    %% Relationships
    Client --> Controllers
    Controllers --> Security
    Controllers --> Exception
    Controllers --> BusinessLogic
    BusinessLogic --> DomainModels
    BusinessLogic --> UseCases
    UseCases --> RepoInterfaces
    RepoInterfaces --> DBRepos
    DBRepos --> DB
    DBRepos --> EntityMap
    S3Integration --> S3
    AddressService --> ExternalAPIs
    PushJobs --> PushNotification
    SchedulerConfig --> PushJobs

    %% Click Events
    click Controllers "https://github.com/L1A-crew/zzekak-api/tree/main/api/src/main/kotlin/com/zzekak/domain/"
    click Security "https://github.com/L1A-crew/zzekak-api/tree/main/api/src/main/kotlin/com/zzekak/config/security/"
    click Exception "https://github.com/L1A-crew/zzekak-api/tree/main/api/src/main/kotlin/com/zzekak/config/exception/"
    click Swagger "https://github.com/L1A-crew/zzekak-api/tree/main/api/src/main/kotlin/com/zzekak/config/docs/"
    click Health "https://github.com/L1A-crew/zzekak-api/tree/main/api/src/main/kotlin/com/zzekak/config/healthcheck/"
    click DomainModels "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/"
    click UseCases "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/*/usecase/"
    click RepoInterfaces "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/*/repository/"
    click BusinessLogic "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/"
    click DBRepos "https://github.com/L1A-crew/zzekak-api/tree/main/infra/src/main/kotlin/com/zzekak/domain/*/repository/"
    click S3Integration "https://github.com/L1A-crew/zzekak-api/blob/main/infra/src/main/kotlin/com/zzekak/config/S3ConnectionConfig.kt"
    click EntityMap "https://github.com/L1A-crew/zzekak-api/tree/main/infra/src/main/kotlin/com/zzekak/domain/*/entity/"
    click Auditing "https://github.com/L1A-crew/zzekak-api/tree/main/infra/src/main/kotlin/com/zzekak/audit/"
    click SchedulerConfig "https://github.com/L1A-crew/zzekak-api/tree/main/batch/src/main/kotlin/com/zzekak/batch/push/config/"
    click PushJobs "https://github.com/L1A-crew/zzekak-api/tree/main/batch/src/main/kotlin/com/zzekak/batch/push/"
    click UserMgmt "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/user/"
    click AppointmentSys "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/appointment/"
    click AddressService "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/address/"
    click MissionSystem "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/mission/"
    click PushNotification "https://github.com/L1A-crew/zzekak-api/tree/main/core/src/main/kotlin/com/zzekak/domain/push/"

    %% Styles
    classDef client fill:#gray,stroke:#333,stroke-width:2px
    classDef api fill:#3498db,stroke:#333,stroke-width:1px
    classDef core fill:#2ecc71,stroke:#333,stroke-width:1px
    classDef domain fill:#27ae60,stroke:#333,stroke-width:1px
    classDef infra fill:#e67e22,stroke:#333,stroke-width:1px
    classDef batch fill:#9b59b6,stroke:#333,stroke-width:1px
    classDef external fill:#95a5a6,stroke:#333,stroke-width:1px
    classDef database fill:#34495e,stroke:#333,stroke-width:1px
```
