Install
The adapter ships in core. Each integration is its own package. Add one per service you connect.@corsair-dev/* package. The full catalog with exact ids is in Plugins.
Create the instance
Build the instance once. The handler and your read/write code both import it.corsair.ts
.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
src/pages/api/corsair/[...path].ts
../../../server/corsair is your createCorsair({ ... }) instance. See Getting Started if you haven’t built it yet.
Resolve the tenant
Every read and write is scoped to a tenant id, whatever stable id identifies the current user or org. A server-rendered page hasAstro.request and, if you use one, your session, so resolve the id there (however your auth works) and pass it to withTenant.
Read and write
The.db namespace reads your own database, so a server-rendered page can query it in the frontmatter fence and the results land in the initial HTML. Because the page ran on the server, no token or query ever reaches the browser.
src/pages/issues.astro
.api. From a form POST or an API route, call e.g. await tenant.github.api.issues.create({ owner: 'acme', repo: 'app', title: '…' }). Corsair upserts the response, so the next server render already shows it. Entity fields live on .data in camelCase.
Connect a tenant
Connecting is interactive, but it doesn’t need a UI framework. Use the framework-agnostic vanilla client from a small<script> in an .astro page. It mints the connect link and reports status, no island required.
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
"github" for any plugin you configured.Go green
/api/corsair registers your delivery URL with Hub and turns the App sync dot in the dashboard header green.
Deploy
Deploy with your usual Astro adapter (@astrojs/node, @astrojs/vercel, and so on). The route and any prerender = false page run on the server. In production, /api/corsair at your deployed origin is the delivery URL Hub calls.
Next
Build a dashboard
The full read-
.db, write-.api pattern behind the example above.Connect / OAuth
The full connect flow, error codes, and retry.
Use with an agent
Give an agent the Corsair tools and let it call any endpoint.
Multi-tenancy
One flag and every user gets their own data and credentials.