# gcanti/io-ts

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/gcanti-io-ts).**

6,813 stars · 318 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/gcanti/io-ts
- Homepage: https://gcanti.github.io/io-ts/
- awesome-repositories: https://awesome-repositories.com/repository/gcanti-io-ts.md

## Topics

`inference` `runtime` `types` `typescript` `validation`

## Description

io-ts is a TypeScript runtime validation library that provides a composable codec system for decoding and encoding data at the boundaries of an application. It defines data schemas using structural types, where the shape of data determines its validity rather than nominal names, and produces runtime type guards from those definitions for efficient validation checks.

The library is built around bidirectional codec mappings that combine decoding, encoding, and type checking into single reusable units. It supports a composable decoder pipeline where small validation steps can be chained together, and includes an error accumulation strategy that collects multiple validation errors into a single result rather than failing on the first mistake. Additionally, io-ts provides a structural comparison utility that compares values by their shape rather than reference identity.

The project covers data validation and parsing, including decoding external input into typed structures, encoding internal data back to JSON-compatible shapes, and validating data at runtime against declared schemas. It also supports schema-driven data safety across system boundaries and structural comparison for testing or data processing.

## Tags

### Programming Languages & Runtimes

- [IO Decoding and Encoding Type Systems](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-type-validation/io-decoding-and-encoding-type-systems.md) — Validates and transforms external data into typed structures using composable codecs at runtime.
- [Runtime Type Validation](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-type-validation.md) — Provides runtime type validation against declared schemas with composable codecs and clear error reporting.
- [Codec-Based Type Validations](https://awesome-repositories.com/f/programming-languages-runtimes/type-validation/codec-based-type-validations.md) — Validates data by composing codec objects that combine decoding, encoding, and type checking into a single unit.

### Data & Databases

- [Data Serialization Codecs](https://awesome-repositories.com/f/data-databases/data-serialization-codecs.md) — Combines decoders and encoders into reusable units that can be composed across data types. ([source](https://cdn.jsdelivr.net/gh/gcanti/io-ts@master/README.md))
- [Composable Codec Schemas](https://awesome-repositories.com/f/data-databases/structured-data-schemas/composable-codec-schemas.md) — Combines decoders and encoders into reusable units that can be composed across data types.
- [Typed Internal Data Encoders](https://awesome-repositories.com/f/data-databases/storage-data-encodings/typed-internal-data-encoders.md) — Converts a validated internal value back into a plain JSON-compatible shape for output or storage. ([source](https://cdn.jsdelivr.net/gh/gcanti/io-ts@master/README.md))

### Security & Cryptography

- [Runtime Data Validation](https://awesome-repositories.com/f/security-cryptography/input-validation-schemas/runtime-data-validation.md) — Checks that incoming data matches a declared type schema and throws a clear error when it does not. ([source](https://cdn.jsdelivr.net/gh/gcanti/io-ts@master/README.md))

### Software Engineering & Architecture

- [Codec-Based Bidirectional Mappings](https://awesome-repositories.com/f/software-engineering-architecture/bidirectional-serialization-mappings/codec-based-bidirectional-mappings.md) — Provides bidirectional codec mappings that combine decoding and encoding into single reusable units.
- [Data Encoders and Decoders](https://awesome-repositories.com/f/software-engineering-architecture/data-encoders-and-decoders.md) — Transforms raw JSON or untrusted input into typed, validated structures and back to plain data for output or storage.
- [Data Validation Schemas](https://awesome-repositories.com/f/software-engineering-architecture/data-validation-schemas.md) — Declares the shape and constraints of data in a composable way for validation and transformation. ([source](https://cdn.jsdelivr.net/gh/gcanti/io-ts@master/README.md))
- [Runtime Structural Type Validations](https://awesome-repositories.com/f/software-engineering-architecture/type-systems/structural-typing-and-inference/runtime-structural-type-validations.md) — Defines types based on the shape of data rather than nominal names, enabling flexible runtime validation.
- [Typed External Input Decoders](https://awesome-repositories.com/f/software-engineering-architecture/workflow-automation-patterns/determinism-validators/configuration-validators/external-api-validators/external-data-validation/typed-external-input-decoders.md) — Transforms raw external data into a typed, validated structure ready for use inside the application. ([source](https://cdn.jsdelivr.net/gh/gcanti/io-ts@master/README.md))
- [Typed Payload Decoders](https://awesome-repositories.com/f/software-engineering-architecture/workflow-automation-patterns/determinism-validators/configuration-validators/external-api-validators/external-data-validation/typed-payload-decoders.md) — Converts untrusted input into a typed, validated structure so the rest of the application can use it safely. ([source](https://gcanti.github.io/io-ts/modules))
- [Error Accumulators](https://awesome-repositories.com/f/software-engineering-architecture/error-accumulators.md) — Collects multiple validation errors into a single result instead of failing on the first mistake.
- [Type Guard Generators](https://awesome-repositories.com/f/software-engineering-architecture/runtime-type-guards/type-guard-generators.md) — Produces runtime type guard functions from static type definitions for efficient validation checks.

### Development Tools & Productivity

- [Validation Decoder Pipelines](https://awesome-repositories.com/f/development-tools-productivity/data-transformation-pipelines/reusable-transform-pipelines/validation-decoder-pipelines.md) — Builds decoders by chaining small, reusable validation steps that transform and check data incrementally.

### Part of an Awesome List

- [Runtime Validation](https://awesome-repositories.com/f/awesome-lists/data/runtime-validation.md) — Extensible runtime type system for data decoding.
- [Utility Libraries](https://awesome-repositories.com/f/awesome-lists/devtools/utility-libraries.md) — Runtime type validation library.
