Thanks for contributing. This guide covers local setup, workflow expectations, and pre-PR checks.
- Node.js
>=22 - npm
>=10 - Git
- (Optional) Docker + Docker Compose
git clone https://github.com/Iris-IV/ProofOfHeart-frontend.git
cd ProofOfHeart-frontend
npm ci- Use
npm cifor clean, reproducible installs (CI and normal contributor flow). - Use
npm installonly when intentionally adding/updating dependencies and lockfile entries.
Create .env.local in the project root:
NEXT_PUBLIC_USE_MOCKS=true
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
NEXT_PUBLIC_CONTRACT_ADDRESS=
NEXT_PUBLIC_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
CREATOR_EMAIL_WEBHOOK_URL=Notes:
- Keep
NEXT_PUBLIC_USE_MOCKS=truefor local development unless you are testing against a live contract. CREATOR_EMAIL_WEBHOOK_URLis optional and used only for off-chain creator email opt-in events (server-side only, read by/api/email-opt-in).- Never commit
.env.local.
npm run devnpm run lint
npm run format:check
npm run typechecknpm run formatnpm test
npm run test:watch
npm run test:coveragenpm run test:e2e
npm run test:e2e:headed
npm run test:e2e:uiWhen you commit, the following checks run automatically via husky:
-
Linting & Formatting (lint-staged)
- ESLint on staged
.ts,.tsx,.js,.jsxfiles - Prettier on staged files
- Auto-fixes issues where possible
- ESLint on staged
-
TypeScript Type-Check
- Runs
tsc --noEmiton staged TypeScript files - Catches type errors before they reach CI
- Runs
-
Affected Tests
- Runs Jest on test files related to staged changes
- Finds tests by file name pattern (e.g.,
Component.test.tsx) - Uses
--bailto stop on first failure (fast feedback)
-
Commit Message Validation (commitlint)
- Validates commit message format
- Enforces Conventional Commits
If any check fails, the commit is rejected. You'll see:
✗ Type-check failed
✗ Tests failed
Fix the errors and try committing again. The checks will re-run on the same staged files.
To skip pre-commit checks (use sparingly):
git commit --no-verifyThis bypasses all hooks. Use only when absolutely necessary (e.g., WIP commits).
Pre-commit checks are optimized for speed:
- Type-check: Only checks staged files (not entire codebase)
- Tests: Only runs tests related to staged changes
- Typical time: 5-15 seconds depending on changes
If checks are too slow, consider:
- Committing smaller, focused changes
- Running
npm run typecheckandnpm testseparately during development
docker-compose up --builddocker-compose downCreate branches from main with descriptive prefixes:
feat/<short-description>fix/<short-description>docs/<short-description>test/<short-description>chore/<short-description>
Examples:
feat/email-opt-infix/admin-audit-log-panel
We enforce Conventional Commits format for all commits. This ensures clear, semantic commit history and enables automated changelog generation.
<type>(<scope>): <subject>
<body>
<footer>
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect code meaning (formatting, semicolons, etc.)
- refactor: Code change that neither fixes a bug nor adds a feature
- perf: Code change that improves performance
- test: Adding missing tests or correcting existing tests
- chore: Changes to build process, dependencies, or tooling
- ci: Changes to CI/CD configuration files and scripts
- revert: Reverts a previous commit
Scopes are optional but recommended for clarity:
auth- Authentication and authorizationcontract- Smart contract integrationui- User interface componentsapi- API routes and integrationsdocs- Documentationdeps- Dependency updatesconfig- Configuration filestest- Test infrastructureci- CI/CD workflowsperf- Performance optimizations
feat(auth): add email verification flow
fix(contract): handle campaign fetch errors
docs: update contributing guide
test(ui): add CauseCard component tests
chore(deps): update tailwindcss to 4.3.0
ci: add commitlint enforcement
- Use lowercase for type and scope
- Use imperative mood ("add" not "added" or "adds")
- Do not end subject with a period
- Keep subject under 100 characters
- Leave a blank line between subject and body
- Wrap body at 100 characters
- Reference issues in footer:
Closes #123orRefs #456
Commits are validated:
- Locally: Via husky
commit-msghook (runs on every commit) - In CI: Via GitHub Actions on pull requests
If a commit message is invalid, you'll see a helpful error message explaining what needs to be fixed.
PR titles must follow the same Conventional Commits format as commit messages. This ensures consistency and enables automated changelog generation.
<type>(<scope>): <description>
feat(auth): add email verificationfix(contract): handle campaign fetch errorsdocs: update contributing guideci: add commitlint enforcement
Before opening a PR:
- Branch is up to date with
main - PR title follows Conventional Commits format
- All commits follow Conventional Commits format
-
npm run lintpasses -
npm run format:checkpasses -
npm run typecheckpasses - Relevant tests pass (
npm testand/ornpm run test:e2e) - New behavior is documented (README/docs) when needed
- PR description explains what changed, why, and how it was tested
- Screenshots/GIFs included for UI changes
PR titles and commits are validated automatically in CI. If validation fails, you'll see a clear error message explaining what needs to be fixed.
For contract-layer work (src/lib/contractClient.ts):
- Cover mock and non-mock branches where possible.
- Validate error mapping paths (
Error(Contract, #N)). - Add focused unit tests for serialization/decoding behavior.
For UI work:
- Add/adjust component or integration tests under
src/__tests__/. - Ensure localization parity when adding translation keys.
We support English (en) and Spanish (es).
- Parity is mandatory: Every key added to
messages/en.jsonmust also be added tomessages/es.json. - No Empty Values: Translation values must not be empty strings.
- CI Enforcement: The
src/__tests__/i18n/missingTranslations.test.tstest runs in CI to ensure parity. If parity is broken, the build will fail.
To check parity locally:
npm run test src/__tests__/i18n/missingTranslations.test.ts- Search existing issues/PRs first to avoid duplicates.
- Link related issues in your PR body (
Closes #123). - Keep discussion respectful and technical.
Thanks again for helping move ProofOfHeart forward.