All recipes
Fastify.
CodePluginNode.js
Fastify's plugin system handles SDK initialization on `server.ready()` and graceful flushing on `onClose`. Drop the plugin in once and forget about it.
1. Install.
Bash
npm install @checkupstream/sdk2. Register the plugin.
server.ts
import Fastify from "fastify";
import { checkUpstreamPlugin } from "@checkupstream/sdk/integrations/fastify";
const app = Fastify();
await app.register(checkUpstreamPlugin, {
sdkKey: process.env.CHECKUPSTREAM_SDK_KEY!,
});
app.get("/api/users", async () => fetchUsers());
await app.listen({ port: 3000 });Tip
The plugin auto-flushes on Fastify's `onClose` lifecycle hook, so SIGTERM and graceful shutdowns drain the buffer cleanly without extra code.
Related
Ship reliable upstream.
Drop the SDK in, point it at your project key, and start seeing live upstream telemetry inside the dashboard.