# linkt-dev/linkt-server architecture

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

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

## Overview

##### Main System Components

a) Core Application Layer:
- App Module as the root module
- Following feature modules:
- Auth Module
- Member Module
- Content Module
- Health Check Module

b) Infrastructure Layer:
- Database layer (TypeORM configuration indicates database usage)
- JWT Authentication infrastructure
- Configuration management

##### Module-Level Details

For each module, represent:

a) Auth Module:
- AuthController
- AuthService
- JWT Strategies (Access & Refresh)
- DTOs for login requests/responses

b) Member Module:
- MemberController
- MemberService
- Member Entity
- Related DTOs

c) Content Module:
- ContentController
- ContentService
- Content Entity
- Related DTOs

**┌─────────────────────────────────────────────┐**
- Client Layer                 │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- API Gateway Layer              │
- (Controllers with endpoints and guards)    │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Application Layer               │
- (Services with business logic)           │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Data Access Layer              │
- (TypeORM Entities and Repositories)      │
- ┘

##### Additional Details

Elements:
- Health check endpoint for monitoring
- JWT authentication flow
- TypeORM configuration
- Request/Response flow through the application

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        CL[Client Applications]
    end

    subgraph API_Gateway
        AC["Auth Controller"]:::controller
        MC["Member Controller"]:::controller
        CC["Content Controller"]:::controller
        HC["Health Check Controller"]:::controller
    end

    subgraph Application_Layer
        AM["Auth Module"]:::module
        MM["Member Module"]:::module
        CM["Content Module"]:::module
        HM["Health Check Module"]:::module
        
        AS["Auth Service"]:::service
        MS["Member Service"]:::service
        CS["Content Service"]:::service
        
        JWTAccess["JWT Access Strategy"]:::auth
        JWTRefresh["JWT Refresh Strategy"]:::auth
    end

    subgraph Data_Layer
        ME["Member Entity"]:::entity
        CE["Content Entity"]:::entity
        DB[(Database)]:::database
    end

    subgraph DTOs
        LoginReq["Login Request DTO"]:::dto
        LoginRes["Login Response DTO"]:::dto
        MemberCreateReq["Member Create Request DTO"]:::dto
        MemberRes["Member Response DTO"]:::dto
        ContentCreateReq["Content Create Request DTO"]:::dto
        ContentUpdateReq["Content Update Request DTO"]:::dto
        ContentRes["Content Response DTO"]:::dto
        CommonRes["Common Response DTO"]:::dto
    end

    %% Relationships
    CL --> AC & MC & CC & HC
    
    AC --> AS
    MC --> MS
    CC --> CS
    
    AS --> JWTAccess & JWTRefresh
    MS --> ME
    CS --> CE
    
    ME --> DB
    CE --> DB
    
    AS --> LoginReq & LoginRes
    MS --> MemberCreateReq & MemberRes
    CS --> ContentCreateReq & ContentUpdateReq & ContentRes
    
    %% Click Events
    click AC "https://github.com/linkt-dev/linkt-server/blob/main/src/auth/auth.controller.ts"
    click MC "https://github.com/linkt-dev/linkt-server/blob/main/src/member/member.controller.ts"
    click CC "https://github.com/linkt-dev/linkt-server/blob/main/src/content/content.controller.ts"
    click HC "https://github.com/linkt-dev/linkt-server/blob/main/src/health-check/health-check.controller.ts"
    
    click AM "https://github.com/linkt-dev/linkt-server/blob/main/src/auth/auth.module.ts"
    click MM "https://github.com/linkt-dev/linkt-server/blob/main/src/member/member.module.ts"
    click CM "https://github.com/linkt-dev/linkt-server/blob/main/src/content/content.module.ts"
    click HM "https://github.com/linkt-dev/linkt-server/blob/main/src/health-check/health-check.module.ts"
    
    click AS "https://github.com/linkt-dev/linkt-server/blob/main/src/auth/auth.service.ts"
    click MS "https://github.com/linkt-dev/linkt-server/blob/main/src/member/member.service.ts"
    click CS "https://github.com/linkt-dev/linkt-server/blob/main/src/content/content.service.ts"
    
    click JWTAccess "https://github.com/linkt-dev/linkt-server/blob/main/src/auth/jwt-access.strategy.ts"
    click JWTRefresh "https://github.com/linkt-dev/linkt-server/blob/main/src/auth/jwt-refresh.strategy.ts"
    
    click ME "https://github.com/linkt-dev/linkt-server/blob/main/src/member/member.entity.ts"
    click CE "https://github.com/linkt-dev/linkt-server/blob/main/src/content/content.entity.ts"
    
    click LoginReq "https://github.com/linkt-dev/linkt-server/blob/main/src/auth/dto/login-request.dto.ts"
    click LoginRes "https://github.com/linkt-dev/linkt-server/blob/main/src/auth/dto/login-response.dto.ts"
    click MemberCreateReq "https://github.com/linkt-dev/linkt-server/blob/main/src/member/dto/member-create-request.dto.ts"
    click MemberRes "https://github.com/linkt-dev/linkt-server/blob/main/src/member/dto/member-response.dto.ts"
    click ContentCreateReq "https://github.com/linkt-dev/linkt-server/blob/main/src/content/dto/content-create-request.dto.ts"
    click ContentUpdateReq "https://github.com/linkt-dev/linkt-server/blob/main/src/content/dto/content-update-request.dto.ts"
    click ContentRes "https://github.com/linkt-dev/linkt-server/blob/main/src/content/dto/content-response.dto.ts"
    click CommonRes "https://github.com/linkt-dev/linkt-server/blob/main/src/common/common-response.dto.ts"

    %% Styling
    classDef module fill:#2196F3,stroke:#1565C0,color:white
    classDef controller fill:#4CAF50,stroke:#2E7D32,color:white
    classDef service fill:#FFC107,stroke:#FFA000,color:black
    classDef entity fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef dto fill:#FF9800,stroke:#F57C00,color:white
    classDef auth fill:#F44336,stroke:#D32F2F,color:white
    classDef database fill:#607D8B,stroke:#455A64,color:white
```
