Skip to content

SDK reference

@nimbus/sdk wraps common platform features — auth, key/value storage, and scheduled tasks — so you don’t have to call the REST API directly from inside a function.

Terminal window
npm install @nimbus/sdk

A region-local key/value store, replicated asynchronously to every other region.

import { kv } from '@nimbus/sdk';
await kv.set('user:42', { name: 'Ferris' });
const user = await kv.get('user:42');

Verify the session cookie set by Nimbus’s hosted login page.

import { verifySession } from '@nimbus/sdk/auth';
const session = await verifySession(request);

Register a function to run on a cron schedule instead of in response to requests.

functions/cleanup.ts
import { schedule } from '@nimbus/sdk';
export default schedule('0 * * * *', async () => {
// runs once an hour, in one region of Nimbus's choosing
});