Something went wrong. Try again.
Experimental AT protocol email hosting
Something went wrong. Try again.
07 — Language & Stack #
| Status | Decided: Go (decision D5, locked 2026-08-24) |
| Depends on | 00-overview |
1. Decision #
Sovrn is written in Go. The deciding factor was library availability for the atproto surface; everything else follows standard Go platform choices.
2. Evidence: what Go gives us off the shelf #
indigo — Bluesky's own Go SDK (Apache-2.0/MIT), actively developed:
| Package | What it covers | Sovrn consumer |
|---|---|---|
atproto/auth/oauth |
Complete OAuth client: PAR submission, PKCE S256, DPoP JWT signing + AS/RS nonce handling, public + confidential clients w/ ES256 signed client attestations, ClientApp/ClientAuthStore session lifecycle incl. concurrent sessions and refresh |
authbroker — this alone eliminates weeks of spec-tracking against a moving profile |
atproto/identity |
Handle→DID→DID-doc→PDS resolution chain with caching directory | identity wrapper |
atcrypto |
Ed25519 / P-256 key parsing, signing, verification (multibase, did-key) | svcverifier (service-auth JWT validation), DPoP proofs |
syntax |
DID/handle/NSID/TID parsing & validation | everywhere |
api/atproto (+bsky) |
Generated lexicon types for com.atproto.* |
watcher, PDS admin calls |
firehose tooling (cmd/tap, rainbow) |
Production-grade jetstream/firehose consumption patterns to crib from | watcher |
ecosystem: goat CLI already in devenv.nix |
scripting/debugging | ops |
Jetstream itself is implemented in Go by Bluesky — reconnect/replay semantics are battle-tested in-language.
3. Why not Gleam (recorded rationale) #
The brief allowed Gleam "depending on availability of the necessary libraries." Availability assessment:
| Need | Gleam state |
|---|---|
| atproto OAuth client (PAR+DPoP+attestation) | None. Hand-roll against a spec that changes with Thursday alphas |
| Identity resolution chain (DNS TXT/well-known/PLC) | Partial community snippets; nothing maintained |
| Service-auth JWT verify (Ed25519) | Possible via Erlang :public_key/jose bindings, but bespoke |
| Jetstream/CAR/MST tooling | Thin; CBOR libs exist but no atproto-aware stack |
| Spaces client surface | Nothing; TypeScript SDKs are the reference |
Verdict: feasible eventually, but every line would be undifferentiated protocol plumbing whose correctness burden lands on us during the least stable period of the protocol's life. Revisit only if a major subsystem rewrite happens post-GA; the trait isolation in 04 §5 keeps even that door open.
4. Stack choices (v1) #
| Concern | Choice | Notes |
|---|---|---|
| HTTP framework | chi or std net/http mux | small surface; keep deps lean |
| DB access | github.com/mattn/go-sqlite3 (cgo) + sqlc or goose migrations |
SQLite v1 (decision 2026-08-24, driver amended 2026-09-01); store interface keeps Postgres open — 01 §2, ADR-0002 |
| Config | env + file; secret-store interface (file dev provider, KMS prod) | 08 §3 |
| Observability | slog structured logs + Prometheus metrics (own + scrape Stalwart /metrics/prometheus) |
05 §1 |
| Jobs/cron | simple ticker registry inside process v1 | extraction-ready |
| Testing | std testing + dockertest for Stalwart/PDS integration suites | contract tests per 04/06 |
| Toolchain | devenv.nix gains pkgs.go (+ golangci-lint); just recipes already present |
devenv is the dev entrypoint |
| VCS | jujutsu (pkgs.jujutsu already provisioned); issues tracked in bug |
docs feed issue creation next |
5. Dependency risk register #
| Risk | Mitigation |
|---|---|
| indigo API instability ("packages under active development") | Pin versions; wrap all indigo touchpoints behind thin interfaces (identity, oauth store); contract tests catch breakage at bump time |
| Alpha spaces churn | [04] traits + fallback backend + pinned image tags |
| Stalwart Registry schema drift between versions | CI schema-diff job against /api/schema/{sha256} (05 §1); pin Stalwart version per environment |
Candidate issues #
- L1: devenv.nix: add Go toolchain + golangci-lint; justfile recipes (build/test/lint/run).
- L2: Repo scaffolding per [01 §1]; CI pipeline (lint, unit, dockerised integration).
- L3: Vendor/pin indigo; spike: login e2e against reference PDS in CI.