SQLite / Turso Storage
Lightweight local and edge-compatible distributed storage
SQLite / Turso Storage
The @stepflowjs/storage-sqlite adapter provides a lightweight storage backend using SQLite. It supports both local SQLite files and distributed SQLite via Turso (libSQL).
Installation
pnpm add @stepflowjs/storage-sqliteUsage
Local SQLite
import { Stepflow } from "@stepflowjs/core";
import { SqliteStorageAdapter } from "@stepflowjs/storage-sqlite";
const stepflow = new Stepflow({
storage: new SqliteStorageAdapter({
url: "file:local.db",
}),
});Turso (Distributed SQLite)
import { Stepflow } from "@stepflowjs/core";
import { SqliteStorageAdapter } from "@stepflowjs/storage-sqlite";
const stepflow = new Stepflow({
storage: new SqliteStorageAdapter({
url: "libsql://your-db-name.turso.io",
authToken: process.env.TURSO_AUTH_TOKEN,
}),
});Configuration Options
| Option | Type | Description |
|---|---|---|
url | string | Database URL (file:path for local, libsql://url for Turso) |
authToken | string | Auth token for Turso (optional for local) |
Features
- Lightweight: Minimal overhead, perfect for small to medium workloads.
- Edge Compatible: Works seamlessly with Turso for globally distributed workflows.
- Single File: Local SQLite uses a single file for easy backups and portability.
- Automatic Migrations: Automatically creates tables and indexes on startup.
Environment Variables
TURSO_URL=libsql://your-db-name.turso.io
TURSO_AUTH_TOKEN=your-auth-token