typia is a free, open source api development & testing project written in Go and released under MIT. It has 5,911 GitHub stars, 224 forks and 4 open issues, and was last pushed 18 hours ago. On this registry it ranks #38 of 103 tracked projects in API Development & Testing, with 5 head-to-head comparisons available. It gained 3 stars over the last 3 tracked days.

What is typia?

Typia is an MIT-licensed TypeScript transformer library that compiles pure TypeScript types into super-fast runtime validators and serializers, built for TypeScript and Node.js developers who want runtime type safety without writing or maintaining a separate schema.

What it is

Typia is a transformer library distributed through NPM as typia. It lives in the TypeScript ecosystem and works by analyzing a target type T at compile time and emitting a dedicated runtime function in its place. The README describes the core idea plainly: write the type on the left, and typia compiles it into the validator on the right — at build time, with no schema and no runtime reflection. A call to typia.is() is rewritten into a generated type checker such as (input) => "string" === typeof input for string, rather than being resolved dynamically at runtime.

The concrete problem it solves is the duplicate-schema tax. Normally a TypeScript codebase that needs runtime validation declares the type once for the compiler and again as a schema, decorator, or hand-written guard for the runtime — and the two drift apart. Typia removes the second declaration. As the README states, instead of defining additional schemas, the pure TypeScript type itself is used. That replaces schema-first validation and serialization tooling such as class-validator and class-transformer, which the README names as the baselines typia benchmarks against.

Key capabilities

  • Runtime validators with distinct failure semantics: is returns a boolean, assert throws TypeGuardError, assertGuard asserts, and validate returns an IValidation result with details.
  • JSON functions under the json namespace: schema, assertParse, and assertStringify.
  • An LLM function calling harness under the llm namespace: application, structuredOutput, and parse, which pairs a lenient JSON parser with type coercion.
  • Protocol Buffer support under the protobuf namespace: message, assertDecode, and assertEncode.
  • A random data generator, random(g?: Partial), for producing typed sample data.
  • Build-time transformation rather than runtime reflection, so the generated checker is specialized to the target type.
  • Documented performance deltas against named baselines: 20,000x faster than class-validator, 200x faster JSON serialization than class-transformer, and LLM function calling accuracy moving from 6.75% to 100%.

Who uses it and how

  • Backend teams validating untrusted input at the boundary of an API, using assert or validate in place of decorator-based DTO validation.
  • API teams that need JSON schema or OpenAPI artifacts, pulling them from json.schema() instead of maintaining schema files by hand.
  • Developers building LLM function calling or agentic tooling, who use the llm namespace to get function calling schemas plus validators and parsers from the same type definitions.
  • Services speaking Protocol Buffers, using protobuf.assertEncode and protobuf.assertDecode for type-safe encode and decode.
  • Teams generating typed fixtures and test data through random.

Getting started

Install with npm i typia and npm i -D ttsc typescript, then build with npx ttsc or run a script directly with npx ttsx src/index.ts. For bundler integration across Vite, Next.js, Webpack, Rollup, and esbuild, the README points to @ttsc/unplugin.

How it compares

Against class-validator and class-transformer — the two products named in the README as baselines — typia is MIT-licensed, self-hosted, and free of per-seat or usage cost, and it works from TypeScript types rather than requiring decorated classes. It also avoids runtime reflection, since validation code is generated during compilation. The trade-off is that it requires its own toolchain rather than dropping into an existing class-based validation setup.

When to use it — and when not to

The build pipeline is the real operational constraint: ttsc and ttsx are mandatory, and the stock tsc, ts-node, and tsx cannot apply the transform, so projects unwilling to change their compile and run tooling should not adopt it. There is no database, storage layer, or SMTP service to operate, because typia is a library and not a hosted application. Worth noting for the record: this registry lists the language as Go, while the README and packaging describe a TypeScript project published to NPM with https://typia.io/ as its documentation home.

project readme (upstream, from github) — read inline

Typia

Typia Logo

GitHub license NPM Version NPM Downloads Build Status Guide Documents Discord Badge

// RUNTIME VALIDATORS
export function is<T>(input: unknown): input is T; // returns boolean
export function assert<T>(input: unknown): T; // throws TypeGuardError
export function assertGuard<T>(input: unknown): asserts input is T;
export function validate<T>(input: unknown): IValidation<T>; // detailed

// JSON FUNCTIONS
export namespace json {
  export function schema<T>(): IJsonSchemaUnit<T>; // JSON schema
  export function assertParse<T>(input: string): T; // type safe parser
  export function assertStringify<T>(input: T): string; // safe and faster
}

// AI FUNCTION CALLING HARNESS
export namespace llm {
  // collection of function calling schemas + validators/parsers
  export function application<Class>(): ILlmApplication<Class>;
  export function structuredOutput<P>(): ILlmStructuredOutput;
  // lenient json parser + type coercion
  export function parse<T>(str: string): T;
}

// PROTOCOL BUFFER
export namespace protobuf {
  export function message<T>(): string; // Protocol Buffer message
  export function assertDecode<T>(buffer: Uint8Array): T; // safe decoder
  export function assertEncode<T>(input: T): Uint8Array; // safe encoder
}

// RANDOM GENERATOR
export function random<T>(g?: Partial<IRandomGenerator>): T;

typia is a transformer library supporting below features:

  • Super-fast Runtime Validators
  • Enhanced JSON schema and serde functions
  • LLM function calling harness
  • Protocol Buffer encoder and decoder
  • Random data generator

[!NOTE]

  • Only one line required, with pure TypeScript type
  • Runtime validator is 20,000x faster than class-validator
  • JSON serialization is 200x faster than class-transformer
  • LLM function calling harness turns 6.75% → 100% accuracy

Write the type on the left, and typia compiles it into the validator on the right — at build time, with no schema and no runtime reflection.

Write a TypeScript type and typia compiles it into a dedicated validator

Setup

Install typia with the ttsc toolchain.

# install
npm i typia
npm i -D ttsc typescript

# build
npx ttsc

# run a script directly
npx ttsx src/index.ts

You must use ttsc and ttsx. The stock tsc, ts-node, and tsx cannot apply the typia transform, so they will not work.

For bundler integration (Vite, Next.js, Webpack, Rollup, esbuild, ...), use @ttsc/unplugin.

Transformation

If you call typia function, it would be compiled like below.

This is the key concept of typia, transforming TypeScript type to a runtime function. The typia.is() function is transformed to a dedicated type checker by analyzing the target type T in the compilation level.

This feature enables developers to ensure type safety in their applications, leveraging TypeScript's static typing while also providing runtime validation. Instead of defining additional schemas, you can simply utilize the pure TypeScript type itself.

//----
// examples/checkString.ts
//----
import typia, { tags } from "typia";
export const checkString = typia.createIs<string>();

//----
// examples/checkString.js
//----
import typia from "typia";
export const checkString = (() => {
  return (input) => "string" === typeof input;
})();

Sponsors

Backers

Thanks for your support.

Your donation encourages typia development.

Playground

You can experience how typia works by playground website:

Guide Documents

Check out the document in the website:

🏠 Home

📖 Features

🔗 Appendix

Inspired By

Frequently asked questions

Is typia free to use?

typia is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does typia do?

Super-fast/easy runtime validators and serializers via transformation

What is typia written in?

typia is primarily written in Go. Its source is publicly available at https://github.com/samchon/typia, and it has 5,911 GitHub stars.