API Server
Type-safe API server with JSON schema validation.
With Fastify, using a JSON schema to validate the inputs and outputs makes the requests have 10-20% more throughput 1. And using our own define
and procedure
functions we can use the same schema to provide type safety on the client side and on the server side.
Under the hood, fastify uses Ajv to validate the schema at runtime, and we use json-schema-to-ts to obtain TypeScript types from the schemas.