Skip to content
Vanamali-SimsPublic

About

maccy gang

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EaMoSleMo

"Eat more, sleep more, you'll be fine."

A wellness helper app that tracks your sleep, exercise, and nutrition, then recommends a full weekly meal plan that fits your goals and your grocery budget.


Sections

Section Route Status
Eat More /eat-more ✅ Weekly plan generator with Groq LLM
Sleep More /sleep-more Placeholder (mock data)
Exercise /exercise Placeholder (mock data)

Tech Stack

Layer Technology
Frontend Next.js 16 (App Router), TypeScript, Tailwind CSS v4
Package manager pnpm
Backend Python, FastAPI
LLM Groq (llama-3.1-8b-instant)
Deployment Vercel (frontend)

Repo Structure

eamoslemo/
├── frontend/
│   ├── app/
│   │   ├── layout.tsx
│   │   ├── page.tsx              ← Landing page
│   │   ├── eat-more/page.tsx     ← Weekly plan generator
│   │   ├── sleep-more/page.tsx
│   │   └── exercise/page.tsx
│   ├── components/               ← Nav, RouteCard, WombatPlaceholder, ApiStatus
│   ├── lib/
│   │   ├── api.ts                ← Base fetch helper
│   │   ├── eat-more-api.ts       ← Eat More endpoint calls
│   │   └── mock-data/            ← Frontend mock data (sleep/exercise)
│   └── types/index.ts            ← All shared TypeScript types
├── backend/
│   ├── main.py                   ← FastAPI app entry point
│   ├── requirements.txt
│   ├── .env.example              ← Copy to .env
│   └── app/
│       ├── config.py             ← Reads .env variables
│       ├── data/
│       │   ├── ingredients.json  ← 46 ingredients with prices
│       │   └── dish_catalog.json ← 30 dishes across 5 cuisines
│       ├── schemas/
│       │   └── eat_more.py       ← Pydantic request/response models
│       ├── services/
│       │   ├── pricing_service.py       ← Cost calculations (no LLM)
│       │   ├── catalog_service.py       ← Filtering + deterministic scoring
│       │   ├── llm_service.py           ← Groq ranking call + fallback
│       │   └── recommendation_service.py← Orchestration
│       └── routes/
│           ├── health.py         ← GET /health
│           ├── mock.py           ← GET /mock/health-data
│           └── eat_more.py       ← POST /eat-more/recommendations, GET /eat-more/dish/{id}
├── .editorconfig
├── .env.example                  ← Root env reference
├── .gitignore
└── README.md

Prerequisites

  • Node.js >= 18
  • pnpm — npm install -g pnpm
  • Python >= 3.10
  • Groq API key — free at console.groq.com

Quick Start

1 — Get a Groq API key

  1. Go to console.groq.com and sign up (free)
  2. Create an API key
  3. Copy it — you'll paste it into backend/.env below

2 — Backend setup

macOS / Linux

cd backend
cp .env.example .env          # then edit .env and paste your GROQ_API_KEY
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload

Windows (PowerShell)

cd backend
Copy-Item .env.example .env   # then edit .env and paste your GROQ_API_KEY
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
uvicorn main:app --reload

Backend runs at http://localhost:8000
Interactive API docs: http://localhost:8000/docs


3 — Frontend setup

macOS / Linux

cd frontend
cp .env.local.example .env.local
pnpm install
pnpm dev

Windows (PowerShell)

cd frontend
Copy-Item .env.local.example .env.local
pnpm install
pnpm dev

Frontend runs at http://localhost:3000


Running Both Together

Open two terminal tabs and run the backend in one and the frontend in the other. The landing page will show a green API Connected dot when both are up.


API Endpoints

Method Path Description
GET / Ping
GET /health Service health check
GET /mock/health-data Mocked Apple Health metrics
POST /eat-more/recommendations Generate weekly dish plan
GET /eat-more/dish/{id} Ingredient-level cost breakdown

POST /eat-more/recommendations — request body

{
  "weekly_budget": 80,
  "cuisine": "japanese",
  "mode": "bulk",
  "exclude_dish_ids": []
}
  • cuisine — null or omit for all cuisines
  • mode — "cut" | "maintain" | "bulk"
  • exclude_dish_ids — IDs already shown (used for "Gimme More Options")

How the Recommendation Engine Works

User request
    │
    ▼
1. Filter catalog by cuisine + mode + excluded IDs
    │
    ▼
2. Score candidates (affordability 40%, protein 30%, calories 30%)
    │
    ▼
3. Take top N (LLM_CANDIDATE_POOL_SIZE, default 40) → send to Groq
    │
    ▼
4. Groq ranks and adds a one-line reason per dish
    │        ← if Groq fails, fallback to step-2 order
    ▼
5. Return top 20 dishes with cost + reason

The LLM never does math. All price calculations happen in pricing_service.py. If the LLM fails, the backend still returns usable results.


Environment Variables

Backend (backend/.env)

Variable Default Description
GROQ_API_KEY — Your Groq API key (required)
GROQ_MODEL llama-3.1-8b-instant Groq model to use
FRONTEND_ORIGIN http://localhost:3000 CORS allowed origin
WEEKLY_RECOMMENDATION_COUNT 20 Dishes per plan
LLM_CANDIDATE_POOL_SIZE 40 Candidates sent to Groq

Frontend (frontend/.env.local)

Variable Default Description
NEXT_PUBLIC_API_BASE_URL http://localhost:8000 Backend base URL

Mock Data

The dish catalog and ingredient pricing live in backend/app/data/:

  • ingredients.json — 46 ingredients with price per pack
  • dish_catalog.json — 30 dishes across Japanese, Indian, Mediterranean, Mexican, and American cuisines

Frontend mock data (for Sleep and Exercise pages) lives in frontend/lib/mock-data/index.ts.


Development Notes

  • No auth, no database — keep it simple
  • Wombat mascot is stubbed in frontend/components/WombatPlaceholder.tsx
  • Sleep/Exercise scores are hardcoded — wire up real logic when ready
  • 3D/globe feature can be added later without refactor (no heavy 3D libs installed)
  • Calorie-health integration (linking Exercise data to Eat More) is a future task

Team Split Suggestion

Dev Ownership
Dev 1 /eat-more refinements, dish catalog expansion, budget logic
Dev 2 /sleep-more + /exercise — real score logic, health data
Dev 3 Backend API, new endpoints, data models, Groq prompt tuning

About

maccy gang

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages