Nutrition & fitness tracking — on your phone
Food diary · Barcode scan · Workouts · Widgets · Goals · Progress
Free on Android · Estimates, not medical measurements
Trackwise is a mobile-first nutrition and fitness app. Log meals, scan barcodes, train from an exercise library, set personal goals, and review progress — in one place.
Who it’s for: people who want everyday food and training awareness with clear estimates — not a medical device, and not AI meal recognition.
Availability today: free core tracking on Android via Google Play. Home-screen Daily and Workout widgets are included. iOS is planned for later.
| Auth | Email + password with 8-digit OTP verification · Optional Google OAuth · Password recovery OTP |
| Locales | English · Finnish · Swedish · Vietnamese |
| Platforms | Android first · iOS later |
flowchart LR
A[Sign up · verify OTP] --> B[Setup goals]
B --> C[Log food · scan · train]
C --> D[Review diary & progress]
D --> E[Adjust targets]
style A fill:#202020,stroke:#00D95F,color:#fcfcfc
style B fill:#00D95F,stroke:#13873c,color:#202020
style C fill:#3B82F6,stroke:#1e40af,color:#fff
style D fill:#C47F1A,stroke:#8a5c00,color:#fff
style E fill:#635BFF,stroke:#3d37a8,color:#fff
Bootstrap and route guards keep welcome, incomplete setup, recovery sessions, and the home tabs distinct — a welcome flag alone does not mean the profile is complete.
This monorepo holds the mobile app plus two Next.js web packages and Supabase:
| Path | Role |
|---|---|
/ (root) |
Expo / React Native mobile app |
admin/ |
Internal Admin console (localhost:3000) |
dashboard/ |
Public marketing site for trackwise.one (localhost:3001) |
supabase/ |
Migrations, Auth email templates, Edge Functions, local CLI config |
Expand mobile src/ layout
app/ # Expo Router screens & layouts
assets/ # Branding, fonts, workout exercise art
supabase/ # Migrations, templates, functions, seed
widgets/ # Home-screen widget UI (iOS SwiftUI / Android Compose)
src/
├── components/ui/ # Shared UI primitives
├── features/ # Domain: auth, diary, scan, workouts, goals, widgets
├── i18n/ # Locale resources (en, fi, sv, vi)
├── lib/ # Supabase client, query client, analytics adapters
├── stores/ # Zustand — active workout draft only
└── theme/ # Design tokens (see DESIGN.MD)
| Layer | Choice |
|---|---|
| Mobile | Expo SDK 58, Expo Router, React Native, TypeScript |
| UI | NativeWind / Tailwind, Lucide, Trackwise tokens (#00D95F) |
| Fonts | Bricolage Grotesque · JetBrains Mono |
| Server state | TanStack Query |
| Forms | React Hook Form + Zod |
| Backend | Supabase Auth, Postgres, RLS, Storage, Edge Functions |
| Food lookup | Open Food Facts (barcode) |
| Images | Unsigned Cloudinary preset (food / avatar / custom exercise) |
| Admin / web | Next.js App Router (separate packages under admin/, dashboard/) |
| Tests | Vitest |
- Node.js 22+ and npm
- Physical Android phone (primary) or iOS device
- Expo Go for SDK 58 — or a development build when native modules require it
- Optional: Docker Desktop for local Supabase
npm install
# create .env.local (see Configuration)
npm start # Expo tunnel by default
# or: npm run start:lanScan the QR code with Expo Go (SDK 58).
| Script | Purpose |
|---|---|
npm start / npm run start:lan |
Expo development server |
npm run start:clear |
Tunnel + clear Metro cache |
npm run typecheck |
TypeScript |
npm run lint |
ESLint |
npm test |
Vitest |
npm run supabase:start |
Local Supabase (Docker) |
npm run supabase:status / supabase:stop |
Local status / stop |
Apply schema to a linked project:
npx supabase db push
npx supabase functions deploy delete-accountHome screen widgets are not available in Expo Go. Use a development or store build after installing dependencies:
npm install
npx expo prebuild --cleanprebuild generates android/ and ios/ (gitignored CNG). Rebuild after changing expo-widgets plugin options in app.json.
# Android
eas build --platform android --profile development
eas build --platform android --profile production
# iOS
eas build --platform ios --profile development
eas build --platform ios --profile productionLocal native run after prebuild: npm run android / npm run ios.
Pin Trackwise on the home screen so today’s calories and workout stay visible without opening the app. Widgets ship in the Play Store / development / production build, not Expo Go. Sign in and open Trackwise once so numbers can sync.
How to add them (Android)
- Install Trackwise from Google Play (or a matching APK).
- Open the app while signed in so today’s diary and workout can write a snapshot.
- Long-press an empty area on the home screen → Widgets → Trackwise.
- Add Trackwise Daily and/or Trackwise Workout, then resize if the launcher allows it.
- Tap Daily to open the diary (
trackwise:///). Tap Workout to open today’s plan or session.
| Trackwise Daily | Trackwise Workout | |
|---|---|---|
| Shows | Calories left, then carbs / protein / fat / water as eaten/target cards with bars |
Today’s planned or completed session |
| Size | One 4×4 Glance layout (no iOS-style small/medium/large) | 4×2, resizes horizontally |
| Fourth Daily card | Water (fiber is not in the snapshot) | — |
| Offline | Last snapshot until you open the app again | Same |
In-app Account → Help and the public site (trackwise.one/support, features) describe the same steps for users.
Developers
Shared snapshots live in src/features/widgets/. Platform UI is in widgets/TrackwiseDaily.* and widgets/TrackwiseWorkout.*. The app writes JSON-serializable props; native widget runtimes cannot use React Query, Zustand, or a live Supabase session.
- Android snapshots call the native
ExpoWidgetsmodule and do notimport()widgets/*.tsxat runtime (that Metro extra bundle timed out and left the home widget on the skeleton). Layouts are compiled into the APK (generateExpoWidgetsLayoutRegistry). - After changing
widgets/*.android.tsx, rebuild that registry, install the APK, and remove then re-add the home widget. Debug reinstall often keepsexpo.modules.widgetsSharedPreferences (previous layout). - Glance ignores
fillMaxWidth(fraction)(always 100%), so the Daily 2×2 uses fixedwidth().Box/ overlaying a number inside a calorie ring crashes withLoading widget. Android tap-to-open is a Glance rootactionStartActivityon snapshotopenUrl;widgetURLis iOS-only in SDK 58 (plugins/apply-android-widget-open-app.jsre-applies the patch afternpm install). - Android widgets use system type (
fontSize/fontWeightonly). iOS layouts request Bricolage Grotesque and JetBrains Mono; the widget extension still needs those TTFs inUIAppFontsor it falls back to San Francisco. - Logout / account switch / deletion replace snapshots with a signed-out state so the previous user’s numbers are not left on the home screen.
iOS (later / device testing)
- Widgets require iOS 17+ (
containerBackground). Small = calorie ring; medium/large = ring + 2×2 cards. - Apple Developer: App Group
group.com.trackwise.apponcom.trackwise.appand extensioncom.trackwise.app.widgets. - EAS provisions the extension when those identifiers exist on the team.
Android packaging
- Application ID stays
com.trackwise.app. No extra Play Console widget listing is required.
Widgets keep the last valid snapshot when offline. They do not poll Supabase in the background.
Create .env.local in the repo root (gitignored). Expo prefers variables already set in the shell over this file.
Full .env.local template
# ── Supabase (required) ────────────────────────────────────────────
# Hosted project URL + publishable (anon) key from Project Settings → API.
# EXPO_PUBLIC_SUPABASE_KEY is accepted as an alias for the publishable key.
EXPO_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT.supabase.co
EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_publishable_key
# ── Media (optional — Create Food / avatar / custom exercise) ──────
# Unsigned upload preset only. Never put Cloudinary API secrets in the app.
EXPO_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloud_name
EXPO_PUBLIC_CLOUDINARY_UPLOAD_PRESET=your_unsigned_preset
# ── Public links (optional until real URLs exist) ──────────────────
# EXPO_PUBLIC_PRIVACY_POLICY_URL=https://trackwise.one/privacy
# EXPO_PUBLIC_TERMS_OF_SERVICE_URL=https://trackwise.one/terms
# EXPO_PUBLIC_SUPPORT_EMAIL=support@example.com
# EXPO_PUBLIC_ADMIN_URL=http://localhost:3000Hard rules
- Never put the service-role key, database password, or Cloudinary API secret in app code or
EXPO_PUBLIC_* - Client uploads are capped at 1 MB (food, avatar, custom exercise)
- Avatars use Cloudinary folder
trackwise/avatars; only the HTTPS URL is stored onprofiles.avatar_url - System exercise art lives under
assets/images/workout/exercises/and the Storage bucketexercise-images
The app uses in-app 8-digit OTP (not magic links). Align Dashboard settings with supabase/templates/:
- Authentication → Email — Confirm email ON · OTP length
8 - Confirm signup template — paste
supabase/templates/confirmation-otp.html({{ .Token }}, no{{ .ConfirmationURL }}) - Reset password template — paste
supabase/templates/recovery-otp.html
Local supabase/config.toml already wires this for supabase start. Details: supabase/README.md.
Docker Desktop must be running. The npm-scoped CLI is enough (no global install).
npm run supabase:start
npm run supabase:status| Service | URL |
|---|---|
| API | http://127.0.0.1:54321 |
| Studio | http://127.0.0.1:54323 |
| Mailpit (auth emails) | http://127.0.0.1:54324 |
Point the current PowerShell session at local keys, then start Expo from the same shell:
$supabase = npx --yes supabase status -o json | ConvertFrom-Json
$env:EXPO_PUBLIC_SUPABASE_URL = $supabase.API_URL
$env:EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY = $supabase.PUBLISHABLE_KEY
npm run start:lanReturn to Cloud values from .env.local:
Remove-Item Env:EXPO_PUBLIC_SUPABASE_URL, Env:EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY
npm startStop without wiping the local DB volume:
npm run supabase:stopDo not run supabase db reset, supabase stop --no-backup, or delete Docker volumes unless losing local data is intentional.
Expo --tunnel only forwards the Metro bundle — not Supabase. Prefer a private Tailscale serve of port 54321 (API only), never Funnel/ngrok for the local stack. See operational notes in git history / team docs for the exact tailscale serve flow.
Redirect URI is resolved at runtime (src/features/auth/redirect.ts):
| Environment | Redirect shape |
|---|---|
| Expo Go tunnel | exp://<tunnel-host>.exp.direct/--/auth/callback |
| Expo Go LAN | exp://<lan-ip>:8081/--/auth/callback |
| Dev / store build | trackwise://auth/callback |
Supabase → Authentication → URL Configuration
- Site URL:
trackwise://auth/callback - Redirect allowlist (preferred wildcards):
exp://**/--/auth/callback
exp://**
trackwise://auth/callback
trackwise://**
Google Cloud Console authorizes only the Supabase callback
(https://<project-ref>.supabase.co/auth/v1/callback) — not the app deep link. Keep the Google client secret in Supabase provider settings only.
Tunnel is the most reliable Expo Go OAuth path on Android; LAN Custom Tabs often fail to return exp://192.168.x.x. Development builds use trackwise://auth/callback.
| Package | Port | Docs |
|---|---|---|
| Admin console | 3000 |
admin/README.md |
| Public site (trackwise.one) | 3001 |
dashboard/README.md |
cd admin && npm install && npm run dev
cd dashboard && npm install && npm run devAdmin requires an admin row in public.user_roles (bootstrap via admin_bootstrap_grant — see admin README). Local seed includes test@admin.com / testadmin after db reset.
- User-owned tables use RLS keyed to
auth.uid(); client filters are not a security boundary - Account deletion uses the
delete-accountEdge Function with the service role on the server only - Calorie and activity values are estimates for everyday tracking — not medical measurements or advice
- Barcode scanning looks up products on Open Food Facts; Trackwise does not claim AI meal recognition
Policy drafts: Privacy · Terms
See DESIGN.MD together with src/theme/ and src/components/ui/.
| Token | Value |
|---|---|
| Primary | #00D95F |
| Display | Bricolage Grotesque |
| Body | Bricolage Grotesque |
| Mono | JetBrains Mono |
This repository powers the Trackwise product (package.json is "private": true).
- Branch from the current default branch
- Keep changes scoped; follow
AGENTS.mdand package-localAGENTS.mdfiles - Run
npm run lint,npm run typecheck, andnpm testbefore opening a PR - Prefer small PRs with a clear “why”
- Do not commit secrets, force-push shared history, or reset hosted production without authorization
No open-source license file is published in this repository. Treat the codebase as proprietary unless the maintainers state otherwise.
