Overview
@structbuild/sdk is the official TypeScript SDK for the Struct API. It wraps the REST API, the rooms websocket, the alerts websocket, and webhook management in a single, fully-typed client. The SDK is dual-published as ESM and CJS, runs in Node, Bun, Deno, and browsers, and ships with generated types derived directly from the live OpenAPI and AsyncAPI specs.
Source: github.com/structbuild/struct-typescript-sdk
Install
Quickstart
Create an API key
Sign up at struct.to/dashboard, create an organisation, and generate an API key.
What’s included
REST client
Namespaced access to every endpoint: markets, events, trader, holders, order book, series, assets, tags, bonds, search, and webhooks.
WebSocket rooms
Typed
subscribe / on for every room, with auto-reconnect, replay, and keepalive.Alerts
Per-event typed filters for the alerts websocket, sharing the same connection primitives.
JWT public key auth
Authenticate your end users with their own JWTs without shipping
sk_* keys to the browser.Pagination helper
Iterate through any paginated endpoint with a single async generator.
Typed errors
HttpError, TimeoutError, NetworkError, WebSocketError, and friends.Requirements
The SDK targets modern runtimes that support the Fetch API,AbortController, and native WebSocket. That covers Node 18+, Bun, Deno, Cloudflare Workers, and every evergreen browser. No polyfills are required.
Next steps
- Configure the client: see Configuration.
- Browse the REST reference: see REST API.
- Stream live data: see WebSockets.