How fadhilamadan/nutrio works
Nutrio is a single-page AI food and macro tracker. A signed-in user submits a meal photo and optional description; server-side analysis returns estimated nutrition for review, then meal records are saved to the user's Notion workspace and shown against daily targets. The app also supports meal history, profile, settings, Google sign-in, reminders, theming, and PWA installation. The README documents the broad frontend-to-API flow; source excerpts confirm key route, auth, validation, AI, and Notion calls. Some unsampled screen and hook wiring is therefore shown only where documented.
Main entry points: api.ts API client · auth.ts Session and auth · analyze-food/route.ts Analysis endpoint · meals/route.ts Meals endpoints
Components 25
App experience
- App shell
src/components/layout/app-shell.tsx - Profile
src/features/auth/components/profile-screen.tsx - User endpoint
src/app/api/users/me/route.ts
Meal tracking
- Meal analysis
src/features/analyze/components/analyze-food-screen.tsx - Result editor
src/features/analyze/components/ai-analysis-result-editor.tsx - Daily dashboard
src/features/dashboard/components/today-dashboard.tsx - Meal history
src/features/history/components/history-screen.tsx - Analysis endpoint
src/app/api/analyze-food/route.ts - Meals endpoints
src/app/api/meals/route.ts - Meal item endpoint
src/app/api/meals/[id]/route.ts
Goals and settings
- Target form
src/features/targets/components/target-form.tsx - Settings form
src/features/settings/components/settings-form.tsx - Settings endpoint
src/app/api/settings/route.ts - Targets endpoint
src/app/api/targets/route.ts
Identity and integrations
- API client
src/lib/api.ts - Session and auth
src/lib/auth.ts - Request validation
src/lib/validation.ts - AI provider adapters
src/lib/ai/openrouter.ts - Meal data access
src/lib/notion/meals.ts - Settings data access
src/lib/notion/settings.ts - User data access
src/lib/notion/users.ts - Notion workspace
Other components
- User
- Google sign-in
- AI providers
Connections 35
- User → App shell: uses
- App shell → Meal analysis: opens
- Meal analysis → API client: submits image
src/features/analyze/components/analyze-food-screen.tsx - API client → Analysis endpoint: requests analysis
- Analysis endpoint → Session and auth: requires session
src/app/api/analyze-food/route.ts - Analysis endpoint → Request validation: validates input
src/app/api/analyze-food/route.ts - Analysis endpoint → AI provider adapters: selects provider
src/app/api/analyze-food/route.ts - AI provider adapters → AI providers: analyzes image
src/lib/ai/openrouter.ts - Meal analysis → Result editor: edits results
src/features/analyze/components/analyze-food-screen.tsx - Result editor → API client: saves meal
- API client → Meals endpoints: requests meals
- Meals endpoints → Session and auth: requires session
src/app/api/meals/route.ts - Meals endpoints → Request validation: validates writes
src/app/api/meals/route.ts - Meals endpoints → Meal data access: reads and writes
src/app/api/meals/route.ts - Meal item endpoint → Session and auth: requires session
src/app/api/meals/[id]/route.ts - Meal item endpoint → Meal data access: updates meal
src/app/api/meals/[id]/route.ts - Meal data access → Notion workspace: persists meals
- Daily dashboard → API client: loads today's meals
- Meal history → API client: loads meal history
- API client → Settings endpoint: requests settings
- Settings endpoint → Session and auth: requires session
src/app/api/settings/route.ts - Settings endpoint → Request validation: validates updates
src/app/api/settings/route.ts - Settings endpoint → Settings data access: reads and writes
src/app/api/settings/route.ts - Settings data access → Notion workspace: persists settings
- Settings form → API client: saves preferences
- API client → Targets endpoint: requests targets
- Targets endpoint → Session and auth: requires session
src/app/api/targets/route.ts - Targets endpoint → Notion workspace: reads and writes
- Target form → API client: saves goals
- User → Google sign-in: signs in
- Session and auth → User data access: upserts user
src/lib/auth.ts - User data access → Notion workspace: stores profile
- API client → User endpoint: requests profile
- User endpoint → Session and auth: requires session
src/app/api/users/me/route.ts - Session and auth → Google sign-in: authenticates