Prerequisites
Before installing Runner, ensure you have the following:| Requirement | Minimum | Notes |
|---|---|---|
| Node.js | 18.x | Enforced by package.json#engines.node |
| TypeScript | 5.6+ (recommended) | Required for typed DX and examples |
| Package manager | npm / pnpm / yarn / bun | Any modern package manager works |
fetch runtime | Built-in or polyfilled | Required for tunnel clients |
If you use the Node-only package (
@bluelibs/runner/node) for durable workflows or HTTP tunnel servers, stay on a supported Node LTS line.Basic installation
Install Runner using your preferred package manager:Platform-specific installation
Runner works across Node.js, browsers, and edge runtimes. Choose the import based on your platform:Universal (Node, Browser, Edge)
For code that runs anywhere:- Core runtime (tasks, resources, middleware, events, hooks)
- Reliability middleware (retry, timeout, cache, circuit breaker, rate limit)
- HTTP tunnel clients (requires
fetch) - Serialization utilities
Node.js only
For Node-specific features like durable workflows and HTTP tunnel servers:/node import includes:
- Async Context: Per-request state using
AsyncLocalStorage - Durable Workflows: Persistent, crash-recoverable async logic
- HTTP Tunnel Server: Expose tasks and events over HTTP
Browser/Edge
For browser or edge runtimes, use the standard import:Optional dependencies
Runner includes optional peer dependencies for specific features:For durable workflows (Node only)
For message queue integration (Node only)
For file uploads in HTTP tunnels (Node only)
These dependencies are optional. Runner will work without them unless you use the specific features that require them.
Schema validation
For runtime validation of inputs and outputs, install a schema library:{ parse: (value: unknown) => T }. Zod is the most popular choice.
Verification
Verify your installation by creating a simple test file:test.ts
Development tools
For enhanced development experience, install the Runner Dev CLI:- Scaffolding: Generate new Runner projects
- Introspection: Query your app’s structure via GraphQL
- Runtime inspection: View running apps in a dev UI
TypeScript configuration
For the best experience, ensure yourtsconfig.json includes:
tsconfig.json
Runner is built with strict TypeScript and works best with
strict: true enabled.Next steps
Quick start
Build your first Runner app in 5 minutes
Tasks
Learn about business logic with DI
Resources
Manage singletons with lifecycle
Examples
Explore real-world examples
Troubleshooting
Module resolution errors
If you see errors likeCannot find module '@bluelibs/runner', ensure:
- Runner is listed in your
package.jsondependencies - You’ve run
npm install(or your package manager equivalent) - Your TypeScript configuration includes
moduleResolution: "node"
Type errors with schemas
If Zod schemas don’t infer types correctly:- Ensure you’re using TypeScript 5.6+
- Check that
strict: trueis enabled intsconfig.json - Verify Zod is installed:
npm list zod
Node-only features in browser
If you see errors importing/node features in a browser:
- Use conditional imports based on your environment
- Ensure your bundler (Webpack, Vite, etc.) respects the
exportsfield inpackage.json - Check that you’re not importing Node-only features in universal code