Skip to content

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.

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":

ApproachComplexityPersistenceQuery capability
JSON fileLowYesNone
DETS (slate)LowYesKey lookup, fold
SQLite/PostgresHighYesFull SQL
MnesiaHighYesTransactions, distribution
  • 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_table callbacks ensure tables are always properly closed
  • Zero external dependencies: Built entirely on OTP's DETS module
  • Erlang target: Runs on the BEAM virtual machine
  • 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.

slate wraps Erlang's DETS module. For details on the underlying storage engine, see the official Erlang DETS documentation.