-
-
Notifications
You must be signed in to change notification settings - Fork 335
Contribution Guide
Contributions of every kind are welcome β code, translations, bug reports, and documentation. This page gives you the full picture of how contributing to OpenNutriTracker works. The authoritative, always-current versions of the conventions live in the repository itself: CONTRIBUTING.md (conventions) and GettingStarted.md (environment setup). If this page and those files ever disagree, the repository files win.
- Ways to Contribute
- Development Setup
- Branching & Pull Requests
- Code Style & Checks
- Adding or Improving Translations
- Code Generation
- Platform Support Rules
- Related Repositories
- Report bugs β open an issue with steps to reproduce, your device/OS, and what you expected to happen.
- Suggest features β open an issue describing the use case (the why, not just the what).
- Improve translations β the app ships in 9 languages, and native-speaker review is always valuable (see translations).
- Contribute code β bug fixes and features via pull request (see below).
- Improve documentation β this wiki and the in-repo docs.
- Improve food data β incorrect product data usually comes from Open Food Facts; correcting it there helps every user.
If you're unsure about anything, open a draft PR or an issue and ask β early feedback is much cheaper than reworking a finished change.
OpenNutriTracker is a Flutter app (Dart), targeting iOS and Android.
-
Flutter via FVM β the project pins its Flutter version with FVM. After cloning, run
fvm installin the repo root; it reads.fvmrc, downloads the right SDK, and creates the.fvm/flutter_sdksymlink that VS Code picks up automatically. - Android SDK / emulator β install via Android Studio (include the command-line tools and a virtual device). A step-by-step Windows 11 walkthrough is in GettingStarted.md.
-
Environment file β copy the template:
cp .env.example .env. The placeholders are fine for a debug build that doesn't need the live food-database backend; to run against your own backend see supabase-self-hosting.md. -
Dependencies & codegen:
Of the generated files, only
flutter pub get dart run build_runner build
env.g.dartneeds to stay (it's gitignored); revert other visible generated-file changes. - Run β start an emulator and launch a debug session (F5 in VS Code).
The repo also has a justfile with the common tasks β just build, just format, just test, just check_intl, and just ci (the full CI pipeline as a one-shot pre-flight check).
All pull requests must target the develop branch β never main. main is reserved for release merges only (one batched develop β main PR per release). A PR opened against main will be repointed to develop before review.
Workflow:
git fetch origin
git checkout -b feature/<short-name> origin/develop- Keep changes scoped β smaller, focused PRs are reviewed and merged much faster than sweeping ones.
- Reference the issue you're addressing in the PR description (e.g.
Closes #123). - Commit messages: short imperative subject, optionally with a
type(scope):prefix, e.g.:A body explaining the why is welcome but not required for small changes.feat(activity): add high-intensity interval exercise fix(home): correct kcal budget after onboarding
-
120-character line width (configured in
analysis_options.yaml). - Format with
just formatbefore committing β it deliberately targets onlylib/core,lib/features,lib/l10n, andtest, and skipslib/generated/. - Run
flutter analyzeandjust testlocally before opening the PR. -
just ciruns everything CI will run (install, format check, intl check, build, analyze, test).
Source strings live in lib/l10n/intl_en.arb; each supported locale has its own ARB file (intl_de.arb, intl_cs.arb, intl_it.arb, intl_pl.arb, intl_sk.arb, intl_tr.arb, intl_uk.arb, intl_zh.arb).
When adding a new string key, in the same PR you must:
- Add the key to every ARB file with a real translation (machine translation is acceptable as a starting point; native-speaker review is welcome post-merge). Don't leave the English string as a placeholder.
- Add a getter to
lib/generated/l10n.dart, following the existing style. - Add a matching
MessageLookupByLibrary.simpleMessage(...)entry to eachlib/generated/intl/messages_<locale>.dart. - Verify with
just check_intlβ CI runs the same check and fails the PR if anything is missing.
Important quirk: the files under
lib/generated/sayGENERATED CODE - DO NOT MODIFY BY HAND, but in this project they are currently maintained manually β the upstream generator's output conflicts with the repo's 120-character formatting. Do not runintl_translation:generate_from_arb; edit the files by hand until the generation pipeline is reconciled.
Hive type adapters and JSON serialization are produced by build_runner. Run just build after touching any source file with @HiveType, @HiveField, or @JsonSerializable annotations.
The app ships on both iOS and Android, and PRs must keep it that way:
- Any new dependency must support both platforms β check pub.dev before adding it.
- Platform-specific code needs a corresponding implementation (or an explicit fallback) on the other platform.
- A new Android runtime permission needs the matching
Info.plistentry on iOS, and vice versa.
| Repository | Purpose |
|---|---|
| OpenNutriTracker | The Flutter app itself. |
| OpenNutriTracker-Backend | The multi-source food database (USDA FDC + German BLS): schema, import pipeline, translation tooling. Self-hostable. |
| OpenNutriTracker.wiki | This wiki β documentation contributions welcome via issues/PR discussion. |
β οΈ Disclaimer: OpenNutriTracker is not a medical application. All information should be taken with caution β mistakes can happen. Consult a qualified professional for personal medical or dietary advice.