Project-specific instructions for AI agents working on this codebase.
CLAUDE.mdis a symlink to this file — updateAGENTS.mdand both stay in sync.
nodecms.guide is a Node.js CMS leaderboard and comparison website maintained by Ghost. It showcases 60+ Node.js-based content management systems with live GitHub metrics.
Live site: https://nodecms.guide
- Framework: Astro 6.x (static output)
- Interactive Components: React 19 via
@astrojs/react - Language: TypeScript (strict, extends
astro/tsconfigs/strict) - Styling: Plain CSS (
src/styles/global.css) + scoped styles in.astrocomponents - Content: Markdown + YAML frontmatter loaded via Astro Content Collections (
astro:content) - APIs: GitHub (
@octokit/rest) - Hosting: Netlify
- Node: >= 24.18.0
/src/
/components/ # Astro + React components (Header, Footer, ProjectFilter, ShareButtons)
/content/
/projects/ # CMS definitions (Markdown + YAML frontmatter) — one file per CMS
/pages/ # Static page content (contact, contribute)
/layouts/ # BaseLayout.astro
/pages/ # Astro routes: index.astro, [slug].astro, projects/[slug].astro, 404.astro
/styles/ # global.css
/images/ # Images referenced from components
content.config.ts # Content collection schemas (zod)
/scripts/ # Build-time data fetching (fetch-archive.js, project-data.js, util.js)
/tools/typecheck/ # Workspace package isolating `astro check` on TypeScript 6 (Volar
# needs TS's JS compiler API, removed in the native TS 7 the app uses)
/public/ # Static assets served as-is (favicon, robots.txt, /images/*)
/dist/ # Build output (gitignored)
/tmp/ # Local cache for GitHub archive data
Content collections are defined in src/content.config.ts with two collections: projects and pages. Any new frontmatter field must be added to the zod schema there.
pnpm install # Install dependencies
pnpm dev # Astro dev server at http://localhost:4321
pnpm build # Production build to /dist
pnpm preview # Serve the production build locallyThere is no pnpm start, pnpm stage, or pnpm serve script — don't reference them. Tests, lint, and typecheck scripts are documented under Testing.
Create a new Markdown file in src/content/projects/ with this frontmatter (schema enforced by src/content.config.ts):
---
title: CMS Name
repo: owner/repo # GitHub repo (omit for closed source)
homepage: https://example.com # Must be a valid URL if present
twitter: handle # Optional
opensource: "Yes" # "Yes" | "No" (required)
typeofcms: "API Driven" # See types below
supportedgenerators:
- All # Or specific: Gatsby, Next, Hugo, etc.
description: Short description for the listing card.
images:
- path: /images/cms-screenshot.png
startertemplaterepo: owner/repo # Optional
---
Extended Markdown content for the detail page.API Driven- Headless CMS with REST/GraphQL APIGit-based- Content stored in Git repositoriesFlat-file- File-based storage without database
- Prefer
.astrocomponents for static markup. Reach for React (.tsx) only when client-side interactivity is required (e.g.ProjectFilter,ShareButtons) and add the appropriateclient:*directive at the usage site. - Follow the existing TypeScript style — the project is strict, so type all props and external values explicitly.
Global styles live in src/styles/global.css. Component-specific styles go in scoped <style> blocks inside .astro files. There is no styled-components or CSS-in-JS here anymore.
Load projects/pages via getCollection('projects') / getEntry('pages', slug) from astro:content. The schema in src/content.config.ts is the source of truth for available fields.
package.json has "type": "module" — use ESM (import/export) everywhere, including in /scripts.
Required for build-time GitHub data fetching:
NODE_CMS_GITHUB_TOKEN— GitHub personal access token with permission to create GistsNODE_CMS_USE_FIXTURE— set to1to bypass GitHub entirely and load the checked-in fixture attest/fixtures/node-cms-archive.json. Used by CI and the test suite; not for production builds.
For local development, create a .env file at the repo root. On Netlify, this is configured in the site's environment settings.
GitHub metrics are fetched at build time by the scripts in /scripts:
- Raw archive data is cached locally in
/tmpand remotely in a GitHub Gist - If the cache is more than 24 hours old, fresh data is pulled from GitHub
project-data.jscompares newest data with data from ~1 week ago to compute trends
Detailed local fixture, archive, CI, and Netlify behavior is documented in docs/data-fetching.md.
To refresh production data, trigger a new Netlify deploy.
- Add the image to
/public/images/ - Reference it in frontmatter:
path: /images/filename.png - Use it in the Markdown body:
<img class="simple" src="/images/filename.png" alt="..." />
Three layers of automated tests, all wired into CI:
- Unit tests (vitest) —
scripts/__tests__/*.test.jscoverfetch-archive.js,project-data.js, andutil.js. 100% line coverage is enforced.pnpm test— run oncepnpm test:watch— watch modepnpm test:coverage— with v8 coverage
- End-to-end tests (Playwright) —
tests/e2e/*.spec.tssplit into two kinds:build-output.spec.ts— reads files fromdist/to assert page structure, slug routing, and astro-island hydration markers. No browser required.render.spec.ts— drivesastro previewwith real Chromium to verify hydration, client-side filtering, ShareButtons, and the 404 path.- Run with
NODE_CMS_USE_FIXTURE=1 pnpm build && NODE_CMS_USE_FIXTURE=1 pnpm test:e2e.
- Quality gates —
pnpm lint(oxlint + oxfmt) andpnpm typecheckmust pass. Typechecking runsastro sync, then calls@astrojs/checkfromtools/typecheckwith its TypeScript 6 peer. Do not replace this withastro check: since Astro 7.3.4 its CLI rejects the app's TypeScript 7 before loading the isolated checker.
CI workflows live in .github/workflows/:
ci.yml— runs on every PR and push to main. Lint, typecheck, unit tests, build with fixture mode, and E2E. No secrets required.smoke.yml— runs on a daily cron and on-demand viaworkflow_dispatch. Does a realpnpm buildagainst the live GitHub API using theNODE_CMS_GITHUB_TOKENrepo secret, then verifies the archive gist was updated. This is the only place the real gist-creation path is exercised.
Manual verification:
pnpm dev— verify changes interactivelyNODE_CMS_USE_FIXTURE=1 pnpm build && pnpm preview— verify the production build without needing a GitHub token
- All content changes require a rebuild to appear on the live site
- Filtering and sorting happens client-side in the
ProjectFilterReact component CLAUDE.mdis a symlink to this file — editAGENTS.md