Slap it in a bucket! Use object storage as a database.
Slap provides Elixir bindings for SlateDB, and services built on them:
- a Durable Streams server that passes the official conformance suite
- partitioned key-value (KV) storage with conditional writes and ordered scans
- file storage with metadata, conditional replacement, and crash-safe cleanup; small files are stored in KV, which saves object-store PUTs
- Yjs documents for collaborative editing, with replication and presence across nodes
The services are designed to be embedded in your existing application. Each service can run across several nodes, with a choice of placement strategies and failover.
Warning
This is new, experimental data storage software. Bugs may cause data loss. APIs may change. Keep independent backups and evaluate carefully before use in production. Review and contribute to the Jepsen test suite to expand failure coverage and build confidence in data safety. Talk to your doctor about whether or not Slap is right for you.
SlateDB is an embedded log-structured merge-tree key-value engine. It stores its write-ahead log and sorted string table files in object storage (S3, Google Cloud Storage, Azure Blob Storage, or compatible services such as Tigris). A store is where SlateDB keeps its data; the Elixir binding also supports local directories and memory.
SlateDB batches writes to limit PUT requests and periodically flushes its in-memory write-ahead log for durability. A shorter flush interval makes writes durable sooner but uses more PUT requests. See write and flush behavior. In-memory block caches, compressed sorted string tables, Bloom filters, and an optional local disk cache reduce GETs, read latency, and request cost. See caching design.
SlateDB permits one writer per database. Other processes can read concurrently, and a separate process can compact it. If another process opens the database for writing, SlateDB fences the previous writer: the new writer uses conditional writes to advance an epoch in the manifest and claim a write-ahead log position. Any later write from the previous process fails. (The object store must honor conditional writes.) See SlateDB's writer protocol.
Slap uses multiple SlateDB databases as shards, each with its own writer. Writes to different shards can run in parallel, increasing throughput. Slap assigns each shard to one node and routes Streams and KV requests to its owner. SlateDB's fencing protects against nodes disagreeing about ownership. KV keeps each partition's rows on one shard; Streams keeps paths in the same placement group on one shard.
Applications can depend on individual server libraries or on slap, which
includes all seven:
| Package | Provides | Hex |
|---|---|---|
slap_streams |
A Durable Streams server, with HTTP, long polling, and SSE. | |
slap_kv |
Partitioned key-value storage with conditional writes, ordered scans, and an HTTP API. | |
slap_files |
File storage. Small bodies go in KV records, which saves object-store PUTs; larger ones go in object storage. | |
slap_yjs |
Yjs documents, with replication and presence across nodes. |
The services are built on these packages, which you can also use directly:
| Package | Provides | Hex |
|---|---|---|
slap_slatedb |
Elixir bindings for SlateDB: reads, writes, transactions, durability subscriptions, and object access. | |
slap_cluster |
Placement, routing, and failover for SlateDB shards across nodes. | |
slap_snapshot_log |
An append-only log with snapshots that replace its prefix. Each slap_yjs document is a snapshot log. |
slap installs them together:
| Package | Provides | Hex |
|---|---|---|
slap |
All Slap server libraries, and Slap, which starts the services you select. |
slap_inspect browses the data of a running cluster. It is installed
separately and does not depend on the server libraries:
| Package | Provides | Hex |
|---|---|---|
slap_inspect |
A read-only TUI and CLI for browsing Slap data. |
Requires Elixir 1.18 or later and Erlang/OTP 26.2 or later.
Start with the getting started notebook to try SlateDB, Streams, snapshot logs, Yjs, KV, and files from Elixir. It uses in-memory storage and runs in Livebook or IEx.
In an application, add slap to your dependencies and start the services you
need under your supervisor:
children = [
{Slap, store: {:url, "s3://bucket/prefix"}, streams: [], kv: [], files: []}
]Use store: :memory to run without object storage. For S3, set AWS_REGION
and credentials (such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY)
in the environment. See the application setup
for dependencies and options, and the slap_slatedb README for other
object stores.
To try the Streams and KV HTTP APIs, run
examples/server.exs; the standalone server
guide shows how. The HTTP routers don't
authenticate requests; put your own authentication in front.
The kitchen sink demo runs every service with changing in-memory data and prints Slap Inspect commands to browse it.
The Exploring Slap's internals notebook (run in Livebook) traces writes, displays stored data, and demonstrates shard recovery. The architecture guide explains the package and service dependencies.
These workflows run the benchmarks in GitHub Actions weekly and on each push
to main that changes the code they measure; start them from the Actions tab
to run them on another branch:
- SlateDB benchmarks measure in-memory binding overhead and durable operations against RustFS, with and without added network latency.
- Durable Streams benchmarks run
the official Durable Streams benchmarks against Slap and the official Caddy
server on the same runner. Run them locally with
just streams-bench; see the server development guide.
Results appear in each run's job summary; a run on main also pushes them to
the gh-pages branch, which GitHub Pages serves as charts of every run on
main:
- SlateDB: https://mjrusso.github.io/slap/dev/bench/
- Durable Streams: https://mjrusso.github.io/slap/dev/streams-bench/
Shared runners are noisy, so expect non-trivial variance between runs.
To measure HTTP append throughput and latency on this checkout, see Streams load. The store's sustained PUT rate limits the shard count and flush interval, so run it on the intended store before sizing a deployment.
Other scripts measure:
- SlateDB storage and shard behavior
- Stream append latency and read scaling
- Stream storage reclamation
- KV partition writers
- Inline versus object file bodies
The Jepsen suite runs concurrent operations against five Slap nodes that share a RustFS store, while it injects network partitions, process kills, pauses, and object-store faults. It checks Streams, KV, Files, snapshot logs, and Yjs for lost or duplicated acknowledged writes and for consistency violations. To run it in GitHub Actions, start the Jepsen workflow from the Actions tab. It runs every combination of the five workloads, two placement strategies (object leases and distributed), and four faults: 40 jobs, each running two 120-second trials.
With object leases, the checkers require every read to see each write that was acknowledged before the read started. With distributed placement, a node can serve stale reads during a fault, so the checkers allow stale reads but still require every acknowledged write to be present once the cluster recovers. The Jepsen README lists the checks for each placement.
To run a workload, install Docker with Compose, JDK 21, Leiningen, gnuplot,
Graphviz, and just (the Nix shell provides all but Docker). Then, from the
repository root:
just jepsen-up
just jepsen --workload append --time-limit 120
just jepsen-downThe Jepsen README lists the workloads, fault options, placement guarantees, and where to inspect results.
Each project runs its checks (formatting, compiler warnings, Credo, Dialyzer,
dependency cycles, tests) with mix check; see AGENTS.md.
To set up: nix develop (the flake provides OTP, Elixir, Rust and the Jepsen
tools), then just deps and just check.
The Nix shell sets SLAP_LOCAL_DEPS=1, so the Mix projects use sibling
packages from this checkout. CI and the Jepsen node build set the same
variable. With the variable unset or set to 0, their dependencies use
versioned Hex packages. The Nix shell also sets SLAP_SLATEDB_BUILD=1, which
builds the SlateDB NIF from source (this needs Rust).
RELEASING.md describes how to release the packages to Hex.
Slap is released under the terms of the Apache License 2.0.
Copyright (c) 2026, Michael Russo.
