Available SDKs
TypeScript / JavaScript
@structbuild/sdk runs in Node 18+, Bun, Deno, Cloudflare Workers, and every evergreen browser. Dual-published ESM/CJS, zero polyfills.Any other language
The REST and websocket protocols are language-agnostic. Use any HTTP and WebSocket client; the type definitions in the OpenAPI and AsyncAPI specs are public.
What’s included
REST client
Namespaced access to every endpoint with typed parameters and responses.
Rooms WebSocket
Typed
subscribe and on per room, with auto-reconnect, replay, and keepalive.Alerts WebSocket
Per-event typed filters sharing the same connection primitives.
JWT public key auth
Authenticate end users with their own JWTs. Safe to ship in the browser.
Pagination helper
Iterate any cursor-paginated endpoint with an async generator.
Typed errors
HttpError, TimeoutError, NetworkError, WebSocketError, and friends.Webhook management
Create, list, rotate, and delete webhook subscriptions from code.
Retries and hooks
Built-in exponential backoff and
onRequest / onResponse lifecycle hooks.At a glance
Why use the SDK?
| Raw HTTP / WebSocket | TypeScript SDK | |
|---|---|---|
| Types | Hand-rolled or generated from OpenAPI | Generated, shipped, versioned with the package |
| Auth | Set headers / query params manually | apiKey / jwt / getJwt config fields |
| Pagination | Loop on pagination_key yourself | Async iterator per endpoint |
| Reconnects | Exponential backoff yourself | Built in, with auto-replay of subscriptions |
| Retries | Implement around fetch | Configurable retry block with Retry-After support |
| Errors | Parse status codes and bodies | Typed error hierarchy with instanceof checks |
| JWT rotation | Reconstruct URL on every reconnect | Pass getJwt, the SDK handles the rest |
Next steps
- Getting Started: install and instantiate the client.
- Configuration: timeouts, retries, hooks, custom base URL.
- Authentication: secret keys and JWT public-key flow.
- REST, Rooms WS, Alerts WS.