Nestia (opens in a new tab) is a set of helper libraries for NestJS
, supporting below features:
@nestia/core
: superfast decorators usingtypia
@nestia/sdk
: evolved SDK and Swagger generators@nestia/migrate
: Swagger to NestJSnestia
: just CLI (command line interface) tool
import { Controller } from "@nestjs/common";
import { TypedBody, TypedRoute } from "@nestia/core";
import type { IBbsArticle } from "@bbs-api/structures/IBbsArticle";
@Controller("bbs/articles")
export class BbsArticlesController {
/**
* Store a new content.
*
* @param input Content to store
* @returns Newly archived article
*/
@TypedRoute.Post() // 200x faster and safer JSON.stringify()
public async store(
@TypedBody() input: IBbsArticle.IStore, // 20,000x faster validator
): Promise<IBbsArticle>;
// do not need DTO class definition,
// just fine with interface
}
- Left:
NestJS
server code - Right: Client code using
SDK