904f1c43b3d3725acc6f4fc98443c6b9a3b36a0b
Some checks failed
CI / Build & test backend (push) Failing after 13m38s
Backend: - backend/Dockerfile: multi-stage build (local + ci-image targets) - eclipse-temurin:21-jre-alpine runtime, non-root user caloriecounter - DOCKER_BUILDKIT=0 + native JAR build pattern for ARM64 Pi runner - pom.xml: add spring-boot-starter-actuator - application.yml: expose /actuator/health (liveness probe for Docker healthcheck) CI/CD: - .gitea/workflows/ci.yml: Maven test on pi-runner (push + PR) - .gitea/workflows/docker.yml: build + push calorie-counter-api:latest/:sha - Triggers after CI passes (workflow_run) to avoid OOM on single-capacity Pi - Docker login before Maven build (avoids daemon timeout after heavy CPU) - Deploys immediately via docker.sock to /home/andris/homelab/calorie-counter/ Mobile: - api.ts: update baseURL default to https://calories.amlab.dev (LAN fallback: http://10.18.1.135:8085 via WireGuard) Homelab changes pushed directly via Gitea MCP: - homelab/calorie-counter/docker-compose.yml (port 8085, 120s start_period) - homelab/calorie-counter/.env.example - homelab/.gitea/workflows/deploy-calorie-counter.yml (cron every 10 min) - homelab/backup/backup.sh (added calorie-counter pg_dump)
Calorie Counter
AI-powered calorie tracking app — Spring Boot backend + React Native mobile.
Architecture
Mobile (React Native + TypeScript)
│ REST API (JWT)
Backend (Spring Boot 3.2 / Java 21)
│
┌─────────────────────────────────┐
│ PostgreSQL Flyway │
│ OpenFoodFacts API (food DB) │
│ OpenAI Vision API (AI meals) │
└─────────────────────────────────┘
Features
- Manual food search via OpenFoodFacts
- Barcode scan → auto-fill nutrition
- Photo meal logging with AI detection (OpenAI Vision)
- Confidence-aware calories:
500 kcal ± 80 kcal (85% confidence) - Daily calorie dashboard + macro tracking
- BMR-based personalised calorie targets (Mifflin-St Jeor)
- AI correction feedback loop → improves suggestions over time
- Repeat last meal one-tap shortcut
Structure
backend/ Spring Boot REST API
mobile/ React Native app
docs/ Requirements, traceability matrix
idea/ Original product research & wireframes
Getting Started
Backend
cd backend
# Required environment variables
export DB_URL=jdbc:postgresql://localhost:5432/caloriecounter
export DB_USERNAME=caloriecounter
export DB_PASSWORD=<your-db-password>
export JWT_SECRET=<256-bit-secret>
export OPENAI_API_KEY=<your-openai-key>
mvn spring-boot:run
Mobile
cd mobile
npm install
npx react-native run-ios # or run-android
Requirements & Traceability
See docs/PLAN-AND-REQUIREMENTS.md and docs/traceability.csv.
35 requirements tracked across 3 phases — all implemented.
Security
- Passwords: BCrypt cost 12
- JWT: HS256, 1hr expiry, per-request user existence check
- All secrets via environment variables — nothing hardcoded
- Input validation on all endpoints (Jakarta Validation)
- User data isolation enforced at service layer
Description
AI-powered calorie tracking app — Spring Boot backend + React Native mobile. Hybrid food logging: manual search, barcode scan, photo AI analysis with confidence-aware calorie display.
Languages
Java
56.1%
TypeScript
42.8%
Dockerfile
1.1%