Fastifyv5
v5
Beta Leave feedback Contribute
Fastify is a fast and low overhead web framework for Node.js.
The Fastify plugin for Hey API generates route handlers from your OpenAPI spec, fully compatible with all core features.
Collaborators
Section titled “Collaborators”Features
Section titled “Features”- Fastify v5 support
- seamless integration with
@hey-api/openapi-tsecosystem - type-safe route handlers
- minimal learning curve thanks to extending the underlying technology
Installation
Section titled “Installation”In your configuration, add fastify to your plugins and you’ll be ready to generate Fastify artifacts. 🎉
export default { input: 'hey-api/backend', // sign up at app.heyapi.dev output: 'src/client', plugins: [ // ...other plugins 'fastify', ],};Output
Section titled “Output”The Fastify plugin will generate the following artifacts, depending on the input specification.
Route Handlers
Section titled “Route Handlers”Route handlers are generated from all endpoints. The generated interface follows the naming convention of SDK functions.
const fastify = Fastify();const serviceHandlers: RouteHandlers = { createPets(request, reply) { reply.code(201).send(); }, listPets(request, reply) { reply.code(200).send([]); }, showPetById(request, reply) { reply.code(200).send({ id: Number(request.params.petId), name: 'Kitty', }); },};fastify.register(glue, { serviceHandlers });export default { input: 'hey-api/backend', // sign up at app.heyapi.dev output: 'src/client', plugins: [ // ...other plugins 'fastify', ],};You can view the complete list of options in the UserConfig interface.
Examples
You can view live examples on StackBlitz or on GitHub.