Skip to content

pygillier/hunger-tracker

Repository files navigation

Hunger Tracker

Small mobile-first web app to track:

  • when you feel hungry (or want to eat)
  • what you ate
  • when each event happened

Stack:

  • FastAPI + SQLite
  • Next.js (App Router + Tailwind)
  • Single Docker container (nginx + supervisord)

Project structure

  • backend/ — FastAPI API and SQLite models
  • frontend/ — Next.js mobile-first UI
  • Dockerfile — mono-container build (frontend + backend + nginx)

Features

  • Log hunger events with a free-text feeling
  • Log meal events (food name, quantity, note)
  • Chronological timeline of all events

Deploy

No configuration required. Mount a volume to persist data.

docker build -t hunger-tracker .
docker run -d --name hunger-tracker \
  -p 80:80 \
  -v hunger_data:/app/data \
  --restart unless-stopped \
  hunger-tracker

Open: http://localhost

Optional env vars

Variable Default Description
DATABASE_URL sqlite:////app/data/hunger_tracker.db SQLite path inside container
FRONTEND_ORIGIN * Restrict CORS to a specific origin, e.g. https://tracker.example.com
LOG_LEVEL INFO DEBUG, INFO, WARNING, or ERROR

Pass with docker run -e FRONTEND_ORIGIN=https://tracker.example.com ...

Local development

Using Task

task install   # install all dependencies
task dev       # start backend (port 8000) and frontend (port 3000) in parallel

Manual

Backend

cd backend
uv sync
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Frontend

cd frontend
npm install
npm run dev

API endpoints

  • POST /meal-events
  • GET /meal-events
  • GET /timeline
  • GET /health

About

Track hunger events

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors