- Astro site rooted in
src; pages live insrc/pages, shared layouts/components insrc/layoutsandsrc/components, blog content insrc/content/blog, and global styles insrc/styles. - Static assets live in
publicand are served as-is; blog images that ship with posts are undersrc/content/blog/images. - Tailwind input is
src/styles/global.cssand is wired through the Astro Tailwind integration.
- Install dependencies:
npm install. - Local dev server:
npm run dev. - Build production bundle:
npm run build(runsastro build). - Preview production build locally:
npm run preview. - Lint:
npm run lint; Format:npm run format; Type/markup check:npm run check(Astro content schema + type diagnostics). - Tests:
npm run test/npm run test:unit(Vitest + Testing Library),npm run test:e2e(Playwright). - After any code or content edits, run lint,
npm run check, and unit tests before handing changes off. Run E2E when changing layouts/routes.
- Astro + React islands as needed; prefer
.astrocomponents for static content. - Use Prettier (project config) for formatting and ESLint with the Astro plugin.
- Indentation: 2 spaces; favor descriptive camelCase for vars/functions and PascalCase for components.
- Tailwind for utility-first styling; centralize custom tokens in
tailwind.config.jsto avoid ad-hoc inline styles. - Blog frontmatter order must be:
title,date,categories,tags,featuredImage_Url,featuredImage_Alt, then any other keys. - Tags are lowercase kebab-case only; keep them alphabetized in frontmatter.
- Unit/component tests use Vitest (jsdom) with Testing Library helpers; place tests under
tests/unitusing*.test.ts. - End-to-end tests use Playwright; place specs under
tests/e2e. - Commands:
npm run test/npm run test:unitfor unit tests,npm run test:e2e(ornpm run test:e2e:ui) for E2E. Run lint and unit tests before PRs; run E2E when changing routes/layouts. - Keep fixtures small and colocated; prefer msw-style mocks if HTTP mocking is needed later.
- Use short, imperative commit messages (matches existing history: e.g., “Add entry for 2025-10-05”, “Fix language used for name”).
- Keep commits focused (one logical change); include context in the body if behavior changes or migrations are involved.
- PRs should describe the change, impact, and manual verification (commands run, screenshots for UI tweaks); link related issues/notes when available.
- Before opening a PR: run
npm run lintand ensurenpm run buildsucceeds.
- Secrets and API keys should not be committed; use environment variables and
.env.*files ignored by git. - When adding integrations or loaders, review
astro.config.mjsand related configs to keep deployments consistent.