Weft runs on Bun. If you don't have it yet, the install is a one-liner:
curl -fsSL https://bun.sh/install | bashYou'll need Bun 1.3.13 or later. Verify with bun --version.
Most projects should start here. Add Weft as a dependency and use the engine directly in your code.
bun add @lostgradient/weftThat's it. No Docker, no separate server process, no gRPC. You import Engine and MemoryStorage (or BunSQLiteStorage) and start writing workflows.
import { Engine, MemoryStorage } from '@lostgradient/weft';
const engine = new Engine({ storage: new MemoryStorage() });For production, swap in SQLite-backed storage so your checkpoints survive process restarts:
import { Engine } from '@lostgradient/weft';
import { SQLiteStorage } from '@lostgradient/weft/storage/sqlite';
const engine = new Engine({
storage: new SQLiteStorage('./weft.db'),
});The database file is created automatically. No migrations to run.
For larger deployments, build a standalone binary with the Weft engine, server, and your workflow code in one artifact. This is useful when you want REST API endpoints, WebSocket worker connections, and application logic with no runtime dependencies on the target machine.
bun run build:binaryThe build script (scripts/build-binary-main.ts) bundles the Bun runtime, the Weft engine, and your workflows. For cross-compilation targets, see the script's Bun --target options.
Weft produces standalone binaries for these targets:
darwin-arm64(macOS Apple Silicon)darwin-x64(macOS Intel)linux-x64linux-arm64windows-x64
Cross-compilation works from any OS. A single CI pipeline can produce all five binaries:
bun build --compile --target=bun-darwin-arm64 src/cli-main.ts --outfile dist/weft-darwin-arm64
bun build --compile --target=bun-linux-x64 src/cli-main.ts --outfile dist/weft-linux-x64
bun build --compile --target=bun-windows-x64 src/cli-main.ts --outfile dist/weft-windows-x64.exeThe compiled binary includes the Bun runtime (with SQLite, HTTP server, and WebSocket built in), the Weft engine and server code, and default configuration. It does not include native bindings for optional peers — lmdb, @libsql/client, and @opentelemetry/api — install those separately if you use Turso, LMDB, or OpenTelemetry.
With Weft installed, you're ready to write your first workflow. Head to the Hello World guide.