- Source:
src/withcomponents/,pages/(e.g.,HomePage.tsx),hooks/,lib/,contexts/,types/, and test utilities undersrc/test/. - Entry points:
index.html,src/main.tsx,src/App.tsx,src/AppRouter.tsx. - Assets:
public/(e.g.,manifest.webmanifest, redirects). Build output:dist/. - Config:
vite.config.ts,tailwind.config.ts,eslint.config.js,tsconfig*.json, custom rules ineslint-rules/. - Aliases: import app code via
@/…(configured intsconfigand Vite).
npm run dev: Install deps and start Vite onhttp://localhost:8080.npm run build: Install deps, build, and copyindex.htmlto404.html.npm run test: Type-check, lint (TS + HTML), run unit tests (Vitest/jsdom), then build.- Deploy:
npm run deploy(nostr-deploy-cli),npm run deploy:cloudflare,npm run deploy:preview. - Example:
vitest runexecutes tests in CI mode.
- Always start new work from a fresh git worktree based on
main. - Before making changes, update
main, then create a dedicated branch and worktree for the task. - Example:
git fetch origin && git checkout main && git pull --ff-only && git worktree add ../divine-web-<task> -b <task> main. - Do not begin implementation in an existing feature branch worktree unless the user explicitly asks for that branch.
- Language: TypeScript + React 18. Components in
.tsx; utilities in.ts. - Naming: Components
PascalCase, hooksuseX, pages*Page.tsx, tests*.test.ts(x)colocated with code. - Styling: TailwindCSS; prefer utility classes and
tailwind-mergeto resolve conflicts. - Linting: ESLint (TypeScript, React Hooks, HTML) + custom rules in
eslint-rules/.- No inline
eslint-disable. Avoid placeholder comments and inline<script>in HTML.
- No inline
- Frameworks: Vitest +
@testing-library/reactwithjsdom. - Global setup:
src/test/setup.ts. - Place tests next to code (
*.test.ts/*.test.tsx). Favor user-facing assertions. - Run:
npm run testorvitest run. Keep tests deterministic; mock browser APIs as needed.
- Commits: imperative, present tense (e.g., "Add profile page"); keep focused; reference issue IDs when applicable.
- PRs: include summary, motivation, screenshots for UI changes, and tests for new logic.
- CI hygiene: ensure
npm run testpasses locally before opening/merging PRs.
- Do not commit secrets. Configure deploy targets via
wrangler.tomland environment variables. - Verify
public/manifest.webmanifestand required HTML meta (HTML ESLint rules) before deploy.