Skip to content

Fastify

Use the Fastify utility when Zelavis should be mounted as a Fastify service inside an existing Fastify application.

import Fastify from "fastify";
import { Zelavis } from "zelavis";
import { nodeAdapter } from "zelavis/adapters/node";
import { fastifyPlugin } from "zelavis/fastify";
const app = Fastify();
const zv = new Zelavis({ adapter: nodeAdapter() });
await app.register(fastifyPlugin(zv));
await app.listen({ port: 3000, host: "127.0.0.1" });
fastifyPlugin(zv: Zelavis): FastifyPluginAsync
  • Existing Fastify services
  • Apps that want Fastify services and hooks around Zelavis
  • Self-hosted deployments using one Fastify process
  • Fastify keeps owning the server lifecycle while Zelavis provides the mounted runtime surface.
  • Zelavis routes continue to respect rootPath, API prefix, and API version from the runtime config.
  • Custom Fastify routes can sit beside Zelavis routes without changing the Zelavis API contracts.