Thanks for contributing! Follow these guidelines to keep the codebase consistent.
- Node.js 18+
- npm (comes with Node.js)
git clone https://github.com/CalloraOrg/Callora-Frontend.git
cd Callora-Frontend
npm install
npm run dev # dev server at http://localhost:5173
npm run build # TypeScript check + production buildBranch off main using the format:
feature/<short-description> # new features
fix/<short-description> # bug fixes
docs/<short-description> # documentation only
Example: git checkout -b feature/api-search-filters
- Fork the repo and create a branch from
main. - Make your changes, following the guidelines below.
- Run
npm test -- --runandnpm run buildto confirm tests pass and there are no TypeScript errors. - Open a pull request against
mainwith a clear description of what changed and why.
Before opening a pull request, confirm:
-
npm run buildpasses with no TypeScript errors. - Tests pass (
npm test -- --run). - Any new component added to
src/components/has a matching entry insrc/data/a11y-manifest.json({ "id", "name", "status" }), and changed components have theirstatusre-checked. See Accessibility Audit Manifest — Upkeep Rules.
All UI changes must follow the UI Design System.
Key rules:
- Use design tokens, not raw values.
src/index.cssis the canonical source for app-wide design tokens;src/styles/tokens.cssdefines additional marketplace, API, and status tokens. Reference them viavar(--token-name)— never use inline hex values or hardcoded pixel sizes. - Reuse existing components. Check
src/components/before building something new. Components likeApiCard,EmptyState,SearchBar,Skeleton, andBreadcrumbare shared across views. - Do not introduce a component library. The project is intentionally dependency-light.
- All interactive elements must be keyboard navigable and have visible focus styles.
- Use semantic HTML elements (
<button>,<nav>,<main>,<article>, etc.). - Provide
aria-labelor visible text for icon-only controls. - Verify your changes in both light and dark modes (use the theme toggle in the top bar).
Tests run with Vitest in a jsdom environment. The full
command reference lives in the README; the essentials:
npm test # watch mode
npm test -- --run # single pass
npm test -- --run src/components/Pagination.test.tsx # one file
npm test -- --run -t "clamps the page" # one test by name
npm run test:coverage # single pass + coverageBefore opening a pull request:
- Run
npm test -- --runand make sure the suite is green. - Run
npm run buildto confirm there are no TypeScript errors. - Add or update tests for the behaviour you changed. New components should
ship with a
src/components/<Name>.test.tsxfile; bug fixes should add a regression test that fails against the old code. - Prefer testing observable behaviour — what a user sees and does — over implementation details, so refactors do not require rewriting tests.
vitest.config.ts supplies the defaults, so test files need no setup:
globals: true makes describe/it/expect available without imports,
src/setupTests.ts registers the shared matchers and per-test cleanup, and CSS
imports are handled automatically.
Conventions:
- Naming and location: test files must be named
*.test.tsxor*.test.ts(only these match theincludepattern invitest.config.ts). Place them next to the source file they test. - Fake timers: if a component or utility relies on
setTimeout,setInterval, orDate, use Vitest's fake timers (vi.useFakeTimers()) instead of real waits, to keep tests fast and deterministic. Restore them withvi.useRealTimers()afterwards; note that Testing Library'swaitForcan hang under fake timers.
For changes that automated tests cannot cover — layout, animation, theming, or the dev-server proxy — manually verify the affected routes load and behave correctly after your changes, in both light and dark mode.