Skip to main content
Corsair mounts one route that serves Hub delivery and the management API. In the App Router, use toNextJsHandler.

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 route

app/api/corsair/[[...path]]/route.ts
import { toNextJsHandler } from 'corsair';
import { corsair } from '@/server/corsair';

export const { GET, POST, OPTIONS } = toNextJsHandler(corsair, {
    basePath: '/api/corsair',
});
Pages Router? Export a catch-all API route at pages/api/corsair/[...path].ts and forward req/res through the same toNextJsHandler. The App Router is the supported default.

Run and go green

Start the dev server. On the first request to /api/corsair, your app self-registers its delivery URL and the Hub dashboard header dot turns green. See Delivery URLs.

Hub setup

Create a project, copy keys, reach the green check.

Add a plugin

GitHub, Slack, Linear, and more.