# omnedia/ts-mono-repo architecture

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

- Interactive diagram: https://gitdiagram.com/omnedia/ts-mono-repo
- Repository: https://github.com/omnedia/ts-mono-repo

## Overview

This is a NestJS/Angular starter whose implemented product is session-based user authentication, with a generated API client and a small Angular shell. The principal workflow runs from the user’s auth screen through API calls to Nest auth routes, user operations, and database-backed persistence; session and CSRF handling support that workflow. The README also describes optional Redis sessions, Swagger, theme support, and view transitions. Some of those integrations are documented but their wiring is not shown in the excerpts, so those links are marked unverified or omitted.

Main entry points: [`backend/src/auth/auth.controller.ts`](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/auth.controller.ts) (Auth routes), [`backend/src/auth/user.service.ts`](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/user.service.ts) (User operations), [`frontend/src/app/stores/app.store.ts`](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/stores/app.store.ts) (App and theme state), [`backend/src/auth/auth.service.ts`](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/auth.service.ts) (Session and CSRF service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Angular application"]
  node_app["App shell<br/>[app.component.ts]"]
  node_routes["Route configuration<br/>[app.routes.ts]"]
  node_auth_ui["Auth screen<br/>[auth.component.ts]"]
  node_api_client["Generated API client"]
  node_api_providers["API providers<br/>[providers.ts]"]
  node_api_date["Date transformer"]
  node_api_params["HTTP params builder"]
  node_csrf_interceptor["CSRF interceptor"]
  node_auth_guard["Role guard<br/>[auth-role.guard.ts]"]
  node_routing["Routing service<br/>[routing.service.ts]"]
  node_app_store["App and theme state<br/>[app.store.ts]"]
  node_theme["Theme preset<br/>[custom.preset.ts]"]
  node_app_config["Router and app config<br/>[app.config.ts]"]
end

subgraph group_backend["NestJS API"]
  node_backend_app["Backend composition<br/>[app.module.ts]"]
  node_middleware["Session middleware"]
end

subgraph group_auth["Authentication"]
  node_auth_controller["Auth routes<br/>[auth.controller.ts]"]
  node_auth_service["Session and CSRF service<br/>[auth.service.ts]"]
  node_local_strategy["Local strategy<br/>[local.strategy.ts]"]
  node_user_service["User operations<br/>[user.service.ts]"]
  node_user_types["User and session types<br/>[user.types.ts]"]
end

subgraph group_persistence["Persistence and sessions"]
  node_prisma_service["Prisma database client<br/>[prisma.service.ts]"]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis session store")]
end

node_user(("User"))

node_user -->|"uses"| node_auth_ui
node_routes -->|"loads"| node_auth_ui
node_app -->|"checks current user"| node_api_client
node_auth_ui -->|"calls auth API"| node_api_client
node_api_providers -->|"configures"| node_api_date
node_api_client -.->|"uses"| node_api_providers
node_csrf_interceptor -.->|"sends CSRF token"| node_auth_service
node_auth_guard -->|"checks role state"| node_app_store
node_routing -->|"updates navigation state"| node_app_store
node_app -->|"reads user and loading"| node_app_store
node_app_store -.->|"supports theme"| node_theme
node_app_config -->|"configures theme"| node_theme
node_app_config -->|"registers"| node_csrf_interceptor
node_app_config -->|"registers routes"| node_routes
node_backend_app -->|"loads module"| node_auth_controller
node_backend_app -->|"loads module"| node_prisma_service
node_auth_controller -->|"calls"| node_auth_service
node_auth_controller -->|"calls"| node_user_service
node_auth_controller -.->|"guards login"| node_local_strategy
node_local_strategy -->|"validates credentials"| node_user_service
node_user_service -->|"queries users"| node_prisma_service
node_user_service -.->|"persists users"| node_postgres
node_auth_controller -->|"uses request types"| node_user_types
node_middleware -->|"configures middleware"| node_auth_service
node_auth_service -.->|"stores sessions"| node_redis

click node_app "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/app.component.ts"
click node_routes "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/app.routes.ts"
click node_auth_ui "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/auth/auth.component.ts"
click node_api_client "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/services/authentication.service.ts"
click node_api_providers "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/providers.ts"
click node_api_date "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/utils/date-transformer.ts"
click node_api_params "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/utils/http-params-builder.ts"
click node_csrf_interceptor "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/interceptors/csrf.interceptor.ts"
click node_auth_guard "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/guards/auth-role.guard.ts"
click node_routing "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/services/routing.service.ts"
click node_app_store "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/stores/app.store.ts"
click node_theme "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/theme/custom.preset.ts"
click node_app_config "https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/app.config.ts"
click node_backend_app "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/app.module.ts"
click node_auth_controller "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/auth.controller.ts"
click node_auth_service "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/auth.service.ts"
click node_local_strategy "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/strategies/local.strategy.ts"
click node_user_service "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/user.service.ts"
click node_user_types "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/types/user.types.ts"
click node_middleware "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/middleware.module.ts"
click node_prisma_service "https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/database/prisma.service.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_app,node_routes,node_auth_ui,node_api_client,node_api_providers,node_api_date,node_api_params,node_csrf_interceptor,node_auth_guard,node_routing,node_app_store,node_theme,node_app_config,node_user toneBlue
class node_backend_app,node_middleware toneAmber
class node_auth_controller,node_auth_service,node_local_strategy,node_user_service,node_user_types toneMint
class node_prisma_service,node_postgres,node_redis toneRose
```

## Components

### Angular application

- [App shell](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/app.component.ts): `frontend/src/app/app.component.ts`
- [Route configuration](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/app.routes.ts): `frontend/src/app/app.routes.ts`
- [Auth screen](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/auth/auth.component.ts): `frontend/src/app/auth/auth.component.ts`
- [Generated API client](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/services/authentication.service.ts): `frontend/src/app/api/services/authentication.service.ts`
- [API providers](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/providers.ts): `frontend/src/app/api/providers.ts`
- [Date transformer](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/utils/date-transformer.ts): `frontend/src/app/api/utils/date-transformer.ts`
- [HTTP params builder](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/api/utils/http-params-builder.ts): `frontend/src/app/api/utils/http-params-builder.ts`
- [CSRF interceptor](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/interceptors/csrf.interceptor.ts): `frontend/src/app/interceptors/csrf.interceptor.ts`
- [Role guard](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/guards/auth-role.guard.ts): `frontend/src/app/guards/auth-role.guard.ts`
- [Routing service](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/services/routing.service.ts): `frontend/src/app/services/routing.service.ts`
- [App and theme state](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/stores/app.store.ts): `frontend/src/app/stores/app.store.ts`
- [Theme preset](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/theme/custom.preset.ts): `frontend/src/theme/custom.preset.ts`
- [Router and app config](https://github.com/omnedia/ts-mono-repo/blob/master/frontend/src/app/app.config.ts): `frontend/src/app/app.config.ts`

### NestJS API

- [Backend composition](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/app.module.ts): `backend/src/app.module.ts`
- [Session middleware](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/middleware.module.ts): `backend/src/middleware.module.ts`

### Authentication

- [Auth routes](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Session and CSRF service](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [Local strategy](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/strategies/local.strategy.ts): `backend/src/auth/strategies/local.strategy.ts`
- [User operations](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/auth/user.service.ts): `backend/src/auth/user.service.ts`
- [User and session types](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/types/user.types.ts): `backend/src/types/user.types.ts`

### Persistence and sessions

- [Prisma database client](https://github.com/omnedia/ts-mono-repo/blob/master/backend/src/database/prisma.service.ts): `backend/src/database/prisma.service.ts`
- **PostgreSQL**
- **Redis session store**

### Other components

- **User**

## Connections

- User → Auth screen: uses (evidence: `README.md`)
- Route configuration → Auth screen: loads (evidence: `frontend/src/app/app.routes.ts`)
- App shell → Generated API client: checks current user (evidence: `frontend/src/app/app.component.ts`)
- Auth screen → Generated API client: calls auth API (evidence: `frontend/src/app/auth/auth.component.ts`)
- API providers → Date transformer: configures (evidence: `frontend/src/app/api/providers.ts`)
- Generated API client → API providers: uses
- CSRF interceptor → Session and CSRF service: sends CSRF token
- Role guard → App and theme state: checks role state (evidence: `frontend/src/app/guards/auth-role.guard.ts`)
- Routing service → App and theme state: updates navigation state (evidence: `frontend/src/app/services/routing.service.ts`)
- App shell → App and theme state: reads user and loading (evidence: `frontend/src/app/app.component.ts`)
- App and theme state → Theme preset: supports theme
- Router and app config → Theme preset: configures theme (evidence: `frontend/src/app/app.config.ts`)
- Router and app config → CSRF interceptor: registers (evidence: `frontend/src/app/app.config.ts`)
- Router and app config → Route configuration: registers routes (evidence: `frontend/src/app/app.config.ts`)
- Backend composition → Auth routes: loads module (evidence: `backend/src/app.module.ts`)
- Backend composition → Prisma database client: loads module (evidence: `backend/src/app.module.ts`)
- Auth routes → Session and CSRF service: calls (evidence: `backend/src/auth/auth.controller.ts`)
- Auth routes → User operations: calls (evidence: `backend/src/auth/auth.controller.ts`)
- Auth routes → Local strategy: guards login
- Local strategy → User operations: validates credentials (evidence: `backend/src/auth/strategies/local.strategy.ts`)
- User operations → Prisma database client: queries users (evidence: `backend/src/auth/user.service.ts`)
- User operations → PostgreSQL: persists users (evidence: `README.md`)
- Auth routes → User and session types: uses request types (evidence: `backend/src/auth/auth.controller.ts`)
- Session middleware → Session and CSRF service: configures middleware (evidence: `backend/src/middleware.module.ts`)
- Session and CSRF service → Redis session store: stores sessions (evidence: `README.md`)
