# armandwipangestu/nestjs-boilerplate architecture

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

- Interactive diagram: https://gitdiagram.com/armandwipangestu/nestjs-boilerplate
- Repository: https://github.com/armandwipangestu/nestjs-boilerplate

## Overview

This is a production-oriented NestJS API boilerplate. Its main request workflow is HTTP endpoints through authentication/authorization where required, into domain services and repositories, then Prisma-backed persistence; user avatar uploads additionally use configurable storage. The graph also preserves the documented caching, rate limiting, health, logging, and observability capabilities. Some modules were not excerpted, so those capability links are documented at subsystem level and are not expanded into unverified call chains.

Main entry points: [`src/main.ts`](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/main.ts) (Application bootstrap), [`src/prisma/prisma.service.ts`](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/prisma/prisma.service.ts) (Prisma database access), [`src/user/user.service.ts`](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/user/user.service.ts) (User service), [`src/auth/auth.service.ts`](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/auth.service.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_bootstrap["Application bootstrap<br/>[main.ts]"]
  node_app_api["Root endpoint<br/>[app.controller.ts]"]
end

subgraph group_identity["Identity and access"]
  node_auth_api["Auth endpoints<br/>[auth.controller.ts]"]
  node_auth_logic["Authentication<br/>[auth.service.ts]"]
  node_auth_data["Auth repository<br/>[auth.repository.ts]"]
  node_access_control["JWT and ACL<br/>[acl.guard.ts]"]
end

subgraph group_domains["Domain services"]
  node_post_api["Post endpoints<br/>[post.controller.ts]"]
  node_post_logic["Post service<br/>[post.service.ts]"]
  node_post_data["Post repository<br/>[post.repository.ts]"]
  node_user_api["User endpoints<br/>[user.controller.ts]"]
  node_user_logic["User service<br/>[user.service.ts]"]
  node_user_data["User repository<br/>[user.repository.ts]"]
end

subgraph group_platform["Data and infrastructure"]
  node_storage["File storage<br/>[storage.service.ts]"]
  node_storage_backends["Local and S3 providers"]
  node_database[("Prisma database access<br/>[prisma.service.ts]")]
  node_cache["Cache subsystem"]
  node_redis["Redis integration<br/>[redis.module.ts]"]
  node_configuration["Application configuration<br/>[app.config.ts]"]
end

subgraph group_operations["Operations and observability"]
  node_logger["Structured logger<br/>[logger.service.ts]"]
  node_metrics["Metrics and tracing<br/>[metrics.service.ts]"]
  node_health["Health checks"]
  node_throttling["Rate limiting"]
end

node_client(("API client"))
node_ops_stack["Telemetry and monitoring"]

node_client -->|"sends requests"| node_bootstrap
node_bootstrap -->|"routes requests"| node_auth_api
node_bootstrap -->|"routes requests"| node_post_api
node_bootstrap -->|"routes requests"| node_user_api
node_client -->|"requests root"| node_app_api
node_app_api -.->|"uses app service"| node_bootstrap
node_auth_api -->|"calls"| node_auth_logic
node_auth_logic -->|"queries"| node_auth_data
node_post_api -->|"calls"| node_post_logic
node_post_api -->|"guards routes"| node_access_control
node_post_logic -->|"queries"| node_post_data
node_post_logic -->|"uses cache"| node_cache
node_user_api -->|"calls"| node_user_logic
node_user_api -->|"guards routes"| node_access_control
node_user_logic -->|"queries"| node_user_data
node_user_logic -->|"uploads avatars"| node_storage
node_user_logic -->|"uses cache"| node_cache
node_storage -->|"selects provider"| node_storage_backends
node_auth_data -->|"uses Prisma"| node_database
node_user_data -->|"uses Prisma"| node_database
node_post_data -.->|"uses Prisma"| node_database
node_database -->|"records query metrics"| node_metrics
node_database -->|"logs query events"| node_logger
node_auth_logic -->|"logs auth events"| node_logger
node_configuration -->|"selects backend"| node_storage
node_redis -->|"backs rate limits"| node_throttling
node_bootstrap -->|"loads settings"| node_configuration
node_client -.->|"checks health"| node_health
node_client -.->|"scrapes metrics"| node_metrics
node_metrics -.->|"exports telemetry"| node_ops_stack
node_logger -.->|"supports log correlation"| node_ops_stack

click node_bootstrap "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/main.ts"
click node_app_api "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/app.controller.ts"
click node_auth_api "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/auth.controller.ts"
click node_auth_logic "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/auth.service.ts"
click node_auth_data "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/auth.repository.ts"
click node_access_control "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/guards/acl.guard.ts"
click node_post_api "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/post/post.controller.ts"
click node_post_logic "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/post/post.service.ts"
click node_post_data "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/post/post.repository.ts"
click node_user_api "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/user/user.controller.ts"
click node_user_logic "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/user/user.service.ts"
click node_user_data "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/user/user.repository.ts"
click node_storage "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/storage/storage.service.ts"
click node_storage_backends "https://github.com/armandwipangestu/nestjs-boilerplate/tree/main/src/common/storage/strategies"
click node_database "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/prisma/prisma.service.ts"
click node_cache "https://github.com/armandwipangestu/nestjs-boilerplate/tree/main/src/common/cache"
click node_redis "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/redis/redis.module.ts"
click node_configuration "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/config/app.config.ts"
click node_logger "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/logger/logger.service.ts"
click node_metrics "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/observability/metrics.service.ts"
click node_health "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/health/health.controller.ts"
click node_throttling "https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/throttler/hybrid-throttler-storage.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_bootstrap,node_app_api,node_client toneBlue
class node_auth_api,node_auth_logic,node_auth_data,node_access_control toneAmber
class node_post_api,node_post_logic,node_post_data,node_user_api,node_user_logic,node_user_data toneMint
class node_storage,node_storage_backends,node_database,node_cache,node_redis,node_configuration toneRose
class node_logger,node_metrics,node_health,node_throttling,node_ops_stack toneIndigo
```

## Components

### API entry

- [Application bootstrap](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/main.ts): `src/main.ts`
- [Root endpoint](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/app.controller.ts): `src/app.controller.ts`

### Identity and access

- [Auth endpoints](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Authentication](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [Auth repository](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/auth.repository.ts): `src/auth/auth.repository.ts`
- [JWT and ACL](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/auth/guards/acl.guard.ts): `src/auth/guards/acl.guard.ts`

### Domain services

- [Post endpoints](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/post/post.controller.ts): `src/post/post.controller.ts`
- [Post service](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/post/post.service.ts): `src/post/post.service.ts`
- [Post repository](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/post/post.repository.ts): `src/post/post.repository.ts`
- [User endpoints](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/user/user.controller.ts): `src/user/user.controller.ts`
- [User service](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/user/user.service.ts): `src/user/user.service.ts`
- [User repository](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/user/user.repository.ts): `src/user/user.repository.ts`

### Data and infrastructure

- [File storage](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/storage/storage.service.ts): `src/common/storage/storage.service.ts`
- [Local and S3 providers](https://github.com/armandwipangestu/nestjs-boilerplate/tree/main/src/common/storage/strategies): `src/common/storage/strategies`
- [Prisma database access](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/prisma/prisma.service.ts): `src/prisma/prisma.service.ts`
- [Cache subsystem](https://github.com/armandwipangestu/nestjs-boilerplate/tree/main/src/common/cache): `src/common/cache`
- [Redis integration](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/redis/redis.module.ts): `src/common/redis/redis.module.ts`
- [Application configuration](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/config/app.config.ts): `src/config/app.config.ts`

### Operations and observability

- [Structured logger](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/logger/logger.service.ts): `src/common/logger/logger.service.ts`
- [Metrics and tracing](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/observability/metrics.service.ts): `src/common/observability/metrics.service.ts`
- [Health checks](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/health/health.controller.ts): `src/common/health/health.controller.ts`
- [Rate limiting](https://github.com/armandwipangestu/nestjs-boilerplate/blob/main/src/common/throttler/hybrid-throttler-storage.ts): `src/common/throttler/hybrid-throttler-storage.ts`

### Other components

- **API client**
- **Telemetry and monitoring**

## Connections

- API client → Application bootstrap: sends requests (evidence: `README.md`)
- Application bootstrap → Auth endpoints: routes requests
- Application bootstrap → Post endpoints: routes requests
- Application bootstrap → User endpoints: routes requests
- API client → Root endpoint: requests root (evidence: `src/app.controller.ts`)
- Root endpoint → Application bootstrap: uses app service
- Auth endpoints → Authentication: calls (evidence: `src/auth/auth.controller.ts`)
- Authentication → Auth repository: queries (evidence: `src/auth/auth.service.ts`)
- Post endpoints → Post service: calls (evidence: `src/post/post.controller.ts`)
- Post endpoints → JWT and ACL: guards routes (evidence: `src/post/post.controller.ts`)
- Post service → Post repository: queries (evidence: `src/post/post.service.ts`)
- Post service → Cache subsystem: uses cache (evidence: `src/post/post.service.ts`)
- User endpoints → User service: calls (evidence: `src/user/user.controller.ts`)
- User endpoints → JWT and ACL: guards routes (evidence: `src/user/user.controller.ts`)
- User service → User repository: queries (evidence: `src/user/user.service.ts`)
- User service → File storage: uploads avatars (evidence: `src/user/user.service.ts`)
- User service → Cache subsystem: uses cache (evidence: `src/user/user.service.ts`)
- File storage → Local and S3 providers: selects provider (evidence: `src/common/storage/storage.service.ts`)
- Auth repository → Prisma database access: uses Prisma (evidence: `src/auth/auth.repository.ts`)
- User repository → Prisma database access: uses Prisma (evidence: `src/user/user.repository.ts`)
- Post repository → Prisma database access: uses Prisma
- Prisma database access → Metrics and tracing: records query metrics (evidence: `src/prisma/prisma.service.ts`)
- Prisma database access → Structured logger: logs query events (evidence: `src/prisma/prisma.service.ts`)
- Authentication → Structured logger: logs auth events (evidence: `src/auth/auth.service.ts`)
- Application configuration → File storage: selects backend (evidence: `src/common/storage/storage.service.ts`)
- Redis integration → Rate limiting: backs rate limits (evidence: `src/common/throttler/hybrid-throttler-storage.ts`)
- Application bootstrap → Application configuration: loads settings
- API client → Health checks: checks health (evidence: `README.md`)
- API client → Metrics and tracing: scrapes metrics (evidence: `README.md`)
- Metrics and tracing → Telemetry and monitoring: exports telemetry (evidence: `README.md`)
- Structured logger → Telemetry and monitoring: supports log correlation (evidence: `README.md`)
