On this page

Stamon is a Rust workspace and a Svelte frontend, built into one Docker image.

Crates

CrateDoes
crates/serverThe HTTP API and WebSocket (axum), SQLite storage (sqlx) and background jobs (apalis)
crates/checksCheck types: the CheckConfig enum and one module per type
crates/alertsNotification channels: the ChannelConfig enum and one module per channel
crates/ssl-expReads certificate expiry dates for TLS checks

Server modules

ModuleDoes
routesAPI handlers, nested under /api
auth, extractorsTokens, role checks and request parsing
modelsDatabase queries, one file per table
service, monitorsThe scheduler and worker registration
jobThe check job (job/monitor) and alert delivery (job/alert.rs)
wsThe live updates WebSocket

Database migrations are in crates/server/migrations/ and run on start. A monitor's settings are stored as JSON in one column, so new check types and channels don't need migrations.

How a check runs

  1. A timer fires every second and finds active services whose next run is due.
  2. For each, it schedules the next run and queues a check job in SQLite.
  3. A worker runs the check with the service's timeout. Monitors in a maintenance window are skipped and logged as Maintenance.
  4. The result is evaluated: failures count as Pending until the retries are used up, and invert swaps up and down.
  5. The result is stored, and broadcast on /ws to open dashboards.
  6. On a confirmed change (down, or back up), one alert job is queued per channel, and delivered with retries.

Frontend

frontend/ is SvelteKit with the static adapter, Tailwind and shadcn-svelte components. The server serves the built files from ASSETS_PATH and falls back to 404.html for client-side routes. The frontend talks to the server through /api and /ws.