Android calorie tracker with AI meal analysis
Find a file
Daniel f14b433085
Some checks failed
Android CI / build (push) Successful in 1m33s
Web CI / test (push) Failing after 1m23s
Android Release / release-apk (push) Failing after 22s
Replace Kotlin app with Capacitor WebView wrapper
The native Kotlin/Compose app is replaced by a Capacitor shell that
loads the existing Svelte web app from the self-hosted server URL,
set via APP_SERVER_URL secret at build time.

- web/capacitor.config.ts: appId com.danvics.calorieai, reads
  APP_SERVER_URL env var so the WebView points at the live server
- web/android/: Capacitor-generated Android project (gradlew included)
- AndroidManifest.xml: added CAMERA, READ_MEDIA_IMAGES, READ_EXTERNAL_STORAGE
- MealForm.svelte: split file input into Camera (capture=environment)
  and Gallery buttons so both options are accessible natively
- release.yml: npm ci → npm run build → cap sync → gradlew assembleDebug;
  removed manual Gradle installation, uses bundled gradlew instead
- package.json: Capacitor packages as devDependencies (not shipped in
  the Docker server image)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 18:14:53 +02:00
.forgejo/workflows Replace Kotlin app with Capacitor WebView wrapper 2026-05-20 18:14:53 +02:00
app Add diet history context to AI meal analysis on both platforms 2026-05-20 16:12:25 +02:00
web Replace Kotlin app with Capacitor WebView wrapper 2026-05-20 18:14:53 +02:00
.gitignore Add web auth and app navigation 2026-05-19 17:59:02 +02:00
build.gradle Rewrite Android app with Kotlin Compose 2026-05-19 19:35:15 +02:00
gradle.properties Rewrite Android app with Kotlin Compose 2026-05-19 19:35:15 +02:00
README.md Add release APK workflow and server plans 2026-05-20 03:27:25 +02:00
settings.gradle Add Calorie AI Android app 2026-05-17 17:43:16 +02:00

Calorie AI

Native Android and Dockerized web calorie tracker with meal images, AI nutrition estimates, server-backed plans, and admin-configurable AI models.

Features

  • Add meals by description, portion estimate, and uploaded image.
  • Analyze meals through OpenAI-compatible chat completions.
  • Uses a vision model for food image calorie and portion estimates.
  • Uses an advice model to normalize calories, protein, carbs, fat, fruit servings, vegetable servings, food groups, and notes.
  • Stores daily meal entries locally on Android or in browser local storage.
  • Stores generated web weight-loss plans on the server in web/data/plans.json.
  • Shows daily totals plus charts for macros, 7-day calories, and fruit/vegetable intake.
  • Admin settings control API base URL, API key, image model, and nutrition/advice model. The two model fields can contain the same model name.

Android Build

Open this folder in Android Studio and run the app configuration, or build with Gradle if available:

gradle :app:assembleDebug

Forgejo Actions builds the debug APK on every push to main and uploads it as the calorie-ai-debug-apk artifact.

Tagged versions also build an installable APK named calorie-ai-vX.Y.Z.apk and attach it to a Forgejo release through the Android Release workflow.

Install With Obtainium

Use the Forgejo releases page as the source:

https://git.danvics.com/danvics/calorie-ai-android/releases

If Obtainium asks for a direct APK URL, use the latest release asset URL pattern:

https://git.danvics.com/danvics/calorie-ai-android/releases/download/v0.1.1/calorie-ai-v0.1.1.apk

Recommended Obtainium setup:

  • App source: HTML or Gitea/Forgejo if your Obtainium version offers it.
  • URL: https://git.danvics.com/danvics/calorie-ai-android/releases
  • APK link filter: calorie-ai-.*\.apk
  • Version extraction: release tag, for example v0.1.1.

The APK is a debug build, so Android may require allowing installs from Obtainium and accepting the debug signing certificate.

Web Frontend

The web frontend lives in web/. It serves an authenticated browser UI and a tiny Node proxy at /api/chat so OpenAI-compatible endpoints are called server-side instead of directly from the browser.

Run it with Docker:

cd web
docker compose up -d --build

Then open:

http://127.0.0.1:8095

The Docker web server creates credentials on first boot in web/data/auth.json if CALORIE_AI_WEB_PASSWORD and CALORIE_AI_SESSION_SECRET are not supplied. To pin credentials, copy web/.env.example to web/.env and set strong values before starting Docker Compose.

AI Endpoint

The app expects an OpenAI-compatible endpoint at:

{API base URL}/chat/completions

Example base URLs:

  • https://api.openai.com/v1
  • An emulator host-loopback URL ending in :11434/v1 for a local OpenAI-compatible service

Default admin PIN is admin. Change it in the Admin AI Settings panel after first launch.

The web frontend stores AI settings in browser local storage after web login, while generated plan versions are stored server-side. The web login is separate from the Android admin PIN.