Comparisons

tsgonest vs tsgo

What tsgonest adds on top of Microsoft's typescript-go compiler.

typescript-go (tsgo) is Microsoft's official Go port of the TypeScript compiler — roughly 10x faster than tsc. tsgonest wraps tsgo and extends it with features designed for NestJS backends.

What is tsgo?

tsgo is a 1

port of the TypeScript compiler from JavaScript to Go. It produces identical output to tsc — the same JavaScript, the same type checking, the same diagnostics — just significantly faster.

tsgo is a compiler only. It compiles TypeScript to JavaScript and performs type checking. Nothing more.

What tsgonest adds

tsgonest uses tsgo as its compilation engine, then adds NestJS-specific capabilities on top:

Featuretsgotsgonest
TypeScript compilationYesYes (uses tsgo)
Type checkingYesYes
JavaScript emitYesYes
Incremental buildsYesYes
Validation codegenNoYes — companion files with validate/assert
Serialization codegenNoYes — fast JSON serializers
OpenAPI generationNoYes — OpenAPI 3.2 from NestJS controllers
Watch mode + restartNoYes — tsgonest dev
Asset copyingNoYes — --assets flag
Config filetsconfig.json onlytsconfig.json + tsgonest.config.ts
Post-processing cacheN/AYes — skips codegen when source unchanged

When to use which

Use tsgo when

  • You have a non-NestJS TypeScript project and just want faster compilation
  • You don't need validation, serialization, or OpenAPI generation
  • You want a drop-in replacement for tsc
  • You're building a library, frontend app, or CLI tool

Use tsgonest when

  • You're building a NestJS backend
  • You want generated validators from your TypeScript types
  • You want fast JSON serializers (~1.4x faster than JSON.stringify for simple DTOs)
  • You want OpenAPI documentation without decorator overhead
  • You want watch mode with automatic rebuild and restart
  • You want a single tool that replaces tsc + class-validator + class-transformer + @nestjs/swagger
# NestJS development
tsgonest dev

# Production build
tsgonest build

Performance

Since tsgonest uses tsgo internally, compilation speed is equivalent. The additional passes add minimal overhead:

PhaseTime (120 controllers, 838 routes)
Compilation (tsgo)~15s
Companion generation~3s
OpenAPI~1s
Total cold build~19s
Warm build (cached)~1.1s

The post-processing cache means that on subsequent builds where only a few files changed, tsgonest skips companion regeneration entirely — achieving near-instant rebuilds.


Example output

tsgo output

npx @aspect-build/tsgo --project tsconfig.json
dist/
  user/
    user.dto.js
    user.controller.js
    user.module.js
  main.js

Just compiled JavaScript — exactly what tsc would produce, but faster.

tsgonest output

tsgonest build
dist/
  user/
    user.dto.js                             # compiled JS
    user.dto.CreateUserDto.tsgonest.js      # generated companion
    user.dto.CreateUserDto.tsgonest.d.ts    # companion types
    user.dto.UserResponse.tsgonest.js       # generated companion
    user.dto.UserResponse.tsgonest.d.ts     # companion types
    user.controller.js                      # compiled JS
    user.module.js                          # compiled JS
  main.js
  openapi.json                              # OpenAPI 3.2

Same JavaScript output, plus companions and OpenAPI — all from a single build command.


Can I use both?

There's no need to. tsgonest includes tsgo — it's the same compilation engine. Using tsgonest gives you everything tsgo provides, plus the NestJS-specific features. If you don't configure companions or OpenAPI, tsgonest behaves identically to tsgo with watch mode added.

On this page