Orbit SDK

Type-safe from the start. The Orbit SDK wraps every orbit-service management endpoint as a typed TypeScript method. Discriminated unions on HTTP status — no try/catch, no mystery errors. Check the status and the types follow.

Key Design Principles

Never Throws

All API outcomes are returned as discriminated unions on HTTP status code. A 503 status is synthesized when the API is unreachable or times out.

Two Result Types

SdkResult<T> for endpoints returning a body. NoBodyResult for 204-only endpoints. The types prevent checking the wrong status.

Namespaced Modules

11 modules matching the API surface: auth, users, roles, permissions, policies, apiKeys, audit, tenants, featureFlags, modules, oauth2.

Zero Dependencies

Uses Bun's native fetch and AbortController. No runtime dependencies. Stateless — the session token is passed per-call, never stored on the instance.

Login Flows

The SDK supports two authentication flows, depending on the calling context:

FlowStepsUse Case
Two-step login(email, password)memberships(token)exchange(token, slug) orbit-dash (user picks a tenant)
Single-step login(email, password, tenantId) Consuming apps (tenant known upfront)

Pagination

All list methods return PaginatedResult<T> = { data: T[], next_cursor: string | null }. Pass { cursor, limit } in the options to paginate.