Cloudflare Pages (Docs)
This documentation site (the one you’re reading) is built with Astro
Starlight and deployed to Cloudflare Pages at tinadiet.com.
Project config
- Pages project name:
tinadiet-docs - Source: GitHub
einsze/tinadiet, builds fromprojects/docs/ - Build framework: Astro (auto-detected)
- Custom domain:
tinadiet.com(apex)
Build settings
In Cloudflare Pages dashboard → tinadiet-docs → Settings → Builds & deployments:
- Production branch:
main - Build command:
cd docs && npm install && npm run build - Build output directory:
docs/dist - Root directory:
/(project root, build cd’s into projects/docs) - Environment variables:
NODE_VERSION=22
Local development
cd docsnpm install # first timenpm run dev # Astro dev server on http://localhost:4321Hot reload: any change in src/content/docs/*.md, src/pages/*, or
astro.config.mjs triggers automatic refresh.
npm run build # static build into dist/npm run preview # preview prod build locallySite structure
Astro + Starlight conventions:
projects/docs/├── astro.config.mjs Site + Starlight config├── src/│ ├── content.config.ts Starlight content collection registration│ ├── content/docs/ Markdown pages (this is what you're editing)│ │ ├── index.mdx Homepage (uses Starlight `splash` template)│ │ ├── introduction.md│ │ ├── getting-started/│ │ ├── architecture/│ │ ├── backend/│ │ ├── liff/│ │ ├── payments/│ │ ├── deployment/│ │ ├── ops/│ │ └── reference/│ ├── pages/│ │ └── index.astro Apex landing page (NOT Starlight; separate)│ ├── styles/│ │ └── brand.css Rose-pink palette overrides│ └── assets/ mascot.png imported into pages└── public/ static assets (favicon, og:image, mascot copy)Sidebar
Auto-generated from folder structure (configured in astro.config.mjs):
sidebar: [ { label: 'Introduction', slug: 'introduction' }, { label: 'Getting Started', autogenerate: { directory: 'getting-started' } }, { label: 'Architecture', autogenerate: { directory: 'architecture' } }, // ...]To control order within a directory, use sidebar.order in frontmatter:
---title: Prerequisitessidebar: order: 1---Lower numbers appear first.
Routing
URL structure:
tinadiet.com/→src/pages/index.astro(apex landing)tinadiet.com/<slug>/→ corresponding markdown insrc/content/docs/- e.g.
/architecture/overview/→src/content/docs/architecture/overview.md
- e.g.
Note Starlight uses directory-with-index routing by default (so the
URL is /architecture/overview/ not /architecture/overview.html).
Astro’s trailingSlash setting controls whether the trailing / is
enforced; default behavior is fine.
Search
Pagefind is bundled with Starlight — full-text search of all docs at
build time. Search bar in top nav (kbd Ctrl+K / Cmd+K). No
configuration needed; works automatically.
Theme
src/styles/brand.css overrides Starlight’s default Tailwind palette to
match Tina Diet’s rose-pink brand:
:root[data-theme='light'] { --sl-color-accent: #ec4571; --sl-color-accent-low: #ffe4ec; --sl-color-accent-high: #be3252;}Imported in astro.config.mjs customCss: ['./src/styles/brand.css'].
Light/dark toggle is built into Starlight (top right corner).
Adding a new page
- Create
.md(or.mdxif using JSX components) insrc/content/docs/<section>/<page>.md - Add frontmatter:
---title: My New Pagedescription: Short summary for SEO + meta.sidebar:order: 3---
- Write markdown body
- If using Card / Tabs / Steps components: use
.mdxextension andimport { Card } from '@astrojs/starlight/components';at top
The sidebar will auto-update with the new page in the appropriate section.
MDX vs MD
| Need | Use |
|---|---|
| Pure markdown text + code | .md (simpler) |
| Starlight components (Card, Tabs, Steps, Aside, LinkCard) | .mdx |
| Custom React components | .mdx |
| Mixed (some pages need components, some don’t) | Mix — each file independent |
Deploying
Push to main branch:
git add projects/docs/git commit -m "docs: add section X"git pushCloudflare Pages auto-builds (~30-90 seconds depending on cache). Watch the build at Cloudflare dashboard → Pages → tinadiet-docs → Deployments.
If build fails, check the log. Common failures:
- Markdown frontmatter syntax error → check YAML
- Internal link to non-existent page → Starlight warns at build time
- MDX import path wrong → check
import { Card } from '@astrojs/starlight/components'
Preview deploys
Every commit on a non-main branch creates a preview deploy at a
unique *.tinadiet-docs.pages.dev URL. Useful for reviewing changes
before merging.
Custom domain setup
tinadiet.com (apex) is claimed as custom domain on the Pages project:
- Cloudflare dashboard → Pages → tinadiet-docs → Custom Domains
- Add
tinadiet.com - DNS auto-created (CNAME at apex via Cloudflare flattening)
- SSL auto-provisioned
For www subdomain: optional 301 redirect via Cloudflare Page Rule
www.tinadiet.com → tinadiet.com. Currently not configured.
Maintenance
- Single source of truth: code is canon. When code changes, update docs in the same PR.
- Frontmatter discipline: title + description required for every page.
- Sync from
projects/ops/DB_QUERIES.md: docs page/ops/db-queries/should mirror the ops runbook. Currently manual copy; could automate with a build script later.
See projects/docs/README.md for the full plan and conventions.