Skip to main content
All recipes

SvelteKit

CodeServer hooksSvelte

Create the handle hook in hooks.server.ts. It initializes the SDK when the hook is created and measures supported outbound fetch calls. Where the platform exposes waitUntil, it uses that context to flush after a response.

1. Install

Bash
npm install @checkupstream/sdk

2. Wire into hooks.server.ts

src/hooks.server.ts
import { checkUpstreamHandle } from "@checkupstream/sdk/integrations/sveltekit";
import { env } from "$env/dynamic/private";

const sdkKey = env.CHECKUPSTREAM_SDK_KEY;
if (!sdkKey) throw new Error("Set CHECKUPSTREAM_SDK_KEY before starting the app");

export const handle = checkUpstreamHandle({
  sdkKey,
});

Continue your setup

Check runtime availability and credentials before deploying an integration.