Skip to main content
Every Corsair adapter wraps one primitive: managementHandler(corsair) returns a handler with the signature (request: Request) => Promise<Response>. Any framework whose routes speak the Fetch API calls it directly — no adapter needed.

Configure Corsair

corsair.ts
import { createCorsair } from 'corsair';
import { github } from '@corsair-dev/github';

export const corsair = createCorsair({
    plugins: [github({ authType: 'managed' })],
    database: db,
    kek: process.env.CORSAIR_KEK!,
    hub: {
        projectApiKey: process.env.CORSAIR_DEV_API_KEY!,
        signingSecret: process.env.CORSAIR_DEV_SIGNING_SECRET!,
    },
});

Mount the handler

src/routes/api/corsair/[...path]/+server.ts
import { managementHandler } from 'corsair';
import { corsair } from '$lib/server/corsair';

const handler = managementHandler(corsair, { basePath: '/api/corsair' });
export const GET = ({ request }) => handler(request);
export const POST = ({ request }) => handler(request);

Run and go green

On the first request to /api/corsair, your app self-registers its delivery URL with Hub. See Delivery URLs.
Backend not in JavaScript? Corsair’s SDK is TypeScript-only. Integrate over the Hub REST API instead.