Hosting this site
This documentation site is an Astro Starlight project in apps/docs. Alongside it, apps/preview packages the compiled Rust WASM + React order book and the Vue, Solid, and Svelte order boards as a separate static preview site so the docs can link to live demos without adding Rust/WASM build time to docs-only changes.
| Site | Address | Source | Workflow |
|---|---|---|---|
| Documentation | https://zwire.studiocyf.app |
apps/docs |
.github/workflows/docs.yml |
| Live example previews | https://preview.zwire.studiocyf.app |
apps/preview |
.github/workflows/preview.yml |
Build locally
Section titled “Build locally”mise installpnpm install
mise run docs:dev # http://localhost:4321mise run check:site # generate, typecheck, unit tests, and build apps/docs/distEvery docs:dev and docs:build run executes apps/docs/scripts/generate.ts first so repository sources stay the single source of truth:
| Pages / Artifacts | Repository source |
|---|---|
| Why zwire, Guides | docs/why-zwire.md, docs/guides/*.md |
| TypeScript packages | ts/packages/core/README.md, ts/packages/adapters/*/README.md |
| Rust crates & bridges | rust/crates/zwire*/README.md, bridges/*/README.md |
| Examples | examples/{rust-ts-sync,wasm-orderbook,adapter-orders}/README.md |
| Wire protocol & JSON artifacts | spec/protocol.md, spec/wire.schema.json, spec/conformance.json → /spec/v3/*.json |
| API Reference (split by section) | docs/API.md (drift-checked against .d.ts & Rust lib.rs by mise run check:docs) |
| Architecture, Benchmarks, ADRs | docs/ARCHITECTURE.md, docs/BENCHMARKS.md, docs/ADR-002-*.md, docs/ADR-001-*.md (/ko/), docs/RUST-1.100-GUIDELINES.md |
| Project | CONTRIBUTING.md, docs/RELEASING.md |
The build also outputs /robots.txt, /og-image.png, /llms.txt, /llms-full.txt, /llms-small.txt, topic subsets under /_llms-txt/, and a plain Markdown version of every English page with .md replacing the trailing slash (for example, /guides/optimistic-tx.md). Standalone demo iframe routes (/demo/*) and untranslated /ko/* fallback pages are excluded from sitemap-0.xml and marked noindex.
To build and serve the live example preview site locally (requires Rust 1.100.0, wasm32-unknown-unknown, and wasm-bindgen-cli 0.2.130):
mise run build:tsmise run preview:dev # http://localhost:4173Deploy to Cloudflare Workers
Section titled “Deploy to Cloudflare Workers”apps/docs/wrangler.jsonc and apps/preview/wrangler.jsonc serve each app’s dist/ directory as Cloudflare Workers Static Assets. Because no Worker script executes on requests, traffic does not count against the free plan’s daily Worker request limit.
To deploy locally after authenticating with wrangler login:
DOCS_SITE=https://zwire.studiocyf.app PREVIEW_SITE=https://preview.zwire.studiocyf.app mise run check:sitemise run deploy:docs
mise run build:tsDOCS_SITE=https://zwire.studiocyf.app mise run preview:buildmise run deploy:previewThe GitHub Actions workflows .github/workflows/docs.yml and .github/workflows/preview.yml remain inactive on forks until configured:
- Create a Cloudflare API token with the minimal permissions listed below.
- In repository settings, create an environment named
cloudflarerestricted to themainbranch. AddCLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDas environment secrets (not repository secrets). - Add repository variables:
DOCS_SITE:https://zwire.studiocyf.appPREVIEW_SITE:https://preview.zwire.studiocyf.app
- Run the Docs and Preview workflows manually once via Actions → Run workflow.
- To deploy automatically on pushes to
main, set repository variablesDOCS_DEPLOYandPREVIEW_DEPLOYtotrue.
Minimal Cloudflare API token permissions
Section titled “Minimal Cloudflare API token permissions”| Scope | Permission | Resources |
|---|---|---|
| Account | Workers Scripts: Edit | Only the account hosting the sites |
| Zone | Workers Routes: Edit | Only the zone for studiocyf.app |
Set an expiration date and rotate the token before expiry.
How the workflows protect credentials
Section titled “How the workflows protect credentials”- Deployment workflows never run on pull requests, and GitHub never exposes secrets to fork PRs.
- Secrets belong to the
cloudflareenvironment, restricted tomain. - Build and deploy run in separate jobs:
buildruns dependency code with zero secrets and uploadsdist/;deploydisables Mise caching (cache: false), installs only lockfile-pinned Wrangler fromtools/deploy(@zwire/deploy) with--frozen-lockfile --ignore-scripts, and deploys the uploaded artifact. - All third-party GitHub Actions in deployment workflows are pinned to full commit SHAs and kept fresh by
.github/dependabot.yml. - Neither
wrangler.jsonccontainsaccount_id; both setworkers_dev: falseandpreview_urls: falseso only the canonical custom domains serve traffic.
Custom domains
Section titled “Custom domains”Cloudflare provisions the DNS record and dedicated TLS certificate automatically for zwire.studiocyf.app and preview.zwire.studiocyf.app via custom_domain: true. The zone must live in the same Cloudflare account, and neither hostname may have a pre-existing manual CNAME record.
GitHub Pages alternative
Section titled “GitHub Pages alternative”You can alternatively host apps/docs/dist on GitHub Pages via actions/upload-pages-artifact and actions/deploy-pages. Note that GitHub Pages ignores public/_headers, so /*.md will not receive text/markdown, /spec/* will omit Access-Control-Allow-Origin: *, and hashed assets will inherit GitHub’s default 10-minute cache lifetime rather than immutable 1-year caching.