SparkyFitness is an open-source, privacy-first fitness platform and warmly welcomes contributions from the community. Whether you want to squash a bug, build a new feature, improve documentation, or translate the UI into a new language, every contribution makes SparkyFitness better for families everywhere. This guide explains how to get involved and what the project asks of contributors.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CodeWithCJ/SparkyFitness/llms.txt
Use this file to discover all available pages before exploring further.
Ways to Contribute
Bug reports
Open a GitHub issue with steps to reproduce, expected vs. actual behaviour, environment details, and screenshots for visual bugs.
Feature requests
Open a GitHub issue to discuss the idea before writing any code. Maintainers will confirm alignment with the project roadmap.
Code pull requests
Fork the repo, create a feature branch, follow the coding standards below, and open a PR with the required checklist completed.
Documentation
Fix inaccuracies, add examples, or document undocumented behaviour. Docs live in the
docs/ Nuxt / Docus site.Translations
Only update the English (
en) translation file in the main repo. Non-English translations are maintained in the separate SparkyFitnessTranslations repository via Weblate.Code quality
Refactoring, performance improvements, security fixes, and dependency updates are all welcome.
The
AGENTS.md file at the repository root contains special instructions for AI coding assistants (such as GitHub Copilot, Claude, and similar tools). If you are using an AI assistant to help write code for SparkyFitness, make sure your assistant has read AGENTS.md — it defines cross-package rules, migration requirements, shared utilities to prefer, and common command entrypoints. Package-level AGENTS.md / CLAUDE.md files in SparkyFitnessFrontend/, SparkyFitnessServer/, and SparkyFitnessMobile/ take precedence over the root file for work inside those packages.Development Setup
Follow the Dev Environment guide to get the full stack running locally. The short version:Development Workflow
Make changes and test
Follow the coding standards below. Test your changes thoroughly — happy path, error cases, and edge cases.
Commit your changes
feat:, fix:, docs:, refactor:, test:, chore:).Coding Standards
General principles
- Clean, readable code — prefer self-documenting names; add comments for non-obvious logic.
- DRY — avoid duplication; extract shared logic into utilities or helpers.
- Separation of concerns — keep routing, business logic, and data access in their respective layers.
- No
any— use TypeScript strictly; define interfaces and types explicitly.
Frontend (React + TypeScript)
Component structure
Component structure
Styling conventions
Styling conventions
- Use Tailwind CSS utility classes for all styling.
- Prefer shadcn/ui components over custom implementations.
- Always add responsive classes (
sm:,md:,lg:). - Support both light and dark themes.
Data fetching with TanStack Query
Data fetching with TanStack Query
Follow the established pattern — API functions and query keys live in
src/api/, custom hooks wrapping useQuery / useMutation live in src/hooks/:Backend (Node.js + Express)
TypeScript first
TypeScript first
- All new backend files must be written in TypeScript.
- Existing JavaScript files may remain as-is, but conversion is encouraged when adding significant functionality.
- Enable strict mode; avoid
any.
Zod schema validation
Zod schema validation
All new API endpoints must define Zod schemas for request validation:
Repository pattern
Repository pattern
All database operations must use the repository pattern with explicit transaction management:
Automated tests required for new endpoints
Automated tests required for new endpoints
Every new API endpoint needs tests covering at least:
- Happy path (valid input, expected response)
- Validation errors (malformed input)
- Authentication / authorisation failures
- Edge cases
Database standards
- All schema changes must go through a migration file in
SparkyFitnessServer/db/migrations/. - Every new user-specific table must have RLS policies added to
SparkyFitnessServer/db/rls_policies.sql. - Classify new tables into Tier 1, Tier 2, or Tier 3 in the database security documentation.
- Wrap all migrations in a
BEGIN/COMMITtransaction. - Use
DECIMAL(10,2)for nutritional values; UUID for all primary keys.
Project Structure
Understanding where to add code:| What you’re adding | Where it goes |
|---|---|
| New API route | SparkyFitnessServer/routes/<feature>.ts |
| Database queries | SparkyFitnessServer/models/<feature>Repository.ts |
| Business logic | SparkyFitnessServer/services/<feature>Service.ts |
| Request validation schema | SparkyFitnessServer/schemas/<feature>.ts |
| New device/service integration | SparkyFitnessServer/integrations/<provider>/ |
| Frontend page | SparkyFitnessFrontend/src/pages/<FeaturePage>.tsx |
| Reusable UI component | SparkyFitnessFrontend/src/components/<Feature>/ |
| API function + query key | SparkyFitnessFrontend/src/api/<feature>Api.ts |
| Custom hook | SparkyFitnessFrontend/src/hooks/use<Feature>.ts |
| Shared types / schemas | shared/src/schemas/ or shared/src/constants/ |
Adding a New Integration
SparkyFitness already integrates with services such as FatSecret, Nutritionix, OpenFoodFacts, Strava, Withings, Garmin Connect, Hevy, Polar, and more. Each integration lives in its own directory underSparkyFitnessServer/integrations/<provider>/.
To add a new device or data-provider integration:
Implement the integration module
Follow the structure of an existing integration. At minimum, export:
- An authentication / OAuth flow handler
- A data-fetch function that maps provider data to SparkyFitness types
- A Zod schema for the provider’s API response
Add a route
Register the integration’s endpoints in a new route file and mount it in the main Express app.
Store credentials securely
Save OAuth tokens or API keys in
external_data_providers (a Tier 2 table — owner writes, delegates with share_external_providers can read). Encrypt all secrets using the SPARKY_FITNESS_API_ENCRYPTION_KEY.Translations
SparkyFitness usesi18next and react-i18next for internationalisation. Translation files are stored under SparkyFitnessFrontend/public/locales/{{languageCode}}/translation.json.
Only update the English (
en) translation file in the main repository. Non-English translation files are maintained in the separate SparkyFitnessTranslations repository via Weblate. Do not modify non-English files in this repo.-
Add the key and English string to
public/locales/en/translation.json. -
Use the
useTranslationhook in your component: - Add a hardcoded fallback value directly in the code so the UI remains usable even if the translation file hasn’t loaded.
es):
- Create
public/locales/es/translation.json. - Add
'es'tosupportedLngsinSparkyFitnessFrontend/src/i18n.ts. - Add a
<SelectItem>for Spanish in the language switcher inSettings.tsx.
Pull Request Checklist
Before submitting your PR, verify:- Branch is up to date with the latest
main - Changes have been tested thoroughly
- Code follows project conventions and standards
- No new console errors or warnings
- Mobile responsiveness verified for any UI changes
- Database migrations included if schema changed
- New tables added to RLS policies and classified in security docs
- English translation keys updated if new UI strings added
- Before/after screenshots attached for UI changes
- Frontend:
pnpm run validatepasses inSparkyFitnessFrontend/ - Backend:
pnpm run typecheck && pnpm run lint && pnpm run testpasses inSparkyFitnessServer/ - Backend new files: Written in TypeScript with Zod schemas and tests
Automated PR validation
A GitHub Actions workflow runs automatically on every PR and:- Detects which packages changed (frontend, backend, mobile, UI).
- Validates that the appropriate checkboxes in the PR template are checked.
- Posts a comment with validation results and guidance.
- Fails the PR check if required checkboxes are missing or unchecked.
Getting Help
GitHub Issues
Use GitHub Issues to report bugs or ask technical questions. Search existing issues before opening a new one.
GitHub Discussions
Use GitHub Discussions for general questions, ideas, and community conversation.