Skip to main content
The Feathers schema system provides a powerful, type-safe approach to data validation and transformation. It uses JSON Schema for validation and offers seamless integration with TypeBox for TypeScript type inference.

Key Concepts

The schema system consists of three main components:
1

Schema Definition

Define your data structure using JSON Schema or TypeBox. Schemas provide type safety and validation.
2

Validation

Automatically validate incoming data against your schema using AJV validators.
3

Resolvers

Transform and resolve data properties, including virtual properties and secure data handling.

Installation

Install the required packages:

Basic Schema Definition

Using JSON Schema

Define schemas using standard JSON Schema format:

Using TypeBox

TypeBox provides a more TypeScript-friendly API:

Schema Validation

Schemas can automatically validate and coerce data:

Query Syntax

Create schemas for Feathers query syntax with operators like $gt, $lt, $in:

Type Inference

The schema system provides full TypeScript type inference:

Schema Extension

Extend existing schemas to create new ones:

Next Steps

Data Validation

Learn how to validate data in hooks and services

Schema Resolvers

Transform data with resolvers and virtual properties