# arktypeio/arktype

**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/arktypeio-arktype).**

7,780 stars · 148 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/arktypeio/arktype
- Homepage: https://arktype.io/
- awesome-repositories: https://awesome-repositories.com/repository/arktypeio-arktype.md

## Topics

`javascript` `parsing` `runtime-typechecking` `static-typing` `typescript`

## Description

Arktype is a TypeScript runtime validation library and schema orchestrator. It synchronizes TypeScript types with runtime data validation, allowing users to define type-safe schemas that ensure unknown data adheres to specific structures during application execution.

The project distinguishes itself by using set-theory type analysis to determine intersections and subtype compatibility, alongside JIT-compiled validation functions for optimized performance. It supports advanced type modeling through branded type constraints, recursive alias resolution, and the ability to generate runtime validation logic directly from TypeScript type definitions.

The system covers a broad surface of data validation and transformation, including complex structure validation for objects, tuples, and class instances. It provides data transformation pipelines that morph and pipe values through a sequence of validations, as well as bidirectional mapping between internal representations and standard JSON Schema formats.

Additional capabilities include environment variable validation, custom validation error serialization, and programmatic type introspection for analyzing relationships between different schemas.

## Tags

### Part of an Awesome List

- [Input Validation](https://awesome-repositories.com/f/awesome-lists/devtools/input-validation.md) — Checks input data against schemas and returns a typed output or throws an error for invalid data. ([source](https://arktype.io/docs/type-api))
- [Input Shape Manipulation](https://awesome-repositories.com/f/awesome-lists/data/data-transformation/input-shape-manipulation.md) — Transforms the shape of input data by piping transformation functions around validation steps. ([source](https://arktype.io/docs/intro/morphs-and-more))

### Programming Languages & Runtimes

- [Runtime Type Validation](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-type-validation.md) — Provides a runtime validation library that synchronizes TypeScript types with data validation during application execution.
- [Complex Structure Validation](https://awesome-repositories.com/f/programming-languages-runtimes/complex-structure-validation.md) — Checks that a value conforms to complex structures including objects, arrays, Maps, Sets, or TypedArrays. ([source](https://arktype.io/docs/keywords))
- [Numeric Type Utilities](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/generic-traits/numeric-type-traits/numeric-type-utilities.md) — Provides utility types to verify if a value is a number, integer, or specific constant like Infinity or NaN. ([source](https://arktype.io/docs/keywords))
- [Type Compositions](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/type-compositions.md) — Builds sophisticated data models by combining recursive types, branded types, and complex constraints. ([source](https://arktype.io/docs/intro/your-first-type))
- [Object Type Composition](https://awesome-repositories.com/f/programming-languages-runtimes/user-defined-types/object-type-composition.md) — Allows the creation of composite types by extending or intersecting multiple object definitions. ([source](https://arktype.io/docs/objects))
- [Bidirectional Schema Synchronization](https://awesome-repositories.com/f/programming-languages-runtimes/bidirectional-schema-synchronization.md) — Synchronizes JSON Schema definitions between internal type representations and standard formats for bidirectional tool compatibility. ([source](https://arktype.io/docs/blog/2.2))
- [Generic Type Constraints](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/generic-type-constraints.md) — Limits the types passed to generic parameters to ensure type safety and support for specific operators. ([source](https://arktype.io/docs/generics))
- [Type Constraint Combinations](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/type-constraint-combinations.md) — Creates new types that enforce the constraints of two or more existing types simultaneously. ([source](https://arktype.io/docs/expressions))
- [JSON Schema Converters](https://awesome-repositories.com/f/programming-languages-runtimes/json-schema-converters.md) — Converts internal validation definitions into standard JSON Schema formats for interoperability.
- [Type-to-Schema Generation](https://awesome-repositories.com/f/programming-languages-runtimes/json-schema-converters/json-schema-generators/type-to-schema-generation.md) — Converts internal type definitions into JSON Schema format for use with external tools. ([source](https://arktype.io/docs/type-api))
- [Runtime Schema Export](https://awesome-repositories.com/f/programming-languages-runtimes/json-schema-converters/runtime-schema-export.md) — Translates runtime validation formats into standard JSON schema specifications for compatibility with external toolsets. ([source](https://arktype.io/docs/integrations))
- [Type Aliases](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-definitions/type-aliases.md) — Creates a resolution space for named aliases to reuse complex types within string syntax. ([source](https://arktype.io/docs/scopes))
- [Object Property Transformers](https://awesome-repositories.com/f/programming-languages-runtimes/object-property-transformers.md) — Transforms object properties by applying mapping functions to keys, values, or property requirement levels. ([source](https://arktype.io/docs/objects))
- [Runtime Validator Compilation](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-validator-compilation.md) — Uses a runtime compilation mode to build optimized validators with a fallback for restricted environments.
- [Schema Performance Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/schema-performance-optimizations.md) — Reduces schema complexity to their most efficient representation to increase the speed of data validation. ([source](https://arktype.io/docs/blog/2.0))
- [String Value Transformers](https://awesome-repositories.com/f/programming-languages-runtimes/string-value-transformers.md) — Transforms strings through operations such as trimming whitespace, changing case, or parsing dates. ([source](https://arktype.io/docs/keywords))
- [Union Type Transformations](https://awesome-repositories.com/f/programming-languages-runtimes/union-type-transformations.md) — Extracts or excludes specific members from a union type based on matching criteria. ([source](https://arktype.io/docs/generics))

### Security & Cryptography

- [Runtime Data Validation](https://awesome-repositories.com/f/security-cryptography/input-validation-schemas/runtime-data-validation.md) — Validates unknown data against schemas at runtime to ensure structural integrity and type safety. ([source](https://arktype.io/docs/intro/your-first-type))
- [Bidirectional Schema Mapping](https://awesome-repositories.com/f/security-cryptography/input-validation-schemas/bidirectional-schema-mapping.md) — Translates internal type representations to and from standard JSON Schema formats for cross-tool interoperability.

### Data & Databases

- [Numeric Range Constraints](https://awesome-repositories.com/f/data-databases/data-querying/table-item-filters/numeric-range-filters/numeric-range-constraints/numeric-range-constraints.md) — Enforces minimum and maximum boundaries, integer requirements, and multiples on numeric values. ([source](https://arktype.io/docs/primitives))
- [Transformation Chains](https://awesome-repositories.com/f/data-databases/data-transformation-functions/transformation-chains.md) — Pipes values through a sequential chain of transformations and validations that fail on the first error. ([source](https://arktype.io/docs/blog/2.1))
- [Conditional Enforcement](https://awesome-repositories.com/f/data-databases/schema-enforcement-tools/conditional-enforcement.md) — Enforces dynamic runtime conditions such as range limits or format requirements to narrow allowed values. ([source](https://arktype.io/docs/intro/adding-constraints))
- [JIT Schema Compilation](https://awesome-repositories.com/f/data-databases/schema-validation-libraries/schema-compilers/jit-schema-compilation.md) — Optimizes performance by compiling schema definitions into specialized executable functions for faster data processing.
- [Standard Schema Validators](https://awesome-repositories.com/f/data-databases/data-collection-schemas/standard-schema-validators.md) — Implements a common schema definition format to ensure interoperability with other validation libraries like Zod or Valibot. ([source](https://arktype.io/docs/blog))
- [String](https://awesome-repositories.com/f/data-databases/data-structures/structured-return-objects/collection-size-utilities/length-constraints/string.md) — Enforces inclusive or exclusive minimum and maximum length requirements for string inputs. ([source](https://arktype.io/docs/primitives))
- [Validation Result Serializers](https://awesome-repositories.com/f/data-databases/data-structures/structured-return-objects/json-response-serializers/validation-result-serializers.md) — Converts validation failures into structured JSON maps grouped by path for programmatic access. ([source](https://arktype.io/docs/blog/2.2))
- [Enum Definitions](https://awesome-repositories.com/f/data-databases/enum-definitions.md) — Generates runtime types based on existing enums or enum-like objects for strict categorical data integrity. ([source](https://arktype.io/docs/blog/2.2))
- [Object Property Selectors](https://awesome-repositories.com/f/data-databases/object-property-selectors.md) — Creates new schemas by picking a specific subset of properties to keep or omitting unwanted properties from an object. ([source](https://arktype.io/docs/objects))
- [Constraint Error Generation](https://awesome-repositories.com/f/data-databases/schema-enforcement-tools/validation-constraints/constraint-error-generation.md) — Validates data and throws formatted errors if the input fails defined type constraints. ([source](https://arktype.io/docs/traversal-api))
- [Tuple Schema Definitions](https://awesome-repositories.com/f/data-databases/tuple-data-structures/tuple-schema-definitions.md) — Specifies ordered structures with prefix, optional, variadic, or postfix elements for runtime validation. ([source](https://arktype.io/docs/objects))

### Development Tools & Productivity

- [Type Safe Parsing](https://awesome-repositories.com/f/development-tools-productivity/code-generators/boilerplate-generators/android/json-data-parsing/type-safe-parsing.md) — Transforms raw input and environment variables into structured objects with automatic type inference and casting.
- [Environment Variable Validation](https://awesome-repositories.com/f/development-tools-productivity/command-argument-parsers/environment-variable-configuration/environment-variable-validation.md) — Parses values from environment sources against a schema to produce type-safe objects with automatic conversions. ([source](https://arktype.io/docs/ecosystem))
- [Type-Safe Regular Expressions](https://awesome-repositories.com/f/development-tools-productivity/regular-expression-generators/type-safe-regular-expressions.md) — Infers precise string types from regular expression syntax to provide static safety for matching. ([source](https://arktype.io/docs/blog/arkregex))

### DevOps & Infrastructure

- [Schema Behavior Configuration](https://awesome-repositories.com/f/devops-infrastructure/configuration-management/configuration-validation/schema-behavior-configuration.md) — Sets global or scoped rules for handling undeclared keys, optional properties, and validation failure responses. ([source](https://arktype.io/docs/configuration))

### Scientific & Mathematical Computing

- [Set-Theoretic Type Analysis](https://awesome-repositories.com/f/scientific-mathematical-computing/set-theoretic-type-analysis.md) — Analyzes relationships between types using mathematical set operations to determine intersections and subtype compatibility.

### Software Engineering & Architecture

- [Custom Validation Functions](https://awesome-repositories.com/f/software-engineering-architecture/custom-validation-rules/asynchronous-validators/custom-validation-functions.md) — Integrates user-defined synchronous and asynchronous functions into the validation process to enforce complex constraints. ([source](https://arktype.io/docs/intro/adding-constraints))
- [Data Schema Definitions](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-definitions.md) — Enables the definition of type-safe validation schemas using native TypeScript syntax. ([source](https://arktype.io/docs/intro/your-first-type))
- [Transformation Validators](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-validation/data-type-validation/transformation-validators.md) — Processes data through a sequence of morphs to change its form after passing validation. ([source](https://arktype.io/docs/expressions))
- [Data Transformation Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/data-transformation-pipelines.md) — Transforms input values through a sequence of validation and modification steps before producing a final typed output.
- [Object Schema Definitions](https://awesome-repositories.com/f/software-engineering-architecture/object-schema-definitions.md) — Provides utilities for defining complex object structures and their properties for runtime validation. ([source](https://arktype.io/docs/objects))
- [Primitive Type Schemas](https://awesome-repositories.com/f/software-engineering-architecture/primitive-type-schemas.md) — Defines schemas for basic primitive types including boolean, bigint, symbol, null, and undefined. ([source](https://arktype.io/docs/primitives))
- [Schema Type Manipulations](https://awesome-repositories.com/f/software-engineering-architecture/schema-type-manipulations.md) — Provides utilities to pick, omit, and merge properties of existing schemas to create new derived type definitions. ([source](https://arktype.io/docs/keywords))
- [Type-Safe Data Transformation Toolsets](https://awesome-repositories.com/f/software-engineering-architecture/type-safe-data-transformation-toolsets.md) — Implements a system for morphing and piping data through validation steps to produce structured, type-safe outputs.
- [Schema-Driven Type Inference](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/schema-driven-type-inference.md) — Generates runtime validation logic directly from TypeScript type definitions to ensure a single source of truth.
- [Branded Types](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/schema-driven-type-inference/branded-types.md) — Attaches unique type-level symbols to validated data to distinguish verified values from raw inputs at compile time.
- [Schema Orchestration](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/static-type-checking/typescript-type-synthesis/schema-orchestration.md) — Acts as a schema orchestrator managing recursive types, branded types, and complex type compositions with runtime enforcement.
- [Class Instance Validation](https://awesome-repositories.com/f/software-engineering-architecture/class-property-validation/class-instance-validation.md) — Constrains types to specific classes using instance checks during runtime validation. ([source](https://arktype.io/docs/objects))
- [Function Signature Validation](https://awesome-repositories.com/f/software-engineering-architecture/function-signature-validation.md) — Defines functions with runtime-validated parameters and return types, supporting defaults and variadic arguments. ([source](https://arktype.io/docs/blog))
- [Recursive Type Resolution](https://awesome-repositories.com/f/software-engineering-architecture/generic-type-definitions/generic-type-resolution/recursive-type-resolution.md) — Manages named type references and self-referential structures through a resolution space for complex schema definitions.
- [Validation Result Sets](https://awesome-repositories.com/f/software-engineering-architecture/middleware/custom-middleware-implementations/output-validators/validation-result-sets.md) — Returns the transformed result or a structured error collection after checking input against a schema. ([source](https://arktype.io/docs/traversal-api))
- [Schema-to-Type Mappers](https://awesome-repositories.com/f/software-engineering-architecture/model-import-mappings/json-to-model-mappers/schema-to-type-mappers.md) — Constrains runtime schemas to match pre-defined TypeScript types to provide autocomplete and mismatch errors. ([source](https://arktype.io/docs/declare))
- [Regular Expression Validations](https://awesome-repositories.com/f/software-engineering-architecture/regular-expression-validations.md) — Validates that data matches a specified regular expression pattern at the type level. ([source](https://arktype.io/docs/blog))
- [Allowed Value Validations](https://awesome-repositories.com/f/software-engineering-architecture/runtime-value-validation/allowed-value-validations.md) — Restricts values to a predefined set of allowed primitives, symbols, or objects. ([source](https://arktype.io/docs/expressions))
- [Schema Structural Comparators](https://awesome-repositories.com/f/software-engineering-architecture/schema-structural-comparators.md) — Analyzes types to determine if they are identical, overlapping, or in a subtype relationship. ([source](https://arktype.io/docs/type-api))
- [String Validation and Normalization](https://awesome-repositories.com/f/software-engineering-architecture/string-validation-and-normalization.md) — Morphs input strings into normalized formats or parses them into Date, Number, or URL instances. ([source](https://arktype.io/docs/primitives))
- [Runtime Type Introspection](https://awesome-repositories.com/f/software-engineering-architecture/type-definitions/runtime-type-introspection.md) — Enables querying the internal structure of a type to extract references by kind or predicate at runtime. ([source](https://arktype.io/docs/blog/2.2))
- [Regex Type Inference](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/schema-driven-type-inference/schema-type-inference/regex-type-inference.md) — Wraps regular expressions to provide full TypeScript type inference for strings matching the pattern. ([source](https://arktype.io/docs/blog/2.2))
- [Validation Error Customizations](https://awesome-repositories.com/f/software-engineering-architecture/validation-error-customizations.md) — Allows overriding default validation error messages with customizable and localized failure text. ([source](https://arktype.io/docs/blog/2.0))
- [Validator Composition](https://awesome-repositories.com/f/software-engineering-architecture/validator-composition.md) — Integrates compliant external validators into definitions to enable universal composition across ecosystems. ([source](https://arktype.io/docs/blog/2.2))

### Web Development

- [String Format Validators](https://awesome-repositories.com/f/web-development/string-format-validators.md) — Provides built-in validators for common string formats such as emails, UUIDs, URLs, and ISO dates. ([source](https://arktype.io/docs/keywords))
- [String Pattern Validators](https://awesome-repositories.com/f/web-development/string-pattern-validators.md) — Validates strings using regular expressions, including support for typed capture groups. ([source](https://arktype.io/docs/primitives))
