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.
Running it
Section titled “Running it”just serveror, from the package, gleam run. Configuration comes from environment
variables; see Operations.
Public surface
Section titled “Public surface”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.
StrataConfig
Section titled “StrataConfig”| Field | Default | Purpose |
|---|---|---|
token | dev-strata-token | Shared WebSocket and admin secret |
port | 8000 | HTTP listen port |
websocket_path | /socket/websocket | WebSocket upgrade path |
storage_dir | data | DETS data directory |
static_dir | None | Optional application asset directory |
admin_dir | Some("priv/admin") | Optional admin SPA directory |
admin_status_interval_ms | 2000 | Admin update interval |
rate_limit_messages_per_second | 20 | Sustained limit for each socket |
rate_limit_messages_burst | 20 | Burst 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.
Internals worth knowing
Section titled “Internals worth knowing”strata_server/auth—?token=extraction and constant-time verification on upgrade.strata_server/document_channel— one beryl channel perdoc:<id>topic; merges deltas, handles serializedcreate/delete, and broadcasts to other sockets.strata_server/admin_channel— the read-onlyadmin:statuschannel.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.