No description
- Go 99.2%
- Dockerfile 0.6%
- Makefile 0.2%
| admin | ||
| database | ||
| server | ||
| utils | ||
| vt | ||
| .gitignore | ||
| docker-compose.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| Makefile | ||
| README.md | ||
Calora Server
Backend server for the Calora nutrition tracking app. Written in Go, scrapes nutrition data from dining halls and serves it to the mobile app.
Features
- Data fetching - Automatically scrapes nutrition information from Virginia Tech dining halls (extensible to other sources)
- REST API - Serves nutrition data with caching and support for querying multiple dates at once
- Gemini Vision API - Food identification from photos, portion estimation, and nutrition label parsing
- IMAP support - Import meal data from email receipts
- Transform DSL - Lisp-based system for applying custom transformations to nutrition data
- Training data collection - Password-protected endpoint for submitting receipt photos and tagged items
- Auto cleanup - Removes old meal data and orphaned records from the database
The server checks for updates from configured sources on startup and caches everything locally. The cache invalidates automatically when source data changes.
Running
Configure via environment variables:
DATA_DIR- Where to store the database and transform files (default:./data)GEMINI_API_KEY- Google Gemini API key for vision featuresTRAINING_PASSWORD- Password for training data submissions
go build -o calora
./calora
The main API runs on port 8080, admin interface on 8081.
API
GET /api/{source}?date=YYYY-MM-DD- Get meals for a date (comma-separate multiple dates)POST /api/gemini/vision- Identify food, estimate portions, or parse labelsPOST /api/imap/fetch- Fetch emails via IMAPGET /api/transform/checksums- Get transform file checksumsGET /api/transform/std- Download standard libraryGET /api/transform- Download transformation rulesPOST /api/transform/error- Report transformation errorsPOST /api/training/verify- Verify training passwordPOST /api/training/submit- Submit training data
Uses SQLite with GORM for storage. Supports sources, meals, locations, items, allergens, flags, and training submissions.