What is Nestia?
Nestia turns a plain TypeScript type into everything a NestJS server usually needs to wire by hand. You write one interface, and you get:
- Runtime validation of requests and responses — typically 30–100× faster than
class-validatorand up to 20,000× on pathological cases. - A typed client SDK — like tRPC, but over plain REST.
- An OpenAPI 3.1 / 3.0 / 2.0 document.
- An end-to-end test suite generated for every endpoint.
- A mockup simulator so a frontend can call your API before the server exists.
No decorator triplets. No separate schema files. No codegen round-trip. Just types.
The vanilla NestJS problem
NestJS DTOs need to be declared three times:
class CreateArticle {
@ApiProperty({ description: "Title", minLength: 3, maxLength: 50 }) // ← Swagger
@IsString() @MinLength(3) @MaxLength(50) // ← validator
title!: string;
// ...and the TypeScript type itself
}Three sources of truth. Any drift — and there is always drift — becomes a runtime bug.
Nestia replaces all of that with one TypeScript type. The validation, the schema, and the SDK function signature all derive from the same declaration:
interface ICreateArticle {
title: string & tags.MinLength<3> & tags.MaxLength<50>;
}That’s it. The rest is generated.
How it works (in three lines)
- You decorate routes with
@TypedRoute.*and parameters with@TypedBody,@TypedParam,@TypedQuery— same shape as vanilla NestJS, type-aware. - At build time,
ttsc(a Go-based TypeScript compiler) runs Nestia’s transformer. It reads your TypeScript types and inlines a hand-written validator and serializer for each call site. - The
nestiaCLI reads the same types to generate an SDK, a Swagger document, and an e2e suite into files you commit.
The packages
Nestia is a small family. The two you’ll see most are bold:
@nestia/core— typed request / response decorators for NestJS controllers.@nestia/sdk— generators: SDK, Swagger document, mockup simulator, e2e suite.@nestia/fetcher— the typedfetchruntime the generated SDK is built on.@nestia/e2e— discoverer and helpers for the generated e2e suite.@nestia/benchmark— runs the same e2e functions as a load test.@nestia/migrate— turns an existing Swagger document into a NestJS project.@nestia/editor— Swagger UI with an embedded TypeScript playground.nestia— the CLI that drives@nestia/sdk.
You only think about the first two day-to-day. Install them with ttsc and TypeScript 7 as shown in Setup.
Where to go next
Install Nestia in an existing NestJS project with TypeScript 7 and ttsc.
📦 SetupPer-decorator and per-feature reference pages.
📖 ReferenceTry Nestia in a browser, no local setup needed.
🎮 PlaygroundQuick numbers
Community
- GitHub — source, issues, releases.
- Discord — live questions.
- Gurubase — an LLM that has read all of this for you.
- dev.to articles — long-form posts on each feature.
Status badges
Sponsors
Your support keeps Nestia development going.