Skip to content

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
Terminal window
mise install
pnpm install
mise run docs:dev # http://localhost:4321
mise run check:site # generate, typecheck, unit tests, and build apps/docs/dist

Every 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):

Terminal window
mise run build:ts
mise run preview:dev # http://localhost:4173

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:

Terminal window
DOCS_SITE=https://zwire.studiocyf.app PREVIEW_SITE=https://preview.zwire.studiocyf.app mise run check:site
mise run deploy:docs
mise run build:ts
DOCS_SITE=https://zwire.studiocyf.app mise run preview:build
mise run deploy:preview

The GitHub Actions workflows .github/workflows/docs.yml and .github/workflows/preview.yml remain inactive on forks until configured:

  1. Create a Cloudflare API token with the minimal permissions listed below.
  2. In repository settings, create an environment named cloudflare restricted to the main branch. Add CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as environment secrets (not repository secrets).
  3. Add repository variables:
    • DOCS_SITE: https://zwire.studiocyf.app
    • PREVIEW_SITE: https://preview.zwire.studiocyf.app
  4. Run the Docs and Preview workflows manually once via Actions → Run workflow.
  5. To deploy automatically on pushes to main, set repository variables DOCS_DEPLOY and PREVIEW_DEPLOY to true.
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.

  • Deployment workflows never run on pull requests, and GitHub never exposes secrets to fork PRs.
  • Secrets belong to the cloudflare environment, restricted to main.
  • Build and deploy run in separate jobs: build runs dependency code with zero secrets and uploads dist/; deploy disables Mise caching (cache: false), installs only lockfile-pinned Wrangler from tools/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.jsonc contains account_id; both set workers_dev: false and preview_urls: false so only the canonical custom domains serve traffic.

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.

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.