Dayever Labs
All apps

AI meal log

Caloriemeter

One photo is all a meal log needs

Status
Live on the App Store and Google Play
Devices
iPhone, iPad, Android, Apple Watch
Links

Overview

Caloriemeter is a meal logging app first released in May 2023. Photo analysis, cheering with friends, badges, weekly and monthly reports, a fasting timer and weight tracking live in one app. On iPhone it also supports Apple Health, home screen widgets, Siri and Apple Watch.

The app is built once in Flutter for iOS and Android, with the widgets and the Apple Watch app written separately in Swift. The server is hand-written in FastAPI and MySQL (MariaDB) and runs on a single Ubuntu server on AWS, with plain SQL and no ORM.

Stack

App
  • Dart
  • Flutter
  • Swift
  • SwiftUI
  • WidgetKit
  • HealthKit
  • Siri
On-device AI
  • Gemma 4
  • LiteRT-LM
Server
  • Python
  • FastAPI
  • Gunicorn
  • Uvicorn
  • MySQL (MariaDB)
  • Firebase Cloud Messaging
Infrastructure
  • AWS
  • Linux (Ubuntu)
  • nginx
  • Cloudflare
  • systemd
  • cron

Architecture

  1. App
  2. Cloudflare
  3. nginx
  4. Gunicorn · Uvicorn
  5. FastAPI
  6. MySQL

Problems and fixes

Analysing photos without a connection

Problem
Relying only on cloud AI means photo analysis stops working offline and costs money on every request.
Fix
Gemma 4 models in LiteRT-LM format are downloaded to the device and run there. A lighter model (2.59 GB) and a more accurate one (3.66 GB) are both offered, and the app only shows the ones the device has enough memory for. Which model and version to fetch is controlled by one small JSON manifest on the server, so models can change without an app release.
Result
On supported devices, photo analysis works with no internet connection.

Records landing on the wrong day

Problem
The database ran in UTC, so anything logged between midnight and 9 a.m. Korean time was grouped into the previous day in stats, streaks and badge checks. Adding nine hours field by field kept missing spots.
Fix
Instead of adding more corrections, the baseline was moved. Every database connection is pinned to Korean time, the scattered correction code was removed, and timestamps now leave the server through a single rule.
Result
Every date-based aggregate now follows the Korean calendar day, and most stored timestamps read correctly with no data migration.

Getting by on one server

Problem
Each request opened a fresh database connection, the notification inbox spent its time sorting, and friend notifications were inserted one row at a time.
Fix
Measured first, then fixed: connections come from a pool, the inbox got an index that matches its query, and multi-row writes are batched.
Result
Connection cost per request down 58%, inbox query 6.2 ms → 0.5 ms, notifying 100 friends 12.8 ms → 1.2 ms. Most read endpoints answer in 3–20 ms.

When the slow part is not the server

Problem
The app started to feel slow, yet CPU, memory and the database were all idle.
Fix
Two weeks of request logs (about 25,000 requests) and the Cloudflare location of live requests were collected and timed segment by segment. Server processing time had not changed; requests from Korean users were entering through overseas edge locations instead of Seoul.
Result
The cause was shown, with evidence, to be the network path outside the server. Per-segment timing now stays in the logs so the same situation can be recognised immediately.

Numbers

First release
2023
Badges
45
Inbox query
0.5 ms
Read API response
3–20 ms

Response times are measured inside the server.