SQLite Adapter
Overview
The SQLite adapter persists data to local database files. It provides durability across process restarts without requiring a running database server, making it a practical choice for development and small production deployments.
Installation
The SQLite adapter lives in a separate package:
npm i @bounda-dev/adapter-sqlite
Supported Features
| Feature | Supported |
|---|---|
| Event Store | Yes |
| Read Model | Yes |
| Policy DLQ | Yes |
| Process Manager DLQ | Yes |
| Scheduling | Yes |
When to Use
- Development — Persistent storage without infrastructure overhead.
- Small production deployments — Single-process applications where a full database server is unnecessary.
- CI environments — Self-contained tests that need persistence.
Configuration
Every SQLite configuration requires a path property pointing to the database file. Bounda creates the file automatically if it does not exist.
Event Store
domain: {
order: {
eventStore: { type: "sqlite", path: "./db/order-events.db" },
},
}
Read Model
read: {
"order-summary": { type: "sqlite", path: "./db/order-summary.db" },
}
Scheduling
domain: {
order: {
scheduling: {
type: "sqlite",
path: "./db/order-scheduler.db",
pollingIntervalMs: 100,
},
},
}
| Option | Type | Description |
|---|---|---|
type | "sqlite" | Adapter type |
path | string | File path for the SQLite database |
pollingIntervalMs | number | How often the scheduler polls for due commands, in milliseconds |
Policy DLQ
domain: {
order: {
policies: {
dlq: { type: "sqlite", path: "./db/order-policy-dlq.db" },
},
},
}
Process Manager DLQ
domain: {
order: {
processManagers: {
dlq: { type: "sqlite", path: "./db/order-pm-dlq.db" },
},
},
}
Complete Example
import type { Config } from "@bounda-dev/config";
export default {
rootDir: "src",
domain: {
order: {
eventStore: { type: "sqlite", path: "./db/order-events.db" },
scheduling: {
type: "sqlite",
path: "./db/order-scheduler.db",
pollingIntervalMs: 100,
},
policies: {
dlq: { type: "sqlite", path: "./db/order-policy-dlq.db" },
},
processManagers: {
dlq: { type: "sqlite", path: "./db/order-pm-dlq.db" },
},
},
},
read: {
"order-summary": { type: "sqlite", path: "./db/order-summary.db" },
"order-catalog": { type: "sqlite", path: "./db/order-catalog.db" },
},
} satisfies Config;
Related
- Adapters Overview — Comparison of all available adapters
- In-Memory — Non-persistent alternative for tests
- PostgreSQL — Production-grade persistent adapter
- Configuration Reference — Full config reference