Nestia CLI Tool

11.0.2 · active · verified Wed Apr 22

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.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates programmatic initialization of a Nestia project and generation of its SDK and Swagger documentation using the `main` function and `ECommand` enum.

import { ECommand, main } from 'nestia';
import * as path from 'path';
import * as fs from 'fs/promises';

async function setupNestiaProject() {
  const projectDir = path.join(process.cwd(), 'my-nestia-app');
  await fs.mkdir(projectDir, { recursive: true });
  process.chdir(projectDir);

  console.log(`Initializing Nestia project in ${projectDir}...`);
  await main({
    command: ECommand.init,
    input: ['--project', 'tsconfig.json'],
  });
  console.log('Nestia project initialized.');

  console.log('Generating SDK and Swagger...');
  await main({
    command: ECommand.sdk,
    input: ['--config', 'nestia.config.ts'],
  });
  console.log('SDK and Swagger generated successfully.');

  console.log('Now you can explore your generated SDK and Swagger documentation!');
  console.log(`Check out ${path.join(projectDir, 'src/api/index.ts')} for the SDK.`);
}

setupNestiaProject().catch(console.error);

view raw JSON →