Local-First personal food-quota diary as a PWA + Telegram WebApp.
- Stack: Vite + Svelte 5 (runes) + TypeScript + Tailwind v4 + Melt UI + Lucide + Motion One + localforage + vite-plugin-pwa.
- Storage: Telegram CloudStorage when opened inside Telegram; IndexedDB (via localforage) everywhere else.
- Charts: native SVG (no external chart library).
- Live: https://calorie.ordynski.com/
pnpm install
pnpm dev # Vite dev server on http://localhost:5173/
pnpm check # svelte-check (TypeScript + Svelte)
pnpm lint # ESLint
pnpm format # Prettier (writes)
pnpm format:check # Prettier (CI mode)
pnpm build # Production build to dist/
pnpm preview # Serve dist/ locally on http://localhost:4173/pnpm only. The repo pins the public npm registry via
.npmrc. If your shell wrapspnpm(e.g. via Aikido), usecommand pnpm <args>to bypass the wrapper.
Husky + lint-staged + svelte-check run on every commit. Don't bypass with --no-verify — the same checks run in CI and will fail the deploy.
Pushing to master triggers .github/workflows/deploy.yml:
pnpm install --frozen-lockfilepnpm lint && pnpm format:check && pnpm checkpnpm build- Upload
dist/artifact and deploy to GitHub Pages.
The custom domain (calorie.ordynski.com) is wired via public/CNAME. The GitHub repo Settings → Pages → Source must be set to GitHub Actions (one-time).
After the GitHub Pages deploy is live, create a bot via @BotFather and run /newapp against the deployed URL — no code changes needed. The Telegram script tag is loaded in index.html; the runtime detects Telegram via window.Telegram?.WebApp.initData and switches storage / theme accordingly.
Where the numbers and the catalog come from:
- Formulas —
docs/formulas.md— every formula and threshold the app uses (BMR, TDEE, k_factor, macro targets, energy balance, animation thresholds), each with plain-language summary, code form, source, and a pointer to the implementation. - Food database —
docs/food-database.md— all 39 catalog items grouped by category, with per-100 g (or per-piece) macros, baseline quotas, and an explainer onk_factorpersonalization.
For LLM-assisted work, CLAUDE.md at the repo root is the operating manual.
Design specs and implementation plans live under docs/superpowers/:
- Specs:
docs/superpowers/specs/ - Plans:
docs/superpowers/plans/
The original v1 design is docs/superpowers/specs/2026-04-27-calorie-app-design.md.