src/components/: reusable UI and feature components (organized by domain).src/elements/: route-level screens composed from components.src/router/andsrc/router/routes/: application routing and route mappings.src/queries/: API/data access logic and related domain query helpers.src/utils/: shared utility functions.src/constants/: static constants and configuration values used in code.src/theme/: Chakra theme tokens, system config, and visual recipes.src/i18n/andsrc/i18n/locales/: language setup and translation dictionaries.src/__mocks__/: test mocks for external/problematic modules.public/: static files served directly by Vite.
pnpm startorpnpm dev: run the local Vite dev server.pnpm build: create a production bundle.pnpm lint: run TypeScript checks and Prettier validation onsrc/.pnpm lint:fix: apply Prettier formatting fixes.pnpm test: run all Vitest tests once.pnpm test:watch: run tests in watch mode.pnpm test:coverage: generate coverage reports.pnpm translations: extract i18n keys from source code and update locale files.pnpm chakra:typegen: regenerate Chakra typings after theme/system changes.
- Follow
.editorconfig: UTF-8, LF, 2-space indentation, final newline. - Prettier rules are authoritative: no semicolons, single quotes, trailing commas (
es5),printWidth: 120. - Use TypeScript for new code and keep typing explicit in public interfaces.
- Prefer configured path aliases over long relative imports. Common aliases include
~components/*,~queries/*,~theme/*,~i18n/*, and~utils/*. - Naming patterns: components/files in PascalCase, hooks in
useXformat, tests as*.test.tsor*.test.tsxnear related code.
- Any new user-facing text must go through i18next (
t(...)/translation keys), not hardcoded strings. - After adding or changing translation keys, always run
pnpm translations. - Review generated locale diffs and ensure new keys are translated for supported locales (
en,es,ca,it) when applicable. - Avoid leaving partial localization changes unreviewed.
- Test stack: Vitest + Testing Library (
jsdomenvironment). - Prefer behavior-focused tests over implementation-detail assertions.
- Keep tests close to the module being validated.
- Run targeted tests while iterating (example:
pnpm test src/queries/groups.test.ts).
- This repository depends on maintained Vocdoni packages; changes may require validating upstream behavior.
- Key internal dependencies include
@vocdoni/sdk,@vocdoni/react-providers, and@vocdoni/rainbowkit-wallets.
- Follow existing Conventional Commit patterns from repo history (
fix(scope): ...,chore(scope): ...,refactor(scope): ...). - Keep commits scoped to one concern and use imperative summaries.
- PR descriptions should explain what changed, why, and how it was verified.
- Treat this file as execution guidance for repository tasks.
- Before finishing any code change, always run
pnpm lintandpnpm test. - When text keys/locales are touched, also run
pnpm translationsbefore completion. - Use
git diffto review only relevant changes and avoid expanding context with unrelated files. - If required commands fail, do not mark the task complete until failures are fixed or explicitly reported.
- Prefer focused, minimal diffs and avoid repo-wide formatting churn outside task scope.