Skip to content
Strata is pre-1.0. APIs, protocol, and storage format may change.

strata_server

strata_server combines mist (HTTP/WebSocket), beryl (channels and presence), shelf (persistence), and lattice CRDT primitives into the Strata server runtime.

Target: Erlang only.

Terminal window
just server

or, from the package, gleam run. Configuration comes from environment variables; see Operations.

  • StrataConfig — token, port, WebSocket path, storage directory, static and admin directories, rate limits, and admin broadcast interval.
  • default_config() — reads the environment and fills in development defaults.
  • run(config) — starts the HTTP server, channels, and storage, and blocks.
FieldDefaultPurpose
tokendev-strata-tokenShared WebSocket and admin secret
port8000HTTP listen port
websocket_path/socket/websocketWebSocket upgrade path
storage_dirdataDETS data directory
static_dirNoneOptional application asset directory
admin_dirSome("priv/admin")Optional admin SPA directory
admin_status_interval_ms2000Admin update interval
rate_limit_messages_per_second20Sustained limit for each socket
rate_limit_messages_burst20Burst capacity
allowed_origins[]Exact origins; empty permits all

default_config reads the documented environment variables. It does not read environment variables for port, websocket_path, or admin_status_interval_ms. Change those fields before you call run.

run stops with an assertion failure if storage, supervision, or the HTTP listener cannot start. It does not return a startup error.

  • strata_server/auth?token= extraction and constant-time verification on upgrade.
  • strata_server/document_channel — one beryl channel per doc:<id> topic; merges deltas, handles serialized create/delete, and broadcasts to other sockets.
  • strata_server/admin_channel — the read-only admin:status channel.
  • strata_server/store: in-memory documents, deletion parent links, and tombstones, with a single shelf checkpoint for documents and parents. See Composing Documents.

The store flushes to DETS every five seconds. See Durability and Recovery.

Source: packages/strata_server.