Welcome to Nestia
Nestia turns a plain TypeScript type into everything a NestJS project usually needs to wire by hand β request validators, response serializers, an OpenAPI document, a typed client SDK, and an e2e test suite.
This tutorial is for someone who has never used Nestia before. By the end you will have:
- A working NestJS server with type-safe request validation.
- A client SDK auto-generated from your controllers β you can
npm publishit. - A Swagger / OpenAPI document that always matches your code.
- E2E tests generated for every endpoint.
- A mockup simulator so a frontend can call your API before the server exists.
You will write no decorators beyond what you would write in vanilla NestJS, and no separate validation schema.
How long does this take?
About 30 minutes of reading and copying.
Each page is short and ends with a βNextβ link. You can stop after Chapter 5 (βGenerate Your SDKβ) and already have something useful.
What you should know already
- You can read TypeScript.
- You have used NestJS at least once, or you have read its first chapterΒ .
- You have Node.js 20+ and
npm(orpnpm/yarn/bun) installed.
That is all. You do not need to know class-validator, class-transformer, @nestjs/swagger, or any code-generation tool.
The 30-second pitch
In vanilla NestJS, a DTO is written three times β once as a TypeScript type, once with class-validator decorators, once with @nestjs/swagger decorators:
// vanilla NestJS β 3 places to keep in sync
class CreateArticle {
@ApiProperty() @IsString() @MinLength(3) @MaxLength(50)
title!: string;
@ApiProperty() @IsString()
body!: string;
}In Nestia, you write the type once. Thatβs it:
// Nestia β one source of truth
interface ICreateArticle {
title: string & tags.MinLength<3> & tags.MaxLength<50>;
body: string;
}Validation, OpenAPI schema, and the SDK type all come from this single declaration. At compile time, a transformer reads the type and emits the runtime code, which is why it can be much faster than class-validator while staying simpler.
Just want to play? Open the StackBlitz playgroundΒ β a fully wired Nestia project runs in your browser, no local setup needed. You can come back to this tutorial after kicking the tires.
Ready?
Most readers should head to Quick Start (5 min) β that gets you a real Nestia project on your machine and is the path the rest of this tutorial assumes.
Two alternatives, depending on your mood:
- StackBlitz PlaygroundΒ β instant, in-browser, zero install. Good for kicking the tires before committing to a local setup.