# v-checha/nestjs-template architecture

> Architecture diagram of the GitHub repository v-checha/nestjs-template, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/v-checha/nestjs-template
- Repository: https://github.com/v-checha/nestjs-template

## Overview

This repository is a NestJS backend template with a Refine/React admin panel. Its main workflow is a client request entering a controller, being dispatched through CQRS, and supporting identity, authorization, user/role management, or file operations. The README also documents email verification, password reset, i18n, and health monitoring. Paths and capabilities are grounded in the tree and README; because most handlers and integrations were not sampled, uncertain internal call wiring is intentionally omitted.

Main entry points: [`src/application`](https://github.com/v-checha/nestjs-template/tree/main/src/application) (Commands and queries), [`src/presentation/modules/storage/storage.controller.ts`](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/storage/storage.controller.ts) (Storage endpoints), [`src/core/services/storage.service.ts`](https://github.com/v-checha/nestjs-template/blob/main/src/core/services/storage.service.ts) (Storage service), [`src/infrastructure/storage/storage.module.ts`](https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/storage/storage.module.ts) (Provider selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and CQRS"]
  node_auth_api["Auth endpoints<br/>[auth.controller.ts]"]
  node_user_api["User endpoints<br/>[user.controller.ts]"]
  node_admin_api["Admin endpoints"]
  node_storage_api["Storage endpoints"]
  node_cqrs["Commands and queries"]
end

subgraph group_identity["Identity and Access"]
  node_auth_domain["Authentication services<br/>[auth.service.ts]"]
  node_user_domain["User services<br/>[user.service.ts]"]
  node_rbac["Roles and permissions<br/>[role.service.ts]"]
  node_auth_state[("Identity records")]
  node_email["Email delivery<br/>[email.provider.ts]"]
end

subgraph group_management["Admin Management"]
  node_admin_ui["Admin panel<br/>[App.tsx]"]
  node_admin_users["Admin user workflows"]
  node_admin_roles["Role workflows"]
end

subgraph group_storage["File Storage"]
  node_storage_service["Storage service<br/>[storage.service.ts]"]
  node_file_records[("File records<br/>[file.repository.ts]")]
  node_storage_config["Provider selection<br/>[storage.module.ts]"]
  node_minio["MinIO provider<br/>[minio.provider.ts]"]
  node_s3["AWS S3 provider<br/>[s3.provider.ts]"]
end

subgraph group_operations["Operations"]
  node_health["Health monitoring"]
  node_i18n["Internationalization<br/>[i18n.module.ts]"]
end

node_client(("API client"))
node_object_store[("Object storage")]

node_client -->|"requests identity"| node_auth_api
node_client -->|"requests profile"| node_user_api
node_client -->|"requests admin"| node_admin_api
node_client -->|"requests files"| node_storage_api
node_auth_api -->|"dispatches commands"| node_cqrs
node_user_api -->|"dispatches CQRS"| node_cqrs
node_admin_api -->|"dispatches CQRS"| node_cqrs
node_storage_api -->|"dispatches CQRS"| node_cqrs
node_admin_ui -->|"uses admin API"| node_admin_api
node_admin_users -.-> node_user_domain
node_admin_roles -.-> node_rbac
node_storage_api --> node_storage_service
node_storage_service -->|"reads and writes"| node_file_records
node_storage_service -->|"uses provider"| node_storage_config
node_storage_config -->|"selects MinIO"| node_minio
node_storage_config -.->|"selects S3"| node_s3
node_minio -->|"stores objects"| node_object_store
node_s3 -.->|"stores objects"| node_object_store
node_health -->|"dispatches queries"| node_cqrs

click node_auth_api "https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/auth/auth.controller.ts"
click node_user_api "https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/user/user.controller.ts"
click node_admin_api "https://github.com/v-checha/nestjs-template/tree/main/src/presentation/modules/admin"
click node_storage_api "https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/storage/storage.controller.ts"
click node_cqrs "https://github.com/v-checha/nestjs-template/tree/main/src/application"
click node_auth_domain "https://github.com/v-checha/nestjs-template/blob/main/src/core/services/auth.service.ts"
click node_user_domain "https://github.com/v-checha/nestjs-template/blob/main/src/core/services/user.service.ts"
click node_rbac "https://github.com/v-checha/nestjs-template/blob/main/src/core/services/role.service.ts"
click node_auth_state "https://github.com/v-checha/nestjs-template/tree/main/src/infrastructure/repositories"
click node_email "https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/auth/providers/email.provider.ts"
click node_admin_ui "https://github.com/v-checha/nestjs-template/blob/main/admin/src/App.tsx"
click node_admin_users "https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/admin/admin-user.controller.ts"
click node_admin_roles "https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/admin/admin-role.controller.ts"
click node_health "https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/health/health.controller.ts"
click node_i18n "https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/i18n/i18n.module.ts"
click node_storage_service "https://github.com/v-checha/nestjs-template/blob/main/src/core/services/storage.service.ts"
click node_file_records "https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/repositories/file.repository.ts"
click node_storage_config "https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/storage/storage.module.ts"
click node_minio "https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/storage/providers/minio.provider.ts"
click node_s3 "https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/storage/providers/s3.provider.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_api,node_user_api,node_admin_api,node_storage_api,node_cqrs,node_client toneBlue
class node_auth_domain,node_user_domain,node_rbac,node_auth_state,node_email,node_object_store toneAmber
class node_admin_ui,node_admin_users,node_admin_roles toneMint
class node_storage_service,node_file_records,node_storage_config,node_minio,node_s3 toneRose
class node_health,node_i18n toneIndigo
```

## Components

### API and CQRS

- [Auth endpoints](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/auth/auth.controller.ts): `src/presentation/modules/auth/auth.controller.ts`
- [User endpoints](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/user/user.controller.ts): `src/presentation/modules/user/user.controller.ts`
- [Admin endpoints](https://github.com/v-checha/nestjs-template/tree/main/src/presentation/modules/admin): `src/presentation/modules/admin`
- [Storage endpoints](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/storage/storage.controller.ts): `src/presentation/modules/storage/storage.controller.ts`
- [Commands and queries](https://github.com/v-checha/nestjs-template/tree/main/src/application): `src/application`

### Identity and Access

- [Authentication services](https://github.com/v-checha/nestjs-template/blob/main/src/core/services/auth.service.ts): `src/core/services/auth.service.ts`
- [User services](https://github.com/v-checha/nestjs-template/blob/main/src/core/services/user.service.ts): `src/core/services/user.service.ts`
- [Roles and permissions](https://github.com/v-checha/nestjs-template/blob/main/src/core/services/role.service.ts): `src/core/services/role.service.ts`
- [Identity records](https://github.com/v-checha/nestjs-template/tree/main/src/infrastructure/repositories): `src/infrastructure/repositories`
- [Email delivery](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/auth/providers/email.provider.ts): `src/presentation/modules/auth/providers/email.provider.ts`

### Admin Management

- [Admin panel](https://github.com/v-checha/nestjs-template/blob/main/admin/src/App.tsx): `admin/src/App.tsx`
- [Admin user workflows](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/admin/admin-user.controller.ts): `src/presentation/modules/admin/admin-user.controller.ts`
- [Role workflows](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/admin/admin-role.controller.ts): `src/presentation/modules/admin/admin-role.controller.ts`

### File Storage

- [Storage service](https://github.com/v-checha/nestjs-template/blob/main/src/core/services/storage.service.ts): `src/core/services/storage.service.ts`
- [File records](https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/repositories/file.repository.ts): `src/infrastructure/repositories/file.repository.ts`
- [Provider selection](https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/storage/storage.module.ts): `src/infrastructure/storage/storage.module.ts`
- [MinIO provider](https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/storage/providers/minio.provider.ts): `src/infrastructure/storage/providers/minio.provider.ts`
- [AWS S3 provider](https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/storage/providers/s3.provider.ts): `src/infrastructure/storage/providers/s3.provider.ts`

### Operations

- [Health monitoring](https://github.com/v-checha/nestjs-template/blob/main/src/presentation/modules/health/health.controller.ts): `src/presentation/modules/health/health.controller.ts`
- [Internationalization](https://github.com/v-checha/nestjs-template/blob/main/src/infrastructure/i18n/i18n.module.ts): `src/infrastructure/i18n/i18n.module.ts`

### Other components

- **API client**
- **Object storage**

## Connections

- API client → Auth endpoints: requests identity
- API client → User endpoints: requests profile
- API client → Admin endpoints: requests admin
- API client → Storage endpoints: requests files
- Auth endpoints → Commands and queries: dispatches commands
- User endpoints → Commands and queries: dispatches CQRS
- Admin endpoints → Commands and queries: dispatches CQRS
- Storage endpoints → Commands and queries: dispatches CQRS
- Admin panel → Admin endpoints: uses admin API
- Admin user workflows → User services
- Role workflows → Roles and permissions
- Storage endpoints → Storage service
- Storage service → File records: reads and writes
- Storage service → Provider selection: uses provider
- Provider selection → MinIO provider: selects MinIO
- Provider selection → AWS S3 provider: selects S3
- MinIO provider → Object storage: stores objects
- AWS S3 provider → Object storage: stores objects
- Health monitoring → Commands and queries: dispatches queries
