Skip to content

Install the SDK

The platform is consumed through the typed @abeauvois/platform-sdk HTTP client. It works in any TypeScript runtime (Bun, Node, the browser).

Install

Terminal window
bun add @abeauvois/platform-sdk

The package is published to the GitHub npm registry (npm.pkg.github.com). Configure your .npmrc with a token that has read:packages if you are installing outside the monorepo.

Construct a client

The PlatformApiClient composes one sub-client per vertical. Pick the auth mode that fits your runtime:

import { PlatformApiClient } from '@abeauvois/platform-sdk'
// Browser, same-origin — session cookies
const client = new PlatformApiClient({
baseUrl: 'http://localhost:3000',
credentials: 'include',
})
// Cross-service / CLI — bearer token
const client = new PlatformApiClient({
baseUrl: 'http://localhost:3000',
getToken: () => localStorage.getItem('auth_token') ?? undefined,
})

The API issues both session cookies (same-origin web apps) and bearer tokens (CLI, cross-origin). getToken is forwarded to every sub-client so an API key reaches the public read APIs too.

Authenticate

await client.auth.signIn({ email: 'you@example.com', password: 'secret' })
// or
await client.auth.signUp({ email: 'you@example.com', password: 'secret', name: 'You' })

signIn / signUp sync the returned token + cookie to every sub-client automatically, so subsequent calls are authenticated.

Next: run your first job.