JavaScript SDK
The official JavaScript/TypeScript SDK for Ironflow, organized as a monorepo of specialized packages published under the @ironflow organization on npm. All packages are public and install without authentication.
For building Ironflow and the SDKs from source, see the Local Development guide.
Packages
Section titled “Packages”| Package | Use Case | Environment |
|---|---|---|
@ironflow/browser | Real-time subscriptions, workflow triggers, event emission | Browser |
@ironflow/node | Workers, serve handlers, step execution | Node.js |
@ironflow/core | Shared types, schemas, utilities | Both |
@ironflow/langgraph | LangGraph checkpoint saver — durable agent state backed by entity streams | Node.js |
Which Package Should I Use?
Section titled “Which Package Should I Use?”Building a Web Application
Section titled “Building a Web Application”Use @ironflow/browser for:
- Subscribing to real-time events
- Triggering workflows from the frontend
- Monitoring run status
- Emitting events
npm install @ironflow/browserimport { ironflow } from '@ironflow/browser';
ironflow.configure({ serverUrl: 'https://ironflow.example.com' });
// Subscribe to eventsconst sub = await ironflow.subscribe('events:order.*', { onEvent: (event) => console.log('Order:', event),});
// Invoke a functionconst run = await ironflow.invoke('process-order', { data: { orderId: '123' },});Building a Backend Service
Section titled “Building a Backend Service”Use @ironflow/node for:
- Defining functions
- Creating serverless handlers (push mode)
- Running long-lived workers (pull mode)
- Executing durable steps
npm install @ironflow/nodePush Mode (Serverless):
import { serve, ironflow } from '@ironflow/node';
const processOrder = ironflow.createFunction( { id: 'process-order', triggers: [{ event: 'order.placed' }] }, async ({ event, step }) => { const result = await step.run('process', async () => { return { processed: true }; }); return result; });
// Next.js App Routerexport const POST = serve({ functions: [processOrder] });Pull Mode (Worker):
import { createWorker, ironflow } from '@ironflow/node';
const worker = createWorker({ serverUrl: 'http://localhost:9123', functions: [processOrder], maxConcurrentJobs: 10,});
await worker.start();Using Types and Utilities
Section titled “Using Types and Utilities”@ironflow/core is automatically included as a dependency of both browser and node packages. You typically don’t need to install it directly, but you can import types and utilities from it:
import type { Run, IronflowEvent, FunctionConfig } from '@ironflow/core';import { RunStatusSchema, isRetryable } from '@ironflow/core';Execution Modes
Section titled “Execution Modes”The SDK supports two execution modes:
| Mode | Description | Best For |
|---|---|---|
| Push | Ironflow sends HTTP requests to your endpoint | Serverless (Vercel, Lambda), short tasks |
| Pull | Your worker connects via gRPC and pulls jobs | Long-running tasks, no timeout limits |
Both modes use the same function definition syntax. See Execution Modes for details.
Quick Links
Section titled “Quick Links”- Browser Package Reference - Full API for browser client
- Node Package Reference - Workers, serve handlers, step primitives
- Core Package Reference - Types, schemas, utilities
- Step Primitives Guide - run, sleep, waitForEvent, parallel, map
- Getting Started - Emit events, projections, and time-travel in 5 minutes
Requirements
Section titled “Requirements”- Node.js 20+ for
@ironflow/node - Modern browsers (Chrome 80+, Firefox 75+, Safari 13.1+, Edge 80+) for
@ironflow/browser