Overview & archetypes
On this page
These standards describe how this fleet of repos is built. They are descriptive of patterns already in use across the reference repos, not aspirational.
Operating context (read this first)#
Every standard here assumes the same context. It is deliberately narrow:
- Single developer, single user. Optimise for one person moving fast, not for teams.
Commit directly to
main; no PR review gates, no release trains. Seeworkflow.md. - Self-hosted everything. CI runs on self-hosted agents (managed by agentutil),
deploys land on the homelab via Komodo, client apps ship through the self-hosted
apps.dev.thmsn.devregistry. There is no reliance on external SaaS for the core loop. - Reverse-domain identity. Everything namespaced under
dev.thmsn.*. - Versions are cheap and disposable. Because there's one user and continuous deploy to
main, versions exist for debugging ("which commit is this?"), not for release marketing. Hence the derivedMAJOR.MINOR.<commit count>scheme.
Pick the archetype#
A repo is exactly one of these. The archetype tells you which standards are mandatory vs
optional. Full rules in archetypes/.
| Archetype | What it is | Reference repos | Standards that apply hardest |
|---|---|---|---|
| Full-stack product | Rust/Poem server emitting an OpenAPI contract, native clients per platform, deployed to the homelab | someproduct | all of them |
| Library | A shared lib* crate consumed by other repos over git | libsomeproduct + the lib* family | versioning (light), identifiers, testing |
| Orchestration | Deployment/infra-as-code for the homelab itself | homelab | deployment, identifiers, secrets split |
| CLI / service tool | Standalone binary published to the registry with an install manifest | someproduct (CLI), worker | versioning, registry publishing, build info |
| Vendored app | A third-party app we don't own, pinned as upstream/ and built/released into our infra à-la-carte (no rebrand) | relay (wraps subpop/Relay) | ci/cd, registry publishing, self-hosted agents |
When a repo blends types (e.g. a product that also ships a CLI), apply each archetype to the relevant subtree.
The standards#
| Topic | Doc | One-line rule |
|---|---|---|
| Versioning | versioning.md | Derived MAJOR.MINOR.<commit count>; tag is the only manual knob. |
| Identifiers | identifiers.md | Reverse-domain dev.thmsn.*; inject via libproduct. |
| Build info | build-info.md | Embed git/build metadata via libbuildinfo when feasible. |
| Branding | branding.md | One in-repo, code-as-truth generator produces all assets. |
| CI/CD | ci-cd.md | Woodpecker pipelines in .woodpecker/; build → GHCR/registry on main. |
| Self-hosted agents | self-hosted-agents.md | Woodpecker agents by label; dev Mac for Apple builds. |
| Deployment | deployment.md | Komodo GitOps + Watchtower + Caddy; secrets out of git. |
| Registry publishing | registry-publishing.md | Client apps ship via apps.dev.thmsn.dev. |
| Testing | testing.md | >80% on services; don't unit-test UIs; no change-detector tests. |
| Platform UX | platform-ux.md | Native per OS, designed for the target OS. |
| Workflow | workflow.md | Commit to main; versions for debugging, not releases. |
| Skills & MCP | skills-and-mcp.md | Shared skills/MCP live here; repos link them in. |
| Shortcuts | shortcuts.md | Repeated operational questions get a one-command answer in the repo's SHORTCUTS.md. |
| READMEs | readmes.md | Root README.md everywhere: pitch, mechanism, layout, quickstart, what CI runs, what's missing. |
Implementation standards (services & clients)#
Deeper technical conventions, mostly for the full-stack-product archetype (some apply to libraries/CLIs too):
| Topic | Doc | One-line rule |
|---|---|---|
| Service architecture | service-architecture.md | Workspace layered core→db→engine→api; poem-openapi; 10s graceful drain. |
| Data & persistence | data-persistence.md | sqlx + SQLite, .sql migrations, typed Id<T> (UUIDv7). |
| Backups | backups.md | stash-backup sidecar per stateful stack → Secure/Application Backups/<product> on the NAS; stash audits and drills them; keys never under /data. |
| Public short ids | public-ids.md | Stored 11-char Crockford-Base32 alias; URLs use it, UUID stays internal. |
| API contracts | contracts.md | Server emits OpenAPI/AsyncAPI; clients generated + drift-checked. |
| Error handling | error-handling.md | Domain Error→HTTP; liberror+thiserror+valuable trinity. |
| Auth integration | auth-integration.md | Central auth via SDK; explicit mode (fail-closed); TLS transport; me() is live authority; grant-gated. |
| Refresh tokens | refresh-tokens.md | Client stores in Keychain/DPAPI/httpOnly-cookie/0600; rotate single-flight; refresh is non-idempotent. |
| Configuration | configuration.md | libconfig Loader: defaults→TOML→shared→prefixed env. |
| Observability | observability.md | liblog/OTLP; /api/metrics; log ids/timings, never bodies. |
| Tracing | tracing.md | Always-on export, collector tail-samples; spans finish inside 60 s; traceparent + x-<product>-* from clients, trace id echoed as Ref:. |
| Client analytics | client-analytics.md | Clients batch usage events to their own server, which re-emits them as OTLP logs routed to ClickHouse; no third-party analytics SDKs, no user content in props. |
| Alerting | alerting.md | Grafana-provisioned rules as code; alert on repetition and severity, never a retry's substring; liveness at minimum. |
| Grafana dashboards | grafana-dashboards.md | Committed <name>.dashboard.json; queries key off fleet identifiers. |
| Security | security.md | Argon2, ChaCha20-Poly1305, CSP, SSRF/decompression caps. |
| Web & client arch | web-architecture.md | TanStack Query (server) + Zustand (UI); generated client; @thmsn/ui on Tailwind v4; shared Kit. |
| Rust conventions | rust-conventions.md | Edition 2024, clippy pedantic + allowlist, git deps. |
lib* ecosystem | lib-ecosystem.md | Solve cross-cutting concerns once in a shared lib*. |
Unfamiliar term? glossary.md defines the conventions, concepts,
infrastructure, and lib* toolchain referenced throughout.
Shared tooling#
Beyond docs, every repo gets the same tooling from the standards server at https://standards.thmsn.dev:
- The
standardsMCP:search,get_doc,get_checklist,get_template,get_skill, registered once per machine at user scope. thmsn-*skills: stubs in~/.claude/skills/whose bodies are fetched from the server.- The
standardscli:doctorwires the machine and checks a repo;init/newscaffold one.
A repo keeps only .standards.conf and the Standards: line in its AGENTS.md. See
skills-and-mcp.md, and migration.md to move a repo off
the old standards/ submodule.
Status: complete first draft. All standards, all five archetypes, skills-and-mcp, and the copyable templates are written and cross-linked. Open for iteration.