Node.js & Web SDK
Use @aerostack/sdk for server-side code: Cloudflare Workers, Node.js, and Bun. This is the full server-side SDK with access to database, cache, AI, queue, storage, and realtime broadcast.
Install
Section titled “Install”npm install @aerostack/sdkInitialize
Section titled “Initialize”import { AerostackClient } from '@aerostack/sdk'
const client = new AerostackClient({ projectId: process.env.PROJECT_ID, apiKey: process.env.API_KEY, baseUrl: 'https://api.aerostack.dev/v1',})
const { sdk, realtime } = clientIn a Cloudflare Worker, the SDK is typically initialized from env bindings:
// Using the module-style Workerimport { AerostackClient } from '@aerostack/sdk'
export default { async fetch(request, env) { const { sdk } = new AerostackClient({ projectId: env.PROJECT_ID, apiKey: env.API_KEY, })
// Use sdk.db, sdk.cache, etc. }}Available modules
Section titled “Available modules”| Module | Description |
|---|---|
sdk.db | SQL queries |
sdk.cache | Key-value cache |
sdk.storage | File upload and object storage |
sdk.ai | LLM completions and embeddings |
sdk.queue | Background job queue |
sdk.search | Vector similarity search |
sdk.socket | Realtime broadcast (server → clients) |
sdk.secrets | Secret retrieval |
sdk.auth | Server-side token verification |
Next steps
Section titled “Next steps”- Authentication — verify tokens, get user context
- Database — query, insert, batch
- Realtime — server-side broadcast
- Full API Reference — all methods