safekeys/docs-hosting [built]
Publish the generated specification docs to Cloudflare Pages at docs.safekeys.ai and dev-docs.safekeys.ai. Two docs audiences deploy as separate projects so internal architecture stays off the public site, and every deploy is built from the same pinned toolchain that CI validates.
Status: built
Why this exists
The specs are the source of truth, but until they are published they only exist on the machine of whoever ran usm generate. Hosting closes that gap: contributors get a browsable architecture and feature reference, and prospective users get the public half of it without the internal design notes alongside. The site is the adoption front door for the open core — the protocol is the product, so it has to be readable. Doing this on Cloudflare Pages keeps it free, global and dependency-free, and matches how USM itself is hosted, so there is one deploy pattern to understand rather than two. The important constraint is audience separation: the same generator produces both doc sets, and the difference between them is a filter. Getting that filter wrong publishes internal design notes, so the deploy must assert the public set contains no developer-only pages rather than trusting the flag.
Design decisions
cloudflare-pages
Decision: Host the docs and site on Cloudflare Pages, matching how USM is hosted.
Rationale: The domain is already on the account and DNS is already managed there, so adding a project needs no new provider. Pages is free at this scale, serves globally, and the deploy is a directory upload rather than a platform the project must learn. Using the same shape as USM means one deploy pattern to maintain across both projects.
Alternatives considered:
- GitHub Pages — rejected: The apex domain is already on Cloudflare, so DNS and TLS would be split across two providers for no benefit.
- A container or VM serving the static site — rejected: Adds an operating system to patch and a cache to configure, for content that is entirely static.
two-projects-per-audience
Decision: Publish the contributor and help docs as two separate Pages projects on separate subdomains.
Rationale: The two audiences differ by exactly one filter, and that filter is the only thing keeping internal architecture notes off the public site. Separate projects make the boundary structural rather than a flag on a build: a mistake in one cannot expose the other, and each can be republished or rolled back independently.
Alternatives considered:
- One project serving both audiences under a path — rejected: The internal pages would sit one directory away from the public ones, so the boundary would rest entirely on the build flag being right.
direct-upload-not-git-integration
Decision: Deploy by uploading the built directory from GitHub Actions, rather than connecting Pages to the repository.
Rationale: The site is generated from specs by a pinned toolchain, so the build must happen where that toolchain is pinned. Letting Pages build from the repository would put the generator version outside the repository's control and outside the CI that validates it, which is the specific drift this project already had to fix once.
Alternatives considered:
- Cloudflare Pages Git integration — rejected: Version selection and build steps would move to the provider's dashboard, unversioned and untested.
correct-canonical-urls-post-build
Decision: Rewrite the generated sitemap's domain after each build as a known workaround.
Rationale: The pinned generator writes a hardcoded sitemap hostname for the help and developer audiences with no configuration or environment override, so a published site would claim to belong to another project. Since the build is regenerated every run, the correction has to be applied every run; it is recorded as a workaround with an upstream report rather than treated as intended behaviour.
Alternatives considered:
- Omit the sitemap until the generator allows configuring it — rejected: Loses discoverability for the whole public site to correct one field.
- Commit a corrected config file — rejected: The generator rewrites it on every build, so the fix would not survive.
marketing-site-deploys-separately
Decision: Wire the docs deploy now and add the marketing site when it is built.
Rationale: The docs exist and build today; apps/safekeys is an empty directory. Splitting the workflows keeps the docs publishing unblocked and means the marketing build, which has a different toolchain and output, cannot break documentation deploys.
Alternatives considered:
- Wait and deploy both together — rejected: Withholds value that is already built, for no technical benefit.
How it works
Publish the contributor docs (publish-contributor-docs)
Build the developer-audience docs and deploy them to dev-docs.safekeys.ai.
- Validate — Every .usm spec validates and the drift gate passes, so only a clean tree deploys.
- Setup — The pinned USM version generates both doc sets; the version is the same one CI gates on.
- Transform — The static site is built, then its canonical URLs are corrected to our domain.
- Send — The built directory is uploaded to the dev-docs Pages project.
- Observe — The deploy is recorded with its commit; the previous deployment remains available for rollback.
Publish the help docs (publish-help-docs)
Build the filtered public-audience docs and deploy them to docs.safekeys.ai.
- Validate — The public set is asserted to contain no developer-only pages before anything is uploaded.
- Transform — The help site is built, then its canonical URLs are corrected to our domain.
- Send — The built directory is uploaded to the help-docs Pages project.
- Observe — A failed audience assertion stops the deploy rather than publishing internal notes.
Provision the hosting (provision-hosting)
The one-time Cloudflare and repository setup a new maintainer must perform.
- Setup — Two Pages projects are created, one per audience.
- Setup — Custom domains are attached to each project, with DNS managed by Cloudflare.
- Setup — Two repository secrets grant the workflow upload permission, scoped to Pages only.
- Observe — A missing secret fails the workflow loudly rather than silently skipping the deploy.
Preview the docs locally (preview-docs-locally)
A maintainer reads both audiences on localhost before publishing.
- Setup — The generate target produces both doc sets.
- Observe — The developer audience is served with live reload while specs are edited.
- Observe — The help audience is served separately, so the filter can be inspected before a public deploy.