sinclairzx81/typebox is tracked by TopGit as a frontend project, with 6.9k stars on GitHub, written primarily in TypeScript. JSON Schema Type Builder with Static Type Resolution for TypeScript
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
JSON Schema Type Builder with Static Type Resolution for TypeScript
Install
$ npm install typebox
Usage
import Type from 'typebox'
const T = Type.Object({ // const T = {
x: Type.Number(), // type: 'object',
y: Type.Number(), // properties: {
z: Type.Number() // x: { type: 'number' },
}) // y: { type: 'number' },
// z: { type: 'number' }
// },
// required: ['x', 'y', 'z']
// }
type T = Type.Static<typeof T> // type T = {
// x: number,
// y: number,
// z: number
// }
Overview
Documentation
TypeBox is a runtime type system that creates in-memory JSON Schema objects that infer as TypeScript types. The schematics produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox offers a unified type that can be statically checked by TypeScript and runtime checked using standard JSON Schema validation.
This library is designed to allow JSON Schema to compose similar to how types compose within TypeScript's type system. It can be used as a simple tool to build up complex schematics or integrated into REST and RPC services to help validate data received over the wire.
License: MIT
Contents
Type
Script
Schema
Versions
Contribute
Type
Documentation | Example
TypeBox types are JSON Schema fragments that compose into more complex types. The library offers a set of types used to construct JSON Schema compliant schematics as well as a set of extended types used to model constructs native to the JavaScript language. The schematics produced by TypeBox can be passed directly to any JSON Schema compliant validator.
Example
The following creates a User type and infers with Static.
TypeBox includes a micro TypeScript engine that can transform TypeScript definitions to JSON Schema. The engine is fully type-safe and supports many programmable constructs including Conditional, Mapped, Indexed, Generics, Distributive Generics, and more.
Example
Syntax highlighting is available via the Visual Studio Marketplace.
import Type from 'typebox'
// Math Module
const Math = Type.Script(`
type Vector4 = { x: number, y: number, z: number, w: number }
type Vector3 = { x: number, y: number, z: number }
type Vector2 = { x: number, y: number }
`)
// Graphics Module
const Graphics = Type.Script(Math, `
type Vertex = {
position: Vector4,
normal: Vector3,
uv: Vector2
}
type Geometry = {
vertices: Vertex[],
indices: number[]
}
type Material = {
ambient: Vector4,
diffuse: Vector4,
specular: Vector4
}
type Mesh = {
geometry: Geometry,
material: Material
}
`)
type Mesh = Type.Static<typeof Graphics['Mesh']> // type Mesh = {
// geometry: { ... },
// material: { ... }
// }
Schema
Documentation | Example 1 | Example 2
TypeBox includes a high-performance JIT compiler that supports JSON Schema Draft 3 through to 2020-12. It is designed to be a lightweight industry-grade alternative to Ajv and offers improved compilation and validation performance. It also provides automatic fallback to dynamic validation in JIT restricted environments such as Cloudflare Workers.
The compiler is available via optional sub module import.
import Schema from 'typebox/schema'
Compile
The compiler accepts either TypeBox types or native JSON Schema.
Compiled validator instances provide functions to Check and Parse values.
// Compile
const Vector = Schema.Compile(Type.Script(`{
x: number
y: number
z: number
}`))
// Check
const valid = Vector.Check({ x: 1, y: 0, z: 0 }) // const valid: boolean
// Parse
const result = Vector.Parse({ x: 1, y: 0, z: 0 }) // const result: {
// x: number
// y: number
// z: number
// }
Coverage
JSON Schema Test Suite | JSON Schema Compliance Suite
TypeBox supports all major JSON Schema draft versions and tracks compliance against the official JSON Schema Test Suite. It also maintains a separate JavaScript compliance suite to track ecosystem adoption as JSON Schema moves toward the V1 candidate. The following table shows TypeBox specification coverage.
Spec
3
4
6
7
2019-09
2020-12
v1
additionalItems
✅
✅
✅
✅
✅
-
-
additionalProperties
✅
✅
✅
✅
✅
✅
✅
allOf
-
✅
✅
✅
✅
✅
✅
anchor
-
-
-
-
✅
✅
✅
anyOf
-
✅
✅
✅
✅
✅
✅
boolean_schema
-
-
✅
✅
✅
✅
✅
const
-
-
✅
✅
✅
✅
✅
contains
-
-
✅
✅
✅
✅
✅
content
-
-
-
-
✅
✅
✅
default
✅
✅
✅
✅
✅
✅
✅
dependencies
17/18
✅
✅
✅
-
-
-
dependentRequired
-
-
-
-
✅
✅
✅
dependentSchemas
-
-
-
-
✅
✅
✅
dynamicRef
-
-
-
-
-
40/44
21/27
enum
14/16
✅
✅
✅
✅
✅
✅
exclusiveMaximum
-
-
✅
✅
✅
✅
✅
exclusiveMinimum
-
-
✅
✅
✅
✅
✅
if-then-else
-
-
-
✅
✅
✅
✅
infinite-loop-detection
✅
✅
✅
✅
✅
✅
✅
items
✅
✅
✅
✅
✅
✅
✅
maxContains
-
-
-
-
✅
✅
✅
maximum
13/14
13/14
✅
✅
✅
✅
✅
maxItems
✅
✅
✅
✅
✅
✅
✅
maxLength
✅
✅
✅
✅
✅
✅
✅
maxProperties
-
✅
✅
✅
✅
✅
✅
minContains
-
-
-
-
✅
✅
✅
minimum
12/13
16/17
✅
✅
✅
✅
✅
minItems
✅
✅
✅
✅
✅
✅
✅
minLength
✅
✅
✅
✅
✅
✅
✅
minProperties
-
✅
✅
✅
✅
✅
✅
multipleOf
-
✅
✅
✅
✅
✅
✅
not
-
✅
✅
✅
✅
✅
✅
oneOf
-
✅
✅
✅
✅
✅
✅
pattern
✅
✅
✅
✅
✅
✅
✅
patternProperties
✅
✅
✅
✅
✅
✅
✅
prefixItems
-
-
-
-
-
✅
✅
properties
✅
✅
✅
✅
✅
✅
✅
propertyNames
-
-
✅
✅
✅
✅
✅
recursiveRef
-
-
-
-
✅
-
-
ref
22/27
37/45
67/70
75/78
79/81
77/79
78/79
required
3/4
✅
✅
✅
✅
✅
✅
type
73/80
✅
✅
✅
✅
✅
✅
unevaluatedItems
-
-
-
-
✅
✅
70/71
unevaluatedProperties
-
-
-
-
✅
✅
128/129
uniqueItems
✅
✅
✅
✅
✅
✅
✅
Performance
TypeBox tracks comparative performance against AJV8 as the de facto performance standard. For broader comparative benchmarks, refer to the community maintained projects below.
Runtime Benchmarks | Schema Benchmarks
The following table shows compilation performance for various JSON Schema structures. These benchmarks measure the time required to JIT compile schematics, with faster compilation resulting in faster application startup.
The following tables shows validation performance for various JSON Schema structures. These benchmarks measure overall validation throughput for JIT compiled schematics.
TypeBox ships two distinct versions that span two generations of the TypeScript compiler.
TypeBox
TypeScript
Description
1.x
6.0 - 7.0+
Latest. Developed against the TypeScript 7 native compiler. Provides advanced type inference and native JSON Schema 2020-12 support. Includes backwards compatibility with 0.x types. ESM only.
0.x
5.0 - 6.0
LTS. Developed against older TypeScript versions and actively maintained under Long Term Support. Compatible with both ESM and CJS. Issues should be submitted to the Sinclair TypeBox repository.
Contribute
TypeBox is open to community contribution. Please ensure you submit an issue before submitting a pull request. The TypeBox project prefers open community discussion before accepting new features.
How does sinclairzx81/typebox compare to other Frontend projects?
sinclairzx81/typebox is tracked by TopGit in the Frontend category, with 6.9k GitHub stars and written in TypeScript. Browse the Frontend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does sinclairzx81/typebox have?
sinclairzx81/typebox has 6.9k GitHub stars — refresh the page for the live number, or check github.com/sinclairzx81/typebox. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is sinclairzx81/typebox open source?
TopGit's metadata for sinclairzx81/typebox does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
What else is in the Frontend space?
sinclairzx81/typebox is tracked by TopGit under the Frontend category, alongside 2 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is sinclairzx81/typebox?
sinclairzx81/typebox (sinclairzx81/typebox) is a TypeScript project on GitHub. From the project's own README: JSON Schema Type Builder with Static Type Resolution for TypeScript
Where can I see sinclairzx81/typebox in action?
The project maintains a homepage at https://sinclairzx81.github.io/typebox/. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about sinclairzx81/typebox?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/sinclairzx81/typebox is the definitive source.
Read full README in the tab above.
Want a second opinion on typebox?
Ask an AI that can read this page — one click and you get its take on typebox.