What is slate?
slate is a type-safe Gleam wrapper for Erlang's DETS (Disk Erlang Term Storage). It provides persistent key-value storage backed by files on disk, with a clean Gleam API.
Why slate?
Section titled “Why slate?”DETS is built into OTP — no external database or dependency is needed. slate fills the gap between "serialize to a file" and "add a database dependency":
| Approach | Complexity | Persistence | Query capability |
|---|---|---|---|
| JSON file | Low | Yes | None |
| DETS (slate) | Low | Yes | Key lookup, fold |
| SQLite/Postgres | High | Yes | Full SQL |
| Mnesia | High | Yes | Transactions, distribution |
Key features
Section titled “Key features”- Three table types:
set(unique keys),bag(multiple distinct values per key),duplicate_bag(duplicates allowed) - Automatic persistence: Data survives process crashes and node restarts
- Safe resource management:
with_tablecallbacks ensure tables are always properly closed - Zero external dependencies: Built entirely on OTP's DETS module
- Erlang target: Runs on the BEAM virtual machine
Related projects
Section titled “Related projects”- bravo — Comprehensive ETS (in-memory) bindings for Gleam. Use bravo when you need fast, in-memory storage without persistence.
- shelf — Persistent ETS tables backed by DETS. Combines microsecond in-memory reads with durable disk storage. Built on top of slate.
Learn more about DETS
Section titled “Learn more about DETS”slate wraps Erlang's DETS module. For details on the underlying storage engine, see the official Erlang DETS documentation.