# espisebas/taskmanager architecture

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

- Interactive diagram: https://gitdiagram.com/espisebas/taskmanager
- Repository: https://github.com/espisebas/taskmanager

## Overview

##### Project type and purpose
- This is a backend monolithic REST API built with NestJS (a Node.js/TypeScript framework).
- Purpose: provide endpoints for user management, authentication (JWT-based), project management, and a task-manager module.

##### File structure
- src/app.module.ts and src/main.ts bootstrap a single NestJS application.
- Top-level modules:
- auth/ (login, register, JWT constants, AuthGuard, RolesGuard, decorators)
- users/ (CRUD endpoints, User entity)
- project/ (CRUD endpoints, Project entity)
- task-manager/ (CRUD endpoints, TaskManager entity, states enum)
- Each module follows the standard controller → service → entity/DTO layering (typical MVC-style).
- Entities (project.entity.ts, task-manager.entity.ts, user.entity.ts) imply an ORM (e.g., TypeORM) talking to a relational database.
- Guards & decorators enforce security and role-based access.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    Client["Client<br/>(Web/Mobile)"]:::client

    %% NestJS Application Boundary
    subgraph "NestJS Application" 
        direction TB
        %% Bootstrap
        Main["main.ts"]:::bootstrap
        AppModule["app.module.ts"]:::bootstrap

        %% Auth Module
        subgraph "Auth Module (src/auth)" 
            direction TB
            AuthController["AuthController"]:::controller
            AuthService["AuthService"]:::service
            AuthGuard["AuthGuard"]:::guard
            RolesGuard["RolesGuard"]:::guard
            JWTConsts["jwt.constants.ts"]:::config
            RolesDecorator["roles.decorator.ts"]:::decorator
            LoginDTO["login.dto.ts"]:::dto
            RegisterDTO["register.dto.ts"]:::dto
        end

        %% Users Module
        subgraph "Users Module (src/users)" 
            direction TB
            UsersController["UsersController"]:::controller
            UsersService["UsersService"]:::service
            CreateUserDTO["create-user.dto.ts"]:::dto
            UpdateUserDTO["update-user.dto.ts"]:::dto
            UserEntity["user.entity.ts"]:::entity
        end

        %% Project Module
        subgraph "Project Module (src/project)" 
            direction TB
            ProjectController["ProjectController"]:::controller
            ProjectService["ProjectService"]:::service
            CreateProjectDTO["create-project.dto.ts"]:::dto
            UpdateProjectDTO["update-project.dto.ts"]:::dto
            ProjectEntity["project.entity.ts"]:::entity
        end

        %% Task-Manager Module
        subgraph "Task-Manager Module (src/task-manager)" 
            direction TB
            TaskController["TaskManagerController"]:::controller
            TaskService["TaskManagerService"]:::service
            CreateTaskDTO["create-task-manager.dto.ts"]:::dto
            UpdateTaskDTO["update-task-manager.dto.ts"]:::dto
            TaskEntity["task-manager.entity.ts"]:::entity
            StatesEnum["states.enum.ts"]:::enum
        end
    end

    %% Database
    Database["Relational Database"]:::db

    %% Interactions
    Client -->|"HTTP request"| AuthController
    Client -->|"HTTP request"| UsersController
    Client -->|"HTTP request"| ProjectController
    Client -->|"HTTP request"| TaskController

    AuthController -->|"calls"| AuthService
    UsersController -->|"calls"| UsersService
    ProjectController -->|"calls"| ProjectService
    TaskController -->|"calls"| TaskService

    AuthGuard -.->|"intercepts"| AuthController
    RolesGuard -.->|"intercepts"| AuthController
    AuthGuard -->|"validates JWT"| AuthService

    AuthService -->|"uses"| JWTConsts
    AuthService -->|"CRUD via ORM"| Database
    UsersService -->|"CRUD via ORM"| Database
    ProjectService -->|"CRUD via ORM"| Database
    TaskService -->|"CRUD via ORM"| Database

    %% Click Events
    click Main "https://github.com/espisebas/taskmanager/blob/main/src/main.ts"
    click AppModule "https://github.com/espisebas/taskmanager/blob/main/src/app.module.ts"
    click AuthController "https://github.com/espisebas/taskmanager/blob/main/src/auth/auth.controller.ts"
    click AuthService "https://github.com/espisebas/taskmanager/blob/main/src/auth/auth.service.ts"
    click AuthGuard "https://github.com/espisebas/taskmanager/blob/main/src/auth/auth.guard.ts"
    click RolesGuard "https://github.com/espisebas/taskmanager/blob/main/src/auth/roles.guard.ts"
    click JWTConsts "https://github.com/espisebas/taskmanager/blob/main/src/auth/constants/jwt.constants.ts"
    click RolesDecorator "https://github.com/espisebas/taskmanager/blob/main/src/auth/decorator/roles.decorator.ts"
    click LoginDTO "https://github.com/espisebas/taskmanager/blob/main/src/auth/dto/login.dto.ts"
    click RegisterDTO "https://github.com/espisebas/taskmanager/blob/main/src/auth/dto/register.dto.ts"
    click UsersController "https://github.com/espisebas/taskmanager/blob/main/src/users/users.controller.ts"
    click UsersService "https://github.com/espisebas/taskmanager/blob/main/src/users/users.service.ts"
    click CreateUserDTO "https://github.com/espisebas/taskmanager/blob/main/src/users/dto/create-user.dto.ts"
    click UpdateUserDTO "https://github.com/espisebas/taskmanager/blob/main/src/users/dto/update-user.dto.ts"
    click UserEntity "https://github.com/espisebas/taskmanager/blob/main/src/users/entities/user.entity.ts"
    click ProjectController "https://github.com/espisebas/taskmanager/blob/main/src/project/project.controller.ts"
    click ProjectService "https://github.com/espisebas/taskmanager/blob/main/src/project/project.service.ts"
    click CreateProjectDTO "https://github.com/espisebas/taskmanager/blob/main/src/project/dto/create-project.dto.ts"
    click UpdateProjectDTO "https://github.com/espisebas/taskmanager/blob/main/src/project/dto/update-project.dto.ts"
    click ProjectEntity "https://github.com/espisebas/taskmanager/blob/main/src/project/entities/project.entity.ts"
    click TaskController "https://github.com/espisebas/taskmanager/blob/main/src/task-manager/task-manager.controller.ts"
    click TaskService "https://github.com/espisebas/taskmanager/blob/main/src/task-manager/task-manager.service.ts"
    click CreateTaskDTO "https://github.com/espisebas/taskmanager/blob/main/src/task-manager/dto/create-task-manager.dto.ts"
    click UpdateTaskDTO "https://github.com/espisebas/taskmanager/blob/main/src/task-manager/dto/update-task-manager.dto.ts"
    click TaskEntity "https://github.com/espisebas/taskmanager/blob/main/src/task-manager/entities/task-manager.entity.ts"
    click StatesEnum "https://github.com/espisebas/taskmanager/blob/main/src/task-manager/entities/states.enum.ts"

    %% Styles
    classDef client fill:#E5F6FF,stroke:#0366D6,color:#0366D6;
    classDef app fill:#F0F4C3,stroke:#8BC34A,color:#33691E;
    classDef module fill:#FFF9C4,stroke:#F9A825,color:#F57F17;
    classDef controller fill:#E1F5FE,stroke:#0288D1,color:#01579B;
    classDef service fill:#E8F5E9,stroke:#43A047,color:#1B5E20;
    classDef guard fill:#FFEBEE,stroke:#E53935,color:#B71C1C;
    classDef decorator fill:#F3E5F5,stroke:#8E24AA,color:#4A148C;
    classDef config fill:#ECEFF1,stroke:#607D8B,color:#263238;
    classDef dto fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
    classDef entity fill:#E0F7FA,stroke:#00ACC1,color:#006064;
    classDef enum fill:#EDE7F6,stroke:#5E35B1,color:#311B92;
    classDef db fill:#D1C4E9,stroke:#673AB7,color:#311B92;
    classDef bootstrap fill:#CFD8DC,stroke:#455A64,color:#263238;
```
