A local-first calorie and macro tracking progressive web app. All data stays in your browser — no accounts, no servers, no subscriptions.
- Calorie & Macro Tracking — Log calories, protein, carbs, and fat
- Daily Goals — Set custom targets and track progress
- Streak Tracking — Build consistency with streak counts and history
- Multi-Profile Support — Multiple users on one device with optional PIN protection
- Offline-First — Works without internet; data stored in IndexedDB
- PWA — Installable on mobile and desktop
- Import/Export — JSON backup and restore
- Preact — 3KB React alternative
- Vite — Build tool
- vite-plugin-pwa — Service worker and manifest
- IndexedDB — Entry storage
- localStorage — Settings and profile data
- Node.js 18+
- npm
git clone https://github.com/yourusername/calorie-tracker.git
cd calorie-tracker
npm installnpm run devOpens at http://localhost:5173
npm run buildOutput in dist/
npm run deploysrc/
├── components/ # Preact components
│ ├── App.jsx # Main app shell
│ ├── EntryForm.jsx # Meal entry form
│ ├── DailyProgress.jsx # Progress ring and macro bars
│ ├── StreakDisplay.jsx # Streak counter and calendar
│ └── ...
├── utils/
│ ├── db.js # IndexedDB operations
│ ├── storage.js # localStorage (goals, profiles)
│ ├── date.js # Date formatting helpers
│ ├── streaks.js # Streak calculation logic
│ └── theme.js # Time-based theme switching
└── styles.css # All styles
| Data | Storage | Key |
|---|---|---|
| Entries | IndexedDB | calorie-tracker-db |
| Goals | localStorage | goals-{profileId} |
| Profiles | localStorage | profiles |
| Streaks | localStorage | streak-{profileId} |
entries store:
id— Auto-incremented primary keyname— Meal namecalories— Numberprotein,carbs,fat— Optional numbersdate— ISO date string (YYYY-MM-DD)profileId— Profile identifier
Indexes: date, profileId, profileDate (composite)
| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Production build |
npm run preview |
Preview production build |
npm run deploy |
Build and deploy to GitHub Pages |
npm run test:e2e |
Run Playwright tests |
npm run test:e2e:ui |
Run tests with UI |
- Chrome 90+
- Firefox 90+
- Safari 15+
- Edge 90+
Requires IndexedDB and CSS custom properties.
MIT