stateset-embedded
The SQLite of commerce operations — an embeddable commerce engine that runs anywhere, with no server to operate and no network hop between your code and your orders.
stateset-embedded is the batteries-included API that combines
stateset-core (domain models),
stateset-db (storage),
stateset-pricing (totals), and
stateset-observability
(metrics/tracing) into one library. Point it at a file and you have a commerce
backend.
Usage
use ;
use dec;
#
Use ":memory:" instead of a path for an ephemeral store — handy in tests.
What You Get
- A wide domain surface reachable from one
Commercehandle — orders, customers, products, inventory, returns, payments, shipments, plus the back office (purchasing, warehouse, manufacturing, quality, finance, traceability) - Money as decimals, never floats —
rust_decimalthroughout - Migrations on open — the schema is created and upgraded for you
- Sync and async —
Commercefor blocking callers,AsyncCommercefor async - Backup and restore — consistent
VACUUM INTOsnapshots with a checksummed manifest, plus portable JSON export/import - Events — outbound webhooks with HMAC signing behind the
eventsfeature
Feature Flags
| Feature | Description | Default |
|---|---|---|
sqlite |
SQLite storage via bundled rusqlite | Yes |
events |
Outbound webhooks with HMAC signing (implies async) |
Yes |
postgres |
Async PostgreSQL storage via sqlx (implies async) |
No |
sqlite-events |
SQLite-backed event queue | No |
vector |
Vector search over embeddings | No |
otel |
OpenTelemetry export via stateset-observability |
No |
async |
Tokio + futures; usually pulled in by events or postgres |
No |
Also Available In
Node.js (@stateset/embedded), Python (stateset-embedded), Ruby
(stateset_embedded), Go, Java, Kotlin, Swift, C#/.NET, PHP, and WASM — all over the
same engine.
Prefer a single Rust dependency? Use
stateset-sdk. Need HTTP? See
stateset-http.
License
MIT OR Apache-2.0