# samchon/nestia architecture

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

- Interactive diagram: https://gitdiagram.com/samchon/nestia
- Repository: https://github.com/samchon/nestia

## Overview

Nestia provides typed NestJS server decorators and tooling that reflects controllers into client SDKs, Swagger documents, simulators, and generated E2E functions. The graph also captures migration, client fetching, and the online editor as distinct product capabilities. Source excerpts show selected validation, reflection, migration, and editor links; README-documented capabilities fill in unsampled product branches, so those broader links are cited to README.md.

Main entry points: [`packages/sdk/src/analyses/ReflectControllerAnalyzer.ts`](https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectControllerAnalyzer.ts) (Controller reflection), [`packages/sdk/src/generates/SdkGenerator.ts`](https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/SdkGenerator.ts) (Client SDK generation), [`packages/sdk/src/executable/sdk.ts`](https://github.com/samchon/nestia/blob/master/packages/sdk/src/executable/sdk.ts) (SDK command), [`packages/editor/src/NestiaEditorApplication.tsx`](https://github.com/samchon/nestia/blob/master/packages/editor/src/NestiaEditorApplication.tsx) (Online editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Typed server"]
  node_typed_routes["Typed routes<br/>[TypedRoute.ts]"]
  node_typed_query["Typed query<br/>[TypedQuery.ts]"]
  node_query_validation["Query validation"]
  node_websocket["WebSocket routes<br/>[WebSocketRoute.ts]"]
  node_encryption["Encrypted controllers"]
end

subgraph group_generation["API generation"]
  node_sdk_cli["SDK command<br/>[sdk.ts]"]
  node_reflection["Controller reflection"]
  node_http_analysis["HTTP analysis"]
  node_mcp_analysis["MCP analysis"]
  node_ws_analysis["WebSocket analysis"]
  node_sdk_generation["Client SDK generation<br/>[SdkGenerator.ts]"]
  node_swagger["Swagger generation"]
  node_simulator["Mock simulator"]
  node_e2e["E2E generation<br/>[E2eGenerator.ts]"]
end

subgraph group_client["Client runtime"]
  node_fetcher["Typed fetcher<br/>[PlainFetcher.ts]"]
  node_encrypted_fetcher["Encrypted fetcher"]
end

subgraph group_migration["Migration"]
  node_migration_app["Migration command"]
  node_route_analysis["Route grouping"]
  node_controller_output["Controller generation"]
end

subgraph group_experience["Developer experience"]
  node_editor_app["Online editor"]
  node_editor_frame["Editor iframe"]
  node_editor_upload["Project uploader"]
  node_cli["Nestia CLI<br/>[index.ts]"]
end

node_developer(("NestJS developer"))
node_controllers["Nest controllers"]
node_api_service(("HTTP API service"))

node_developer -->|"defines routes"| node_controllers
node_controllers -->|"decorates endpoints"| node_typed_routes
node_controllers -->|"types queries"| node_typed_query
node_typed_query -->|"validates input"| node_query_validation
node_controllers -->|"declares sockets"| node_websocket
node_controllers -->|"configures encryption"| node_encryption
node_developer -->|"runs generation"| node_sdk_cli
node_sdk_cli -.->|"reflects controllers"| node_reflection
node_reflection -->|"analyzes HTTP"| node_http_analysis
node_reflection -->|"analyzes MCP"| node_mcp_analysis
node_reflection -->|"analyzes sockets"| node_ws_analysis
node_reflection -.->|"feeds generation"| node_sdk_generation
node_sdk_generation -->|"generates clients"| node_fetcher
node_sdk_generation -->|"adds simulator"| node_simulator
node_sdk_generation -->|"generates tests"| node_e2e
node_sdk_cli -->|"builds documents"| node_swagger
node_fetcher -->|"sends requests"| node_api_service
node_encrypted_fetcher -.->|"sends encrypted requests"| node_api_service
node_developer -->|"runs migration"| node_migration_app
node_migration_app -.->|"groups routes"| node_route_analysis
node_route_analysis -->|"provides controllers"| node_controller_output
node_developer -->|"opens editor"| node_editor_app
node_editor_app -->|"renders frame"| node_editor_frame
node_editor_app -->|"provides upload"| node_editor_upload
node_developer -->|"uses CLI"| node_cli

click node_typed_routes "https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/TypedRoute.ts"
click node_typed_query "https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/TypedQuery.ts"
click node_query_validation "https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/internal/validate_request_query.ts"
click node_websocket "https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/WebSocketRoute.ts"
click node_encryption "https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/EncryptedController.ts"
click node_sdk_cli "https://github.com/samchon/nestia/blob/master/packages/sdk/src/executable/sdk.ts"
click node_reflection "https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectControllerAnalyzer.ts"
click node_http_analysis "https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectHttpOperationAnalyzer.ts"
click node_mcp_analysis "https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectMcpOperationAnalyzer.ts"
click node_ws_analysis "https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectWebSocketOperationAnalyzer.ts"
click node_sdk_generation "https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/SdkGenerator.ts"
click node_swagger "https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/SwaggerGenerator.ts"
click node_simulator "https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/internal/SdkHttpSimulationProgrammer.ts"
click node_e2e "https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/E2eGenerator.ts"
click node_fetcher "https://github.com/samchon/nestia/blob/master/packages/fetcher/src/PlainFetcher.ts"
click node_encrypted_fetcher "https://github.com/samchon/nestia/blob/master/packages/fetcher/src/EncryptedFetcher.ts"
click node_migration_app "https://github.com/samchon/nestia/blob/master/packages/migrate/src/NestiaMigrateApplication.ts"
click node_route_analysis "https://github.com/samchon/nestia/blob/master/packages/migrate/src/analyzers/NestiaMigrateControllerAnalyzer.ts"
click node_controller_output "https://github.com/samchon/nestia/blob/master/packages/migrate/src/programmers/NestiaMigrateNestControllerProgrammer.ts"
click node_editor_app "https://github.com/samchon/nestia/blob/master/packages/editor/src/NestiaEditorApplication.tsx"
click node_editor_frame "https://github.com/samchon/nestia/blob/master/packages/editor/src/NestiaEditorIframe.tsx"
click node_editor_upload "https://github.com/samchon/nestia/blob/master/packages/editor/src/NestiaEditorUploader.tsx"
click node_cli "https://github.com/samchon/nestia/blob/master/packages/cli/src/index.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_typed_routes,node_typed_query,node_query_validation,node_websocket,node_encryption toneBlue
class node_sdk_cli,node_reflection,node_http_analysis,node_mcp_analysis,node_ws_analysis,node_sdk_generation,node_swagger,node_simulator,node_e2e toneAmber
class node_fetcher,node_encrypted_fetcher,node_api_service toneMint
class node_migration_app,node_route_analysis,node_controller_output toneRose
class node_editor_app,node_editor_frame,node_editor_upload,node_cli,node_developer,node_controllers toneIndigo
```

## Components

### Typed server

- [Typed routes](https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/TypedRoute.ts): `packages/core/src/decorators/TypedRoute.ts`
- [Typed query](https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/TypedQuery.ts): `packages/core/src/decorators/TypedQuery.ts`
- [Query validation](https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/internal/validate_request_query.ts): `packages/core/src/decorators/internal/validate_request_query.ts`
- [WebSocket routes](https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/WebSocketRoute.ts): `packages/core/src/decorators/WebSocketRoute.ts`
- [Encrypted controllers](https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/EncryptedController.ts): `packages/core/src/decorators/EncryptedController.ts`

### API generation

- [SDK command](https://github.com/samchon/nestia/blob/master/packages/sdk/src/executable/sdk.ts): `packages/sdk/src/executable/sdk.ts`
- [Controller reflection](https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectControllerAnalyzer.ts): `packages/sdk/src/analyses/ReflectControllerAnalyzer.ts`
- [HTTP analysis](https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectHttpOperationAnalyzer.ts): `packages/sdk/src/analyses/ReflectHttpOperationAnalyzer.ts`
- [MCP analysis](https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectMcpOperationAnalyzer.ts): `packages/sdk/src/analyses/ReflectMcpOperationAnalyzer.ts`
- [WebSocket analysis](https://github.com/samchon/nestia/blob/master/packages/sdk/src/analyses/ReflectWebSocketOperationAnalyzer.ts): `packages/sdk/src/analyses/ReflectWebSocketOperationAnalyzer.ts`
- [Client SDK generation](https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/SdkGenerator.ts): `packages/sdk/src/generates/SdkGenerator.ts`
- [Swagger generation](https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/SwaggerGenerator.ts): `packages/sdk/src/generates/SwaggerGenerator.ts`
- [Mock simulator](https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/internal/SdkHttpSimulationProgrammer.ts): `packages/sdk/src/generates/internal/SdkHttpSimulationProgrammer.ts`
- [E2E generation](https://github.com/samchon/nestia/blob/master/packages/sdk/src/generates/E2eGenerator.ts): `packages/sdk/src/generates/E2eGenerator.ts`

### Client runtime

- [Typed fetcher](https://github.com/samchon/nestia/blob/master/packages/fetcher/src/PlainFetcher.ts): `packages/fetcher/src/PlainFetcher.ts`
- [Encrypted fetcher](https://github.com/samchon/nestia/blob/master/packages/fetcher/src/EncryptedFetcher.ts): `packages/fetcher/src/EncryptedFetcher.ts`

### Migration

- [Migration command](https://github.com/samchon/nestia/blob/master/packages/migrate/src/NestiaMigrateApplication.ts): `packages/migrate/src/NestiaMigrateApplication.ts`
- [Route grouping](https://github.com/samchon/nestia/blob/master/packages/migrate/src/analyzers/NestiaMigrateControllerAnalyzer.ts): `packages/migrate/src/analyzers/NestiaMigrateControllerAnalyzer.ts`
- [Controller generation](https://github.com/samchon/nestia/blob/master/packages/migrate/src/programmers/NestiaMigrateNestControllerProgrammer.ts): `packages/migrate/src/programmers/NestiaMigrateNestControllerProgrammer.ts`

### Developer experience

- [Online editor](https://github.com/samchon/nestia/blob/master/packages/editor/src/NestiaEditorApplication.tsx): `packages/editor/src/NestiaEditorApplication.tsx`
- [Editor iframe](https://github.com/samchon/nestia/blob/master/packages/editor/src/NestiaEditorIframe.tsx): `packages/editor/src/NestiaEditorIframe.tsx`
- [Project uploader](https://github.com/samchon/nestia/blob/master/packages/editor/src/NestiaEditorUploader.tsx): `packages/editor/src/NestiaEditorUploader.tsx`
- [Nestia CLI](https://github.com/samchon/nestia/blob/master/packages/cli/src/index.ts): `packages/cli/src/index.ts`

### Other components

- **NestJS developer**
- **Nest controllers**
- **HTTP API service**

## Connections

- NestJS developer → Nest controllers: defines routes (evidence: `README.md`)
- Nest controllers → Typed routes: decorates endpoints (evidence: `README.md`)
- Nest controllers → Typed query: types queries (evidence: `README.md`)
- Typed query → Query validation: validates input (evidence: `packages/core/src/decorators/TypedQuery.ts`)
- Nest controllers → WebSocket routes: declares sockets (evidence: `README.md`)
- Nest controllers → Encrypted controllers: configures encryption (evidence: `packages/core/src/decorators/EncryptedController.ts`)
- NestJS developer → SDK command: runs generation (evidence: `README.md`)
- SDK command → Controller reflection: reflects controllers
- Controller reflection → HTTP analysis: analyzes HTTP (evidence: `packages/sdk/src/analyses/ReflectControllerAnalyzer.ts`)
- Controller reflection → MCP analysis: analyzes MCP (evidence: `packages/sdk/src/analyses/ReflectControllerAnalyzer.ts`)
- Controller reflection → WebSocket analysis: analyzes sockets (evidence: `packages/sdk/src/analyses/ReflectControllerAnalyzer.ts`)
- Controller reflection → Client SDK generation: feeds generation
- Client SDK generation → Typed fetcher: generates clients (evidence: `README.md`)
- Client SDK generation → Mock simulator: adds simulator (evidence: `README.md`)
- Client SDK generation → E2E generation: generates tests (evidence: `README.md`)
- SDK command → Swagger generation: builds documents (evidence: `README.md`)
- Typed fetcher → HTTP API service: sends requests (evidence: `README.md`)
- Encrypted fetcher → HTTP API service: sends encrypted requests
- NestJS developer → Migration command: runs migration (evidence: `README.md`)
- Migration command → Route grouping: groups routes
- Route grouping → Controller generation: provides controllers
- NestJS developer → Online editor: opens editor (evidence: `README.md`)
- Online editor → Editor iframe: renders frame (evidence: `packages/editor/src/NestiaEditorApplication.tsx`)
- Online editor → Project uploader: provides upload (evidence: `packages/editor/src/NestiaEditorApplication.tsx`)
- NestJS developer → Nestia CLI: uses CLI (evidence: `README.md`)
