This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Source for https://docs.openipc.org: the OpenIPC documentation site (open-source IP camera firmware, with a lot of FPV / WFB-NG material). It is an Astro 4 + Starlight 0.15 static site with Tailwind. There is no application code and there are no tests. Almost every change is to Markdown/MDX content.
Uses Yarn 4 (packageManager: yarn@4.0.2, nodeLinker: node-modules). The Node version is in .node-version (18.18.2); CI builds with Node 18.
yarn install
yarn dev # local dev server (astro dev)
yarn build # astro check && astro build -> dist/
yarn preview # serve the built dist/
yarn format # prettier --write . (prettier-plugin-astro)yarn build is the only validation step. Run it before you consider a change done. astro check type-checks frontmatter against the Starlight schema, and some MDX mistakes only fail at build time. A missing component import, for example, renders without complaint in yarn dev but breaks the build.
Deployment: every push to main builds and deploys to GitHub Pages through .github/workflows/deploy.yml (withastro/action). CNAME and public/CNAME pin the custom domain.
- Content lives in
src/content/docs/as a single Starlightdocscollection (src/content/config.tsuses the stockdocsSchema()). The file path sets the URL. Every page needstitleanddescriptionin its frontmatter, becausedescriptionalso feeds the OG image. - The sidebar is defined by hand in
astro.config.mjs. It mixes two styles:autogeneratedirectories pick up new files automatically:hardware/,software/,reference/, anduse-cases/fpv/{net-cards,wfb-ng,apfpv},use-cases/home-automation,use-cases/video-surveillance.- Explicit
itemslists in Getting Started, Development, Resources and theuse-cases/fpvlevel itself. A new page in one of these sections must be added toastro.config.mjs, or it won't appear in the nav. - A new subdirectory under
use-cases/fpv/also needs its own sidebar entry. - Autogenerated groups sort alphabetically. To pin a page first, set
sidebar: { order: 1 }in its frontmatter (thequick-start.mdpages do this). Don't prefix the filename with a dash: the dash stays in the URL.
- The landing page is
getting-started/homepage.mdx./redirects to it (seeredirectsinastro.config.mjs). There is noindex.mdx, because the redirect would hide it anyway. - OG images:
src/pages/og/[...slug].tsusesastro-og-canvasto render a PNG for every docs entry from its title and description.src/components/Head.astrooverrides Starlight's Head to inject theog:imageandtwitter:imagemeta tags. - Custom components in
src/components/are imported from MDX pages:ThemeImage.astrotakeslightSrc,darkSrcandalt, and swaps the image for light or dark theme.wfb-calculator.astrois the WFB-NG bitrate calculator used bywfb-ng-calculator.mdx.roadmap.astro,card.astroandcard-grid.astro.- Starlight's own
CardandCardGridfrom@astrojs/starlight/components.
- New filenames should be lowercase kebab-case, because the filename becomes the URL. Some existing files don't follow this (e.g.
APFPV.md,Greg's_APFPV.md,hardware/EMAX/...); don't rename them casually, since that breaks their URLs. - Use
.mdxonly when the page imports components. Put the imports right after the frontmatter, using the absolute-from-root form:import ThemeImage from '/src/components/ThemeImage.astro'. - Images go in
public/images/and are referenced as/images/<file>. Downloadable files go insrc/assets/files/. - Use Starlight asides (
:::note,:::caution,:::danger,:::tip) for callouts. - Mark unfinished sections with a
badge: { text: "WIP", variant: "caution" }entry in the sidebar config. - Every page gets an "Edit page" link that points to
github.com/OpenIPC/docs/edit/main/.