🌐
GitHub
github.com › turkerdev › fastify-type-provider-zod
GitHub - turkerdev/fastify-type-provider-zod · GitHub
import type { ZodTypeProvider } from 'fastify-type-provider-zod'; import { serializerCompiler, validatorCompiler } from 'fastify-type-provider-zod'; import { z } from 'zod/v4'; const app = Fastify(); // Add schema validator and serializer app.setValidatorCompiler(validatorCompiler); app.setSerializerCompiler(serializerCompiler); app.withTypeProvider<ZodTypeProvider>().route({ method: 'GET', url: '/', // Define your schema schema: { querystring: z.object({ name: z.string().min(4), }), response: { 200: z.string(), }, }, handler: (req, res) => { res.send(req.query.name); }, }); app.listen({ port: 4949 });
Author   turkerdev
🌐
npm
npmjs.com › package › fastify-type-provider-zod
fastify-type-provider-zod - npm
October 24, 2025 - import type { ZodTypeProvider } from 'fastify-type-provider-zod'; import { serializerCompiler, validatorCompiler } from 'fastify-type-provider-zod'; import { z } from 'zod/v4'; const app = Fastify(); // Add schema validator and serializer app.setValidatorCompiler(validatorCompiler); app.setSerializerCompiler(serializerCompiler); app.withTypeProvider<ZodTypeProvider>().route({ method: 'GET', url: '/', // Define your schema schema: { querystring: z.object({ name: z.string().min(4), }), response: { 200: z.string(), }, }, handler: (req, res) => { res.send(req.query.name); }, }); app.listen({ port: 4949 });
      » npm install fastify-type-provider-zod
    
Published   Jun 24, 2026
Version   7.0.0
🌐
Fastify
fastify.dev › reference › type-providers
Type-Providers | Fastify
Official Type Provider packages follow the @fastify/type-provider-{provider-name} naming convention. Several community providers are also available. The following inference packages are supported: json-schema-to-ts · typebox · zod · See also the Type Provider wrapper packages for each of the packages respectively: @fastify/type-provider-json-schema-to-ts ·
🌐
GitHub
github.com › turkerdev › fastify-type-provider-zod › issues
Issues · turkerdev/fastify-type-provider-zod
Contribute to turkerdev/fastify-type-provider-zod development by creating an account on GitHub.
Author   turkerdev
🌐
GitHub
github.com › fastify › fastify-type-provider-zod
GitHub - fastify/fastify-type-provider-zod: A Type Provider for Zod · GitHub
A Type Provider for Zod. ... Starting from v0, this library uses Zod’s .encode() / .decode() APIs introduced in Zod 4.1. Because of this change, response serialization is now based on z.output<T> instead of z.input<T>. import type { ...
Author   fastify
🌐
npm
npmjs.com › package › @marcalexiei › fastify-type-provider-zod
@marcalexiei/fastify-type-provider-zod - npm
December 9, 2025 - By combining Zod with Fastify’s type providers, this package bridges the gap between static typing and runtime schema enforcement.
      » npm install @marcalexiei/fastify-type-provider-zod
    
Published   Dec 09, 2025
Version   3.0.0
🌐
npm
npmjs.com › package › @bram-dc › fastify-type-provider-zod
@bram-dc/fastify-type-provider-zod - npm
January 25, 2026 - import type { ZodTypeProvider } from 'fastify-type-provider-zod'; import { serializerCompiler, validatorCompiler } from 'fastify-type-provider-zod'; import { z } from 'zod/v4'; const app = Fastify(); // Add schema validator and serializer app.setValidatorCompiler(validatorCompiler); app.setSerializerCompiler(serializerCompiler); app.withTypeProvider<ZodTypeProvider>().route({ method: 'GET', url: '/', // Define your schema schema: { querystring: z.object({ name: z.string().min(4), }), response: { 200: z.string(), }, }, handler: (req, res) => { res.send(req.query.name); }, }); app.listen({ port: 4949 });
      » npm install @bram-dc/fastify-type-provider-zod
    
Published   Jan 25, 2026
Version   7.0.1
Author   turkerd
🌐
Medium
medium.com › @tomas.gabrs › building-a-fastify-application-with-zod-validation-in-an-nx-monorepo-7c49ed6d77be
Building a Fastify Application with Zod Validation in an NX Monorepo | by Tomas Gabrs @ Tomio | Medium
September 24, 2024 - With Fastify wrapped in the zod-fastify library, we can now integrate the fastify-type-provider-zod library. According to the documentation, we’ll set both the validatorCompiler and serializerCompiler from the Zod provider.
🌐
npm
npmjs.com › package › fastify-zod-openapi
fastify-zod-openapi - npm
app.withTypeProvider<FastifyZodOpenApiTypeProvider>().get( '/', { schema: { querystring: z.object({ jobId: z.string().meta({ description: 'Job ID', example: '60002023', }), }), }, attachValidation: true, }, (req, res) => { if (req.validationError?.validation) { const zodValidationErrors = req.validationError.validation.filter( (err) => err instanceof RequestValidationError, ); console.error(zodValidationErrors); } return res.send(req.query); }, ); app.setErrorHandler((error, _req, res) => { if (error instanceof ResponseSerializationError) { return res.status(500).send({ error: 'Bad response', }); } }); // { // error: 'Bad response'; // } fastify-type-provider-zod: Big kudos to this library for lighting the way with how to create type providers, validators and serializers.
      » npm install fastify-zod-openapi
    
Published   Mar 31, 2026
Version   5.6.1
🌐
Fastify
fastify.dev › reference › typescript
Fastify - Fast and Low Overhead Web Framework
@fastify/type-provider-typebox · And a zod wrapper by a third party called fastify-type-provider-zod · They simplify schema validation setup and you can read more about them in Type Providers page. Below is how to setup schema validation using the typebox, json-schema-to-typescript, and json-schema-to-ts packages without type providers.
Find elsewhere
🌐
UNPKG
unpkg.com › browse › fastify-type-provider-zod@1.1.9 › README.md
UNPKG
# Fastify Type Provider Zod [![NPM Version](https://img.shields.io/npm/v/fastify-type-provider-zod.svg)](https://npmjs.org/package/fastify-type-provider-zod) [![NPM Downloads](https://img.shields.io/npm/dm/fastify-type-provider-zod.svg)](https://npmjs.org/package/fastify-type-provider-zod) ...
🌐
GitHub
github.com › turkerdev › fastify-type-provider-zod › releases
Releases · turkerdev/fastify-type-provider-zod
Request or response schema validation no longer throws a ZodError. Instead, either ResponseSerializationError or FastifyError are thrown. You may need to adjust your fastify error handler in case you were relying on the previous behaviour for handling responses to invalid request payload. Note that version 4.0.0 will slightly change the structure of these errors and also will expose the convenience type guards for handling them.
Author   turkerdev
🌐
CodeSandbox
codesandbox.io › examples › package › fastify-type-provider-zod
fastify-type-provider-zod examples - CodeSandbox
Use this online fastify-type-provider-zod playground to view and fork fastify-type-provider-zod example apps and templates on CodeSandbox.
🌐
Marcalexiei
marcalexiei.github.io › fastify-type-provider-zod
fastify-type-provider-zod
fastify-type-provider-zod · Search · Appearance · Zod Type Provider for Fastify@5 · Getting started · Examples · ✅ · Use Zod schemas to both validate incoming data and infer TypeScript types automatically. 📦 · Serialize outgoing responses via Zod, with option to customize the process ...
🌐
GitHub
github.com › qlaffont › fastify-type-provider-zod2
GitHub - qlaffont/fastify-type-provider-zod2: Fastify Type provider for Zod.
import Fastify from "fastify"; import { serializerCompiler, validatorCompiler, ZodTypeProvider } from "fastify-type-provider-zod2"; import z from "zod"; const app = Fastify() // Add schema validator and serializer app.setValidatorCompiler(validatorCompiler); app.setSerializerCompiler(serializerCompiler); app.withTypeProvider<ZodTypeProvider>().route({ method: "GET", url: "/", // Define your schema schema: { querystring: z.object({ name: z.string().min(4), }), response: { 200: z.string(), }, }, handler: (req, res) => { res.send(req.query.name); }, }); app.listen({ port: 4949 });
Author   qlaffont
🌐
Stack Overflow
stackoverflow.com › questions › 79639406 › how-to-avoid-losing-zod-type-provider-generic-with-fastify-autoload
typescript - How to avoid losing Zod type provider generic with Fastify AutoLoad - Stack Overflow
I'm using Fastify with the fastify-type-provider-zod plugin: const fastify = Fastify().withTypeProvider (); And the fastify-autoload plugin: // This loads all plugins defined...
🌐
GitHub
github.com › samchungy › fastify-zod-openapi
GitHub - samchungy/fastify-zod-openapi: Fastify plugin for zod-openapi · GitHub
app.withTypeProvider<FastifyZodOpenApiTypeProvider>().get( '/', { schema: { querystring: z.object({ jobId: z.string().meta({ description: 'Job ID', example: '60002023', }), }), }, attachValidation: true, }, (req, res) => { if (req.validationError?.validation) { const zodValidationErrors = req.validationError.validation.filter( (err) => err instanceof RequestValidationError, ); console.error(zodValidationErrors); } return res.send(req.query); }, ); app.setErrorHandler((error, _req, res) => { if (error instanceof ResponseSerializationError) { return res.status(500).send({ error: 'Bad response', }); } }); // { // error: 'Bad response'; // } fastify-type-provider-zod: Big kudos to this library for lighting the way with how to create type providers, validators and serializers.
Starred by 123 users
Forked by 16 users
Languages   TypeScript 99.5% | JavaScript 0.5%
🌐
UNPKG
app.unpkg.com › fastify-type-provider-zod@1.1.9 › files › README.md
fastify-type-provider-zod
# Fastify Type Provider Zod [![NPM Version](https://img.shields.io/npm/v/fastify-type-provider-zod.svg)](https://npmjs.org/package/fastify-type-provider-zod) [![NPM Downloads](https://img.shields.io/npm/dm/fastify-type-provider-zod.svg)](https://npmjs.org/package/fastify-type-provider-zod) ...
🌐
GitHub
github.com › topics › fastify-type-provider-zod
fastify-type-provider-zod · GitHub Topics · GitHub
nodejs typescript fastify zod fastify-swagger drizzle-orm fastify-type-provider-zod scalarapireference