Fastify
Use the Fastify utility when Zelavis should be mounted as a Fastify plugin inside an existing Fastify application.
Basic usage
Section titled “Basic usage”import Fastify from "fastify";import { Zelavis } from "zelavis";import { nodeAdapter } from "zelavis/adapters/node";import { fastifyPlugin } from "zelavis/fastify";
const app = Fastify();const zelavis = new Zelavis({ adapter: nodeAdapter() });
await app.register(fastifyPlugin(zelavis));await app.listen({ port: 3000, host: "127.0.0.1" });fastifyPlugin(zelavis: Zelavis): FastifyPluginAsyncGood fit
Section titled “Good fit”- Existing Fastify services
- Apps that want Fastify plugins 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.