# Framework adapters

Preserve framework routes and errors while sending the same endpoint measurements.


Use the browser SDK for sessions, replay and Web Vitals, and the server adapter for API requests. React, Vue and Svelte browser applications use the same browser SDK; their server frameworks need a server entry point as well.

## Express and Fastify

Initialize `@everock/sdk/node` once before starting the server. Keep your existing response and error handlers.

```ts title="Express"
import { requestHandler, errorHandler } from '@everock/sdk/express';

app.use(requestHandler());
// Register your routes here.
app.use(errorHandler());
// Your application's final error handler follows.
```

```ts title="Fastify"
import { instrumentFastify } from '@everock/sdk/fastify';

instrumentFastify(app); // Before registering routes.
```

Fastify preserves route templates such as `/orders/:id`. Repeated calls to `instrumentFastify` on the same instance do not add duplicate hooks.

## SvelteKit and Astro

Initialize the Node SDK once in the server process, then wrap the request lifecycle:

```ts title="SvelteKit: src/hooks.server.ts"
import { svelteKitHandle } from '@everock/sdk/frameworks';
export const handle = svelteKitHandle();
```

```ts title="Astro: src/middleware.ts"
import { astroMiddleware } from '@everock/sdk/frameworks';
export const onRequest = astroMiddleware();
```

These adapters preserve the returned Response and propagate thrown errors. Compose them with existing hooks rather than replacing application middleware. The release checks compile SvelteKit 2 with adapter-node and Astro 5 in standalone Node mode, start the generated servers and verify route grouping, error counts and response bodies.

## Hono

```ts title="Node"
import { honoMiddleware } from '@everock/sdk/frameworks';
app.use('*', honoMiddleware());
```

For Workers, initialize `@everock/sdk/edge` and import the middleware from `@everock/sdk/frameworks/edge`. It uses the execution context's `waitUntil` when available. Handled HTTP failures provide status evidence; a custom error handler must explicitly capture an exception if its stack is needed.

## Nuxt with Nitro 2

```ts title="server/plugins/everock.ts"
import { instrumentNitro } from '@everock/sdk/nitro';
export default defineNitroPlugin((app) => instrumentNitro(app));
```

Initialize the Node SDK separately before serving traffic. The release checks build Nuxt 4 with Nitro 2's Node server preset and send requests to its compiled server. Nitro 3 and edge presets are not certified by this integration; use an appropriate Fetch wrapper and verify the actual deployment.

## Verify the connection

Make a successful request and an intentional test failure. Check their component, environment, release and normalized route in Everock. A connected repository or installed package alone does not prove telemetry is arriving. Browser-only measurements are unavailable for a pure API.
