{"id":17040,"library":"nestia","title":"Nestia CLI Tool","description":"Nestia is a comprehensive CLI tool designed to enhance NestJS development by providing a suite of features including super-fast decorators, advanced WebSocket routes, and robust code generation capabilities. It currently stands at version 11.0.2 and receives active development, with frequent releases addressing features, bug fixes, and minor breaking changes. A key differentiator is its deep integration with `typia` for runtime validation and JSON serialization, which claims significantly higher performance (e.g., 20,000x faster than `class-validator` for validation, 200x faster than `class-transformer` for serialization). Nestia also generates a fully typed SDK for clients, complete with a mockup simulator and E2E test functions, akin to `tRPC` but with a focus on code generation rather than direct RPC, and offers advanced Swagger document generation features including AI chatbot integration. Its modular design includes sub-packages like `@nestia/core`, `@nestia/sdk`, and `@nestia/e2e` for specific functionalities.","status":"active","version":"11.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/samchon/nestia","tags":["javascript","nestia","cli","sdk","swagger","generator","nestjs","typia","typescript"],"install":[{"cmd":"npm install nestia","lang":"bash","label":"npm"},{"cmd":"yarn add nestia","lang":"bash","label":"yarn"},{"cmd":"pnpm add nestia","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for compiling NestJS projects and generating type-safe SDKs/Swagger documents.","package":"typescript","optional":false},{"reason":"Provides core decorators and functionalities, often used in NestJS projects managed by Nestia.","package":"@nestia/core","optional":false},{"reason":"Essential for SDK, Swagger, and E2E test function generation.","package":"@nestia/sdk","optional":false},{"reason":"Underpins Nestia's high-performance runtime validation and JSON serialization. Direct dependency for many features.","package":"typia","optional":false}],"imports":[{"note":"Primarily for programmatic invocation of the CLI, used in build scripts or custom runners. Not for typical application logic.","wrong":"const main = require('nestia')","symbol":"main","correct":"import { main } from 'nestia'"},{"note":"Imports the interface for Nestia's configuration object, useful for strongly typing `nestia.config.ts`. Use `import type` for type-only imports.","wrong":"import { IConfiguration } from 'nestia'","symbol":"IConfiguration","correct":"import type { IConfiguration } from 'nestia'"},{"note":"Enum representing available Nestia CLI commands for programmatic command execution.","symbol":"ECommand","correct":"import { ECommand } from 'nestia'"}],"quickstart":{"code":"import { ECommand, main } from 'nestia';\nimport * as path from 'path';\nimport * as fs from 'fs/promises';\n\nasync function setupNestiaProject() {\n  const projectDir = path.join(process.cwd(), 'my-nestia-app');\n  await fs.mkdir(projectDir, { recursive: true });\n  process.chdir(projectDir);\n\n  console.log(`Initializing Nestia project in ${projectDir}...`);\n  await main({\n    command: ECommand.init,\n    input: ['--project', 'tsconfig.json'],\n  });\n  console.log('Nestia project initialized.');\n\n  console.log('Generating SDK and Swagger...');\n  await main({\n    command: ECommand.sdk,\n    input: ['--config', 'nestia.config.ts'],\n  });\n  console.log('SDK and Swagger generated successfully.');\n\n  console.log('Now you can explore your generated SDK and Swagger documentation!');\n  console.log(`Check out ${path.join(projectDir, 'src/api/index.ts')} for the SDK.`);\n}\n\nsetupNestiaProject().catch(console.error);\n","lang":"typescript","description":"Demonstrates programmatic initialization of a Nestia project and generation of its SDK and Swagger documentation using the `main` function and `ECommand` enum."},"warnings":[{"fix":"Review Nestia's documentation on Typia integration and update any custom validation setups or configurations (`nestia.config.ts`) accordingly. Look for changes related to `INestiaTransformOptions.typia`.","message":"The way Typia validates programmers has changed in v11.0.0. This may require adjustments to existing validation logic or configurations when upgrading.","severity":"breaking","affected_versions":">=11.0.0"},{"fix":"Regenerate your client SDKs and update any code that interacts with the generated symbols, replacing `$` with `_` as per the new escaping mechanism. Example: `Api$Users` becomes `Api_Users`.","message":"In v10.0.1, the SDK generator changed the escape symbol from `$` to `_` for generated client symbols to avoid conflicts. If your client code or generated files relied on the `$` symbol, they will break.","severity":"breaking","affected_versions":">=10.0.1"},{"fix":"Consult the Nestia documentation on 'AI Chatbot Development' and 'universal LLM schema' for v10 to understand the new configuration and schema generation process. Update `nestia.config.ts` if necessary.","message":"Nestia v10.0.0 introduced a 'universal LLM schema' feature. This likely entails changes to how LLM-related schemas are generated or configured within Nestia, potentially breaking existing AI Chatbot integrations.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Store custom logic outside of generated files. For instance, extend generated classes/interfaces or import generated types into manually maintained files. Use `.nestia` folder for outputs, and ensure it's in `.gitignore`.","message":"Nestia is a code generator. Re-running generation commands (e.g., `nestia sdk`) can overwrite existing files within the target SDK or Swagger output directories. Ensure you manage custom code in separate files or use appropriate configuration options to prevent accidental overwrites.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Follow Nestia's official setup guides, especially regarding `typia` integration, to ensure the performance optimizations are correctly applied. Profile your application to confirm the expected performance improvements.","message":"Nestia's performance claims (e.g., '20,000x faster than class-validator') are based on specific benchmarks against alternative libraries. While generally faster, actual performance gains in your application depend on your specific workload, data structures, and usage patterns. Proper setup and configuration are critical to realize these benefits.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure `nestia` is installed correctly via `npm install -D nestia` or `yarn add -D nestia`. Verify the command exists in your `package.json` scripts or is called directly via `npx nestia <command>`.","cause":"Attempting to run a Nestia command that is not recognized by the current version or installation.","error":"Error: Command 'sdk' is not registered."},{"fix":"Create `nestia.config.ts` in your project root. You can generate a basic one with `npx nestia init --project tsconfig.json`.","cause":"Nestia CLI commands, especially `sdk` or `swagger`, require a configuration file, typically `nestia.config.ts`, in the project root.","error":"Error: Configuration file \"nestia.config.ts\" not found."},{"fix":"Ensure `typia` is installed (`npm install typia`) and that your `nestia.config.ts` correctly configures Typia. Verify your `tsconfig.json` includes the necessary settings for transformer plugins if applicable.","cause":"This often indicates an issue with Typia's runtime validation setup, where the `is` function (or similar `typia` functions) is not correctly imported or bundled.","error":"TypeError: (0, _nestia_sdk__WEBPACK_IMPORTED_MODULE_0__.is) is not a function"},{"fix":"Install `@nestia/core` as a dependency: `npm install @nestia/core` or `yarn add @nestia/core`. Ensure your `tsconfig.json` includes `node_modules/@nestia/core` in its `include` or `types` paths, though this is usually handled automatically.","cause":"The `@nestia/core` package is not installed or TypeScript cannot locate its type definitions.","error":"TS2307: Cannot find module '@nestia/core' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null}