- App routes:
src/app/(Next.js App Router, static export). Content-facing pages live under route groups like(content)and(pages). - UI & logic:
src/components/,src/lib/,src/features/,src/config/(site settings insrc/config/site.ts). - Content: MDX in
content/posts/andcontent/pages/; public assets inpublic/. - Tests:
src/__tests__/and*.test.ts(x)colocated with code. - Scripts: maintenance tools in
scripts/(ESM vianode --import tsx/esm).
npm run dev: Start dev server with drafts.npm run build: Generate search index + RSS, then static build toout/.npm start: Serve production build locally.npm run lint: ESLint checks.npm run test: Unit tests (Vitest). Usetest:watch,test:ui,test:coverageas needed.npm run test:integration/test:ssg/test:a11y: Targeted CI-aligned test suites.npm run test:all: Unit + a11y + build verification.- Content helpers:
npm run create-post,npm run generate-search-index,npm run generate-rss.
- Language: TypeScript + React. Components in
.tsx, PascalCase filenames (e.g.,PostCard.tsx). - Indentation: 2 spaces; prefer named exports; keep modules small and focused.
- Imports: use path alias
@/*forsrc/*(seetsconfig.json). - Linting: ESLint (
next+ TypeScript). Runnpm run lintbefore PRs. - Styling: Tailwind v4 tokens in
src/app/globals.css; dark mode via.darkclass.
- Frameworks: Vitest + Testing Library (
happy-dom), a11y checks (jest-axe). - Locations:
src/__tests__/and**/*.test.ts(x)next to code. - Coverage: Enforced via Vitest config; keep meaningful tests for new logic.
- Naming: Mirror target file, e.g.,
SearchInput.test.tsxforSearchInput.tsx.
- Commits: Conventional Commits style (e.g.,
feat:,fix:,chore:,test:) as seen in history. - PRs: Describe intent, link issues, include screenshots for UI changes, and add/update tests as needed.
- Checklist:
npm run lint,npm run test:all, andnpm run buildshould pass locally. Update docs and regeneratepublic/search-index.json/public/rss.xmlwhen content changes.
- Static export with
trailingSlashis required for GitHub Pages; avoid server-only features. - CSP and analytics are applied via components; only add scripts from trusted domains. Update GA ID in
src/config/site.ts. - Remote images must match
next.config.tsimages.remotePatterns. Don’t commit secrets.