bởi Opal W.

Nestia is a suite of helper libraries for NestJS that delivers super-fast typed decorators, automated SDK generation, Swagger docs, E2E test scaffolding, and a mockup simulator—boosting runtime validation 20,000x over class-validator.
This block is the full Nestia monorepo source (packages/) covering the CLI, core decorators, SDK generator, fetcher runtime, migration tools, and editor. The target buyer is a NestJS backend developer who wants type-safe HTTP/WebSocket decorators, automated SDK generation, and encrypted transport utilities without depending on class-validator or class-transformer.
cli/ - Command-line interface (npx nestia) for project scaffolding, setup wizard, SDK/Swagger generationcore/ - NestJS decorators (TypedBody, TypedRoute, TypedParam, TypedQuery, TypedFormData, TypedHeaders, WebSocketRoute, etc.) and their compile-time transformersfetcher/ - Runtime fetch utilities (PlainFetcher, EncryptedFetcher), connection types, HTTP error class, and simulatorsdk/ - SDK builder: generates typed fetch function collections and Swagger documents from NestJS controllersmigrate/ - Migration helpers for converting between Swagger/OpenAPI specs and nestia-compatible formatseditor/ - Swagger UI + online TypeScript editor components (NestiaEditorApplication, NestiaEditorIframe, NestiaEditorUploader)# Core NestJS peer dependencies
npm install @nestjs/common @nestjs/core reflect-metadata rxjs
# Nestia core (decorators + transformer)
npm install @nestia/core
npm install -D nestia
# Fetcher (client-side runtime, no NestJS required)
npm install @nestia/fetcher
# SDK generator (dev dependency)
npm install -D @nestia/sdk
# Editor (optional, frontend component)
npm install @nestia/editor
# For encrypted transport
npm install aes-pkcs5
# TypeScript transformer support
npm install -D typescript ts-patch ts-node
Native build note:
ts-patchmust patch TypeScript before compilation. Runnpx ts-patch installonce after install. The transformer is required for@nestia/coreto generate validators at compile time.
source/ directory adjacent to your project root, or install packages directly from npm. If working from source, add path aliases in :Khởi chạy sandbox cách ly và chạy phía máy chủ — không cần cài đặt cục bộ.
Tetrees AI Review cho phiên bản này
This TypeScript cli / script completed archive review with strong static results. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
Quy trình avcp-2026-08-04.1 · SHA-256 54da68cf70c78b3c…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
Đã đánh giá 4 thg 8, 2026
Đưa sản phẩm này thẳng vào AI IDE, trình tạo web hoặc cloud IDE của bạn.
Kết nối Tetrees với AI IDE tương thích để liệt kê sản phẩm bạn sở hữu và nhận ZIP đã xác minh mà không cấp quyền tải lên của người bán.
Chưa có đánh giá.
Sign in to join the discussion
Loading discussion…
tsconfig.json{
"compilerOptions": {
"paths": {
"@nestia/core": ["./source/core/src"],
"@nestia/fetcher": ["./source/fetcher/src"],
"@nestia/sdk": ["./source/sdk/src"]
},
"plugins": [{ "transform": "./source/core/src/transform.ts" }]
}
}
npx ts-patch install
nestia.config.ts at project root for SDK/Swagger generation:import { INestiaConfig } from "@nestia/sdk";
const config: INestiaConfig = {
input: ["src/controllers"],
swagger: {
output: "dist/swagger.json",
servers: [{ url: "http://localhost:3000" }],
},
output: "src/api",
};
export default config;
npx nestia setup
npx nestia all
import { TypedBody } from "@nestia/core";
// Used as a parameter decorator in a NestJS controller method
@Post("/")
async create(@TypedBody() body: CreateUserDto): Promise<UserDto> { ... }
Replaces @Body() with a compile-time validated, runtime-checked body parser. Validation logic is injected by the TypeScript transformer; no class-validator decorators are needed on DTOs.
import { TypedRoute } from "@nestia/core";
@TypedRoute.Get("/users/:id")
async getUser(@TypedParam("id") id: string): Promise<UserDto> { ... }
Wraps NestJS route decorators (Get, Post, Put, Patch, Delete) and adds compile-time JSON serialization using typia. Serialization is ~200x faster than class-transformer.
import { PlainFetcher } from "@nestia/fetcher";
import { IConnection } from "@nestia/fetcher";
const connection: IConnection = { host: "http://localhost:3000" };
const result = await PlainFetcher.fetch(connection, {
method: "GET",
path: "/users/1",
status: 200,
request: null,
response: { type: "application/json" },
}, undefined);
The plain (unencrypted) HTTP client used by generated SDK functions. Use this directly when you want a typed fetch call without the generated SDK layer, or when writing manual integration tests.
import { EncryptedFetcher } from "@nestia/fetcher";
import { IEncryptionPassword } from "@nestia/fetcher";
const password: IEncryptionPassword = { key: "...", iv: "..." };
Handles AES-PKCS5 encrypted request/response bodies. Pair with @EncryptedBody() and @EncryptedRoute on the server side.
import { HttpError } from "@nestia/fetcher";
try {
await PlainFetcher.fetch(connection, route, body);
} catch (err) {
if (err instanceof HttpError) {
console.log(err.status, err.message);
}
}
Thrown by fetcher utilities when the server responds with a non-2xx status. Contains status, method, path, and message fields.
Define a NestJS controller using @nestia/core decorators, then generate a type-safe SDK for frontend consumers.
// src/controllers/UserController.ts
import { TypedBody, TypedParam, TypedRoute } from "@nestia/core";
import { Controller } from "@nestjs/common";
interface CreateUserDto { name: string; email: string; }
interface UserDto { id: number; name: string; email: string; }
@Controller("users")
export class UserController {
@TypedRoute.Post("/")
async create(@TypedBody() body: CreateUserDto): Promise<UserDto> {
return { id: 1, ...body };
}
@TypedRoute.Get("/:id")
async findOne(@TypedParam("id") id: string): Promise<UserDto> {
return { id: Number(id), name: "Alice", email: "alice@example.com" };
}
}
npx nestia sdk # generates src/api/
npx nestia swagger # generates dist/swagger.json
Use the generated SDK (or PlainFetcher directly) on the frontend or in E2E tests.
import { IConnection } from "@nestia/fetcher";
import { PlainFetcher } from "@nestia/fetcher";
const connection: IConnection = {
host: "http://localhost:3000",
headers: { "Content-Type": "application/json" },
};
// Manually invoke a typed route without the generated SDK
async function getUser(id: string) {
return PlainFetcher.fetch(
connection,
{
method: "GET",
path: `/users/${id}`,
status: 200,
request: null,
response: { type: "application/json" },
},
undefined,
);
}
getUser("1").then(console.log);
Use EncryptedBody and EncryptedRoute for AES-encrypted transport between trusted services.
// server
import { EncryptedBody, EncryptedRoute } from "@nestia/core";
import { Controller } from "@nestjs/common";
interface SecretDto { token: string; }
@Controller("secure")
export class SecureController {
@EncryptedRoute.Post("/")
async receive(@EncryptedBody() body: SecretDto): Promise<{ ok: boolean }> {
return { ok: true };
}
}
// client
import { EncryptedFetcher } from "@nestia/fetcher";
import type { IEncryptionPassword } from "@nestia/fetcher";
const password: IEncryptionPassword = { key: "16-byte-key-here", iv: "16-byte-iv-here!" };
await EncryptedFetcher.fetch(
{ host: "http://localhost:3000" },
password,
{ method: "POST", path: "/secure", status: 200,
request: { type: "text/plain" }, response: { type: "text/plain" } },
{ token: "supersecret" },
);
cli/src/index.ts - Entry point for npx nestia; dispatches to NestiaStarter, NestiaTemplate, NestiaSetupWizard, or delegates to @nestia/sdk executable based on argv.cli/src/NestiaSetupWizard.ts - Interactive setup wizard that configures tsconfig.json, installs dependencies, and wires the compiler transform.cli/src/NestiaStarter.ts - Clones a starter repository into a new directory.cli/src/NestiaTemplate.ts - Clones a template project scaffold.cli/src/internal/ArgumentParser.ts - Parses CLI arguments for wizard commands.cli/src/internal/PackageManager.ts - Detects and invokes npm/yarn/pnpm.cli/src/internal/PluginConfigurator.ts - Writes transformer plugin entries into tsconfig.json.core/src/index.ts - Re-exports everything from module.ts; main entry for @nestia/core.core/src/transform.ts - TypeScript compiler transform plugin registration point.core/src/decorators/TypedBody.ts - @TypedBody() decorator implementation.core/src/decorators/TypedRoute.ts - @TypedRoute.* decorator family.core/src/decorators/TypedParam.ts - @TypedParam() path parameter decorator.core/src/decorators/TypedQuery.ts - @TypedQuery() query-string decorator.core/src/decorators/TypedFormData.ts - @TypedFormData.Body() multipart form decorator.core/src/decorators/TypedHeaders.ts - @TypedHeaders() request headers decorator.core/src/decorators/WebSocketRoute.ts - @WebSocketRoute() typed WebSocket endpoint decorator.core/src/decorators/TypedException.ts - Documents typed exception responses for Swagger.core/src/decorators/EncryptedBody.ts / EncryptedRoute.ts / EncryptedController.ts / EncryptedModule.ts - AES-PKCS5 encrypted transport decorators.core/src/adaptors/WebSocketAdaptor.ts - WebSocket server adaptor bridging NestJS and nestia typed routes.fetcher/src/index.ts - Exports all client-side runtime: fetchers, connection types, error class, simulator.editor/src/index.ts - Exports React components for the Swagger/TypeScript online editor.migrate/src/index.ts - Exports migration utilities for OpenAPI spec conversion.ts-patch must be installed and npx ts-patch install run after every npm install; add it to postinstall script.reflect-metadata missing: Import reflect-metadata once at the very top of your application entry before any NestJS imports, or the decorator metadata will be undefined."module": "ESNext" in the SDK tsconfig and verify tree-shaking works.@nestia/sdk not found when running CLI commands: Run npx nestia setup first; the sdk/swagger/e2e/all commands resolve @nestia/sdk at runtime and will hard-exit if it is absent.typia for schema inference; union types containing undefined in required positions cause schema generation errors - use null or optional ? instead.I have the Nestia monorepo source in `source/` and its integration guide in `USAGE.md`.
The upstream package is `@nestia/station@11.0.2` (packages: core, sdk, fetcher, migrate, cli, editor).
Please integrate Nestia into my existing NestJS project step by step:
1. Read `USAGE.md` and `source/core/src/index.ts` to understand available decorators.
2. Replace all `@Body()` decorators in my controllers with `@TypedBody()` from `source/core/`.
3. Replace all `@Get/@Post/@Put/@Delete` route decorators with `TypedRoute.*` equivalents.
4. Replace `@Param()` with `@TypedParam()` and `@Query()` with `@TypedQuery()`.
5. Configure `tsconfig.json` to include the transformer plugin from `source/core/src/transform.ts`.
6. Add `ts-patch` and run `npx ts-patch install` in the postinstall script.
7. Create `nestia.config.ts` pointing at my controllers directory.
8. Run `npx nestia all` to generate SDK and Swagger output.
9. Show me how to consume the generated SDK from `source/fetcher/src/index.ts` in a client file.
10. Identify any DTO types that use patterns incompatible with typia schema inference and suggest fixes.
Constraints: do not use class-validator or class-transformer; use only pure TypeScript interfaces for DTOs.
The source is published under the MIT License (see source/cli/LICENSE, source/core/LICENSE). Upstream repository: github.com/samchon/nestia. npm package: @nestia/station.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
Hướng dẫn cài đặt đầy đủ và prompt tích hợp sẽ mở khóa sau khi mua.
Automation, Utilities & Developer Tools
Miễn phí