4b6c3f6ae9f66f2c644d7f57ace7800e0d49ead0
@ketopath/shared:
- tracking/schema.ts — Zod schemas for WeightEntry input (weight, optional
measurements/notes/energy/sleep/hunger, photo URLs) and FastEvent start /
update, plus PROTOCOL_DEFAULT_MINUTES table
- planner/macros.ts — macrosForPhase(): protein 1.6-1.8g/kg, netCarb 25/60/120g
by phase, fat = remainder (PRD §9.3)
- planner/matchmaking.ts — pure matchMeals() that filters by exclusion tags,
phase compatibility and meal category, then scores by euclidean distance
from the meal's macro target with a 1.5 penalty for recently-consumed recipes;
DEFAULT_MEAL_SHARE constant (25/35/10/30 %)
- 5 new unit tests cover exclusion, phase, recency, topN, category mismatch
apps/api:
- modules/tracking/weight.routes.ts — GET /me/weight-entries (last 60),
POST /me/weight-entries with upsert on (userId, date); encrypted fields
serialised to/from JSON strings
- modules/tracking/fast.routes.ts — GET, POST (start) and PATCH (update) on
fast events; symptoms stored as encrypted JSON
- modules/plan/plan.routes.ts — POST /me/meal-plans:
- reads profile + preferences, computes BMR (Mifflin-St Jeor), TDEE, daily
kcal target with the phase-dependent deficit, then macros via macrosForPhase
- upserts a MealPlan rooted at Monday-of-this-week, wipes prior slots, and
fills 28 slots running matchMeals per (day, meal) with a recent-2-day
rolling exclusion list to keep variety
- selected recipe + 4 alternatives per slot
- GET /me/meal-plans/current returns the active plan with selected/alternatives
@ketopath/db:
- prisma/seed-recipes.ts — 16 italian keto recipes (4 per meal type) with
estimated macros per serving and phase compatibility
- prisma/seed.ts — idempotent insertion (skip on existing name match)
Verified end-to-end with sign-up → create profile (Michele PRD persona) →
generate plan: 28 slots filled, daily target 1399 kcal / 137 P / 83 F / 25 C,
matchmaking distributes 4 different breakfasts across the first 4 days as
the recent-consumed penalty kicks in.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KetoPath
Web app responsive multi-utente per la gestione personalizzata di chetogenica e digiuno intermittente.
Vedi
CLAUDE.mdper le convenzioni di progetto edocs/PRD_KetoPath.docxper il PRD completo.
Prerequisiti
- Node.js
>=20.11(vedi.nvmrc) - pnpm
>=9(corepack enable && corepack prepare pnpm@latest --activate)
Getting started
pnpm install
pnpm typecheck
pnpm lint
pnpm format:check
Struttura del monorepo
apps/
web/ # Next.js 14 frontend (da scaffoldare)
api/ # Fastify backend (da scaffoldare)
packages/
shared/ # Tipi e utility di dominio
ui/ # Componenti UI riusabili
db/ # Prisma client (da scaffoldare)
tsconfig/ # tsconfig presets condivisi
eslint-config/ # ESLint config condivisa
docs/
PRD_KetoPath.docx
Script disponibili
pnpm dev— avvia tutte le app in parallelopnpm dev:web/pnpm dev:api— avvia singola apppnpm build— build di produzionepnpm lint/pnpm lint:fix— ESLintpnpm format/pnpm format:check— Prettierpnpm typecheck—tsc -bsu tutto il monorepopnpm test— Vitest (unit test)pnpm test:e2e— Playwright (E2E)
Languages
TypeScript
97.3%
CSS
1.7%
JavaScript
1%