Twill DB
An OLTP engine that is embeddable and storage-disaggregated at once. Rust, PostgreSQL wire-compatible.
Twill DB is an OLTP database engine that is two things at the same time: embeddable — it links in-process as a library, at function-call latency, SQLite-style — and storage-disaggregated — durable state lives on object storage, so compute is stateless.
Those two usually pull in opposite directions. The resolution is to keep the engine a library and make its storage backend pluggable, pointing the seam at the network instead of at a local file — rather than putting a server at the boundary. The same engine then runs embedded via FFI, or as a PostgreSQL wire-compatible server. The storage choice is a connection-string scheme, not a rebuild.
Headline properties
- Scale-to-zero — a lifecycle controller cold-starts instances on first connection and tears them down when idle.
- True embeddability — ships as
cdylibandstaticlibbehind a frozen C ABI. - Instant branching — a branch is a cheap LSN pointer over shared immutable layers; writes diverge into a private copy-on-write overlay.
In the engine
MVCC snapshot isolation, crash-safe WAL durability and replay, in-core vector search (a vector(N) type and an HNSW index that branches and scales to zero with the database), engine-native row-level security enforced over MVCC, and an app-grade SQL surface — joins, aggregation, subqueries, CTEs, constraints, and a scalar-function library.
Durability on object storage bottoms out on S3 conditional writes: atomic ordered appends and single-writer fencing, without a separate consensus cluster.
Interfaces
Embedded via bun:ffi or NAPI; over the wire via the Postgres protocol, so existing tooling — PostgREST, Bun.sql, psql, standard pg drivers — connects unchanged. Storage backends: local file, S3, Cloudflare R2, GCS.
Pre-1.0 and under active development.