Skip to main content
Nest runs on Express by default, so Corsair reuses the Express adapter, with no dedicated Nest adapter. Mount it as middleware in main.ts, before Nest’s router, and Corsair claims one base path. Everything else follows Nest’s grain. Register the corsair instance as a provider and inject it wherever you read integration data.

Install

The Express adapter ships in core corsair. Add a plugin package per service you integrate:

Create the instance

Build the instance once. The handler and your read/write code both import it.
corsair.ts
The handler and every .db / .api call on this page import this corsair. multiTenancy: true is what makes corsair.withTenant(id) available, and a tenant.github.* call resolves to the github() entry here. Add a service by installing its @corsair-dev/* package and dropping it into plugins. Database choices and the Hub keys are in Quick Start.

Mount the handler

The adapter reads the raw stream itself, so no express.json() and no body-parser wiring. Mount one line during bootstrap.
main.ts
./corsair is your createCorsair({ ... }) instance. See Getting Started if you haven’t built it yet.

Resolve the tenant

Corsair only needs the tenant id, and your own auth produces it. A Guard populates request.user the way it already does in your app; read it off the request and pass the id to withTenant().
getTenantId(req) is your own code that reads the signed-in user from your auth; it can return any stable id.

Read and write

The handler serves Hub delivery; your business logic reads and writes through the same instance. Provide it once, then inject it, and the corsair instance becomes a first-class Nest dependency.
corsair.module.ts
issues.controller.ts
Entity fields live on .data in camelCase. Reads come from .db; creates and updates go through .api and land back in the same rows. See Dashboards for the full pattern.

Connect a tenant

Nest is a backend, so use the vanilla client from your frontend, a worker, or a script to check connection status and mint connect links against the route above.
1

Create the client

corsair-client.ts
createCorsairClient is a typed fetch wrapper over the management API, no React required. Use it from your frontend, a worker, or a script. Every route is typed against its response. Full surface on the Vanilla Client reference.
2

Read what's connected

connections.ts
connectionStatus.get returns a map of plugin id to connected | missing_credentials | not_connected, so you can show what’s live and what still needs connecting.
3

Mint a connect link

connect.ts
Hub hosts the consent screen and runs the OAuth handshake. When the user returns, the tokens are already encrypted in your own database. You never saw them, and neither did Hub. Swap "github" for any plugin you configured.

Go green

Start the app:
The first request to /api/corsair registers your delivery URL with Hub and turns the App sync dot in the dashboard header green.

Deploy

Deploy the Nest app however you already run it. In production the same /api/corsair route becomes the delivery URL Hub calls, so ensure it’s publicly reachable. The first request re-registers the production URL.

Next

Vanilla client

Every management-API method the client exposes, fully typed.

Build a dashboard

The .db read / .api write pattern in full.

Connect / OAuth

The full connect flow, error codes, and retry.

Multi-tenancy

One flag and every user gets their own data and credentials.