# bursuc31/nestjs-task-svc architecture

> Architecture diagram of the GitHub repository bursuc31/nestjs-task-svc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bursuc31/nestjs-task-svc
- Repository: https://github.com/bursuc31/nestjs-task-svc

## Overview

##### Main System Components

a) API Layer
- NestJS application as the main container
- Two main modules: Auth Module and Tasks Module
- Controllers (auth.controller.ts and tasks.controller.ts) as entry points

b) Service Layer
- AuthService and TasksService as business logic handlers
- JWT Strategy implementation for authentication
- Custom guards and decorators

c) Data Layer
- Repositories (UserRepository and TaskRepository)
- Entity definitions (User and Task entities)
- TypeORM configuration

d) Infrastructure
- Docker container
- AWS Elastic Beanstalk deployment
- Database connection (likely PostgreSQL based on TypeORM usage)

##### Component Relationships

- Client requests → Controllers
- Controllers → Services
- Services → Repositories
- Repositories → Database
- Auth flow through JWT Strategy

##### Specific Implementation Details

- Blue rectangles for Controllers
- Green rectangles for Services
- Yellow diamonds for DTOs
- Purple rectangles for Entities
- Red hexagons for Guards/Middleware

##### Architectural Patterns

Following patterns:
- Module-based architecture (NestJS standard)
- Repository pattern for data access
- DTO pattern for data transfer
- Guard pattern for authentication
- Dependency injection system

**[Client Layer]**
- ↓
**[API Layer (Controllers)]**
- ↓
**[Auth Guard/Middleware]**
- ↓
**[Service Layer]**
- ↓
**[Repository Layer]**
- ↓
**[Database Layer]**

##### Additional Elements

- Configuration management (config folder structure)
- Environment-specific settings
- Testing setup (E2E and unit tests)
- Docker containerization flow
- AWS deployment pipeline

##### Technical Stack Indicators

- NestJS framework
- TypeScript
- TypeORM
- JWT authentication
- Docker
- AWS Elastic Beanstalk
- PostgreSQL

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CL[Client Application]
    end

    subgraph "API Layer"
        AC["Auth Controller"]:::controller
        TC["Tasks Controller"]:::controller
    end

    subgraph "Auth Module"
        AS["Auth Service"]:::service
        JWS["JWT Strategy"]:::service
        AG["Auth Guard"]:::guard
    end

    subgraph "Tasks Module"
        TS["Tasks Service"]:::service
        TSV["Task Status Validator"]:::service
    end

    subgraph "DTOs"
        AuthDTO["Auth Credentials DTO"]:::dto
        CreateTaskDTO["Create Task DTO"]:::dto
        FilterTaskDTO["Filter Tasks DTO"]:::dto
    end

    subgraph "Data Layer"
        UR["User Repository"]:::repository
        TR["Task Repository"]:::repository
        UE["User Entity"]:::entity
        TE["Task Entity"]:::entity
    end

    subgraph "Infrastructure"
        DB[(PostgreSQL)]:::database
        Docker["Docker Container"]:::infra
        AWS["AWS Elastic Beanstalk"]:::infra
    end

    CL --> AC & TC
    AC --> AS
    TC --> TS
    AS --> JWS
    AS --> UR
    TS --> TR
    TC --> TSV
    UR --> UE
    TR --> TE
    UE & TE --> DB
    AG --> AC & TC

    classDef controller fill:#3498db,stroke:#2980b9,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef dto fill:#f1c40f,stroke:#f39c12,color:black
    classDef entity fill:#9b59b6,stroke:#8e44ad,color:white
    classDef guard fill:#e74c3c,stroke:#c0392b,color:white
    classDef repository fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef database fill:#34495e,stroke:#2c3e50,color:white
    classDef infra fill:#1abc9c,stroke:#16a085,color:white

    click AC "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/auth/auth.controller.ts"
    click TC "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/tasks/tasks.controller.ts"
    click AS "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/auth/auth.service.ts"
    click TS "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/tasks/tasks.service.ts"
    click JWS "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/auth/jwt.strategy.ts"
    click AG "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/auth/custom-guard.ts"
    click TSV "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/tasks/pipes/task-status-validation.pipe.ts"
    click AuthDTO "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/auth/dto/auth-credentials.dto.ts"
    click CreateTaskDTO "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/tasks/dto/create-task.dto.ts"
    click FilterTaskDTO "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/tasks/dto/get-tasks-filter.dto.ts"
    click UR "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/auth/user.repository.ts"
    click TR "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/tasks/task.repository.ts"
    click UE "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/auth/user.entity.ts"
    click TE "https://github.com/BURSUC31/nestJS-task-svc/blob/main/src/tasks/task.entity.ts"
    click Docker "https://github.com/BURSUC31/nestJS-task-svc/tree/main/Dockerfile"
    click AWS "https://github.com/BURSUC31/nestJS-task-svc/blob/main/main.tf"
```
