Running & deploying the docs
This site is a plain Astro Starlight project — no
backend, no database. You edit .mdx under src/content/docs/, run it locally, and every
push to main builds and publishes to Azure Static Web Apps with Cloudflare Access
gating the front door. This page is the whole loop: install, run, verify, ship.
The site is live at
lemon-ground-07bcf2c0f.7.azurestaticapps.net
(SWA core-docs in rg-core), with docs.soundverse.ai to be bound in front via Cloudflare.
The docs repo at a glance
Section titled “The docs repo at a glance”Directorycore-docs/
- astro.config.mjs site URL + sidebar / IA + mermaid wiring
- package.json scripts + pinned deps (Node
>=22.12) - src/styles/theme.css the Soundverse brand theme
Directoryscripts/
- pages.manifest.mjs the page backbone (one entry per page)
- gen-stubs.mjs creates a draft stub for any manifest page that doesn’t exist yet
- check-secrets.mjs the secret-safety gate
- check-links.mjs post-build internal-link checker
Directorysrc/content/docs/ the pages — one directory per sidebar group
- …
- public/staticwebapp.config.json SWA routing (trailing slash + 404)
Directory.github/workflows/
- azure-static-web-apps.yml the deploy workflow
Directorydist/ build output (gitignored)
- …
Run it locally
Section titled “Run it locally”-
Install (Node
>=22.12— seeenginesinpackage.json):Terminal window npm install -
Start the dev server — hot-reload at
http://localhost:4321:Terminal window npm run dev -
Add or edit a page. Pages live at
src/content/docs/<group>/<slug>.mdx. The authoring contract covers the MDX rules; new pages are declared once inscripts/pages.manifest.mjsand stubbed byscripts/gen-stubs.mjsso the sidebar and build stay green.
The scripts
Section titled “The scripts”Everything runs through npm run … (defined in package.json):
| Command | What it does |
|---|---|
npm install |
Install dependencies (Node >=22.12). |
npm run dev |
Astro dev server at localhost:4321, hot-reload. |
npm run build |
Production build into dist/ (gitignored). |
npm run preview |
Serve the built dist/ locally, exactly as it will ship. |
npm run check:secrets |
Secret-safety gate — scans src/content for anything credential-shaped. |
npm run check:links |
Post-build internal-link check — needs a build first (it reads dist/). |
npm run verify |
The full gauntlet: check:secrets → build → check:links in one shot. |
Before you push: verify
Section titled “Before you push: verify”npm run verifyHow it deploys Deployed
Section titled “How it deploys ”Push-to-main, driven by
.github/workflows/azure-static-web-apps.yml:
-
Push to
main(or open a PR against it). Thebuild_and_deploy_jobruns onubuntu-latestwith Node 22. -
Secret gate → build. It runs
npm ci, thennpm run check:secrets(a hit fails the run and nothing publishes), thennpm run build→dist/(including the Pagefind index). -
Deploy via the
Azure/static-web-apps-deploy@v1action withskip_app_build: trueandapp_location: dist— the already-built output is uploaded to the SWA. Auth is the repo secretAZURE_STATIC_WEB_APPS_API_TOKEN(the SWA deployment token). -
PRs get a preview environment. Opening/updating a PR publishes an ephemeral SWA preview URL;
close_pull_request_jobtears it down when the PR closes. -
Cloudflare Access gates the front door. Access sits in front of the SWA hostname, so the site is reachable only to authorized staff. Search is Pagefind — fully static, so
Cmd/Ctrl+Kworks behind the gate with no external service.
Where the sidebar & IA live
Section titled “Where the sidebar & IA live”The information architecture is defined in one place:
astro.config.mjs.
The sidebar array declares the seven groups, each autogenerated from its directory under
src/content/docs/. Ordering within a group comes from each page’s sidebar.order
frontmatter. The same file wires astro-mermaid (before
starlight()) and the brand theme.
To add a page: add its entry to scripts/pages.manifest.mjs, run
node scripts/gen-stubs.mjs to create the draft stub, then write it.
Related
Section titled “Related”- Authoring conventions — the MDX rules and the secret-safety rule
- How these docs are structured — the Diátaxis groups and the manifest backbone
- Adding a Mermaid diagram — the
astro-mermaidfences configured inastro.config.mjs