Skip to content
Android Health & Fitness App

Sehatmand — Offline-First Pakistani Health & Nutrition App

Offline-first Android health app for Pakistan: calorie/macro tracking against a science-based target, a localized food database, step counting, weight/BMI, and workouts — with optional cloud sync.

Category

Android Health & Fitness App

Timeline

June 2026

Stack

14 core technologies

Preview of Sehatmand — Offline-First Pakistani Health & Nutrition App

Selected stack

Kotlin
Jetpack Compose
Material 3
MVVM

Highlights

Project snapshot

  • Offline-first by design: Room is the single source of truth (7 entities and DAOs) behind a pure-Kotlin EnergyEngine — Mifflin–St Jeor BMR/TDEE, goal-adjusted targets with a safe floor, and South-Asian BMI cut-offs — covered by 12 JUnit tests.
  • Two-way Supabase sync layered on top of local data via a WorkManager @HiltWorker (6h periodic plus a 10s debounced one-shot), so the app stays fully usable with no network.
  • Pakistan-localized domain: a 94-item food database with English/Urdu names and Sehri/Iftar meal types, a Ramadan-aware desi diet-plan generator, and 31 workouts driven by 49 Lottie animations.

Overview

A culturally-grounded health tracker that works without a network

Sehatmand (Urdu for "healthy") is a Pakistan-focused Android app for tracking calories and macros against a science-based daily target, logging meals from a localized food database, counting steps, recording weight and BMI, and following at-home workouts. Everything works offline, with cloud sign-in and sync layered on top.

It is a single-module Compose app following MVVM with a repository layer: 52 Kotlin source files across feature, data, domain, and DI packages. Room is the source of truth, a pure-Kotlin domain engine owns all the health math, and Hilt wires the database, repositories, the Supabase client, and a WorkManager sync pipeline.

Problem

Generic calorie apps don't fit a Pakistani user

  • Mainstream trackers lack Pakistani foods and Ramadan-specific meal structure (Sehri/Iftar), making accurate logging tedious.
  • Standard BMI thresholds misclassify South-Asian body composition, which has different health-risk cut-offs.
  • Most apps assume constant connectivity, which is unreliable for many users, yet still gate core tracking behind the network.
  • Calorie targets are often opaque, with no transparent BMR/TDEE basis the user can trust.

Solution

Offline-first tracking with a transparent, localized engine

  • Make Room the single source of truth so onboarding, diary, activity, weight, and workouts all work with zero connectivity.
  • Compute every target from a testable EnergyEngine (Mifflin–St Jeor BMR → TDEE → goal-adjusted target with a calorie floor) and apply South-Asian BMI cut-offs.
  • Seed a Pakistani food database with Urdu names and Ramadan-aware meal types, and layer optional Supabase sync on top for multi-device backup.

Core Features

A full daily-health loop, localized for Pakistan

Nutrition & Diary

  • Food diary grouped by meal type including Sehri and Iftar, with running day totals
  • Search a 94-item Pakistani food database by English or Urdu name, pick servings and meal
  • Ramadan-aware desi diet-plan generator (regular and Sehri/Iftar templates, vegetarian filter)

Energy & Targets

  • Personalized daily calorie target from Mifflin–St Jeor BMR → TDEE with a safe floor
  • Home calorie ring (target − food + active calories) plus macro split (30/40/30)
  • Weight logging with BMI using South-Asian category cut-offs

Activity & Workouts

  • Foreground step-counter service using the hardware TYPE_STEP_COUNTER sensor
  • Steps ring, distance, active calories, and running minutes
  • 31-exercise at-home workout library with male/female Lottie animations and a routine player

Accounts & Sync

  • Supabase auth (Google OAuth redirect + anonymous sign-in)
  • Two-way Room↔Supabase sync of profile, diary, activity, weight, water, and workouts
  • Automatic background sync scheduled with WorkManager, plus a manual "Sync now"

Architecture

MVVM over Room as source of truth, with layered cloud sync

Compose UI (6 feature screens) → @HiltViewModel (StateFlow) → Repositories (7 interfaces, expose Flow) → Room (7 entities, source of truth) → SyncManager push/pull → WorkManager @HiltWorker (6h + debounced) → Supabase (Auth + Postgrest)
  • Domain math lives in a dependency-free EnergyEngine (BMR/TDEE/target/active-calories/BMI/macros) with 12 JUnit tests, plus a separately-tested DietPlanGenerator.
  • Hilt provides the database, DAOs, repositories, Supabase client, and sync worker across three DI modules; DataStore persists the per-day step baseline.

Technical Highlights

Testable core, resilient sync, and honest platform handling

Domain & Testing

  • Pure-Kotlin EnergyEngine with 12 JUnit cases covering BMR, TDEE, floors, GAIN cap, BMI boundaries, and macros
  • DietPlanGenerator with deterministic seeding and its own 4-case test suite
  • Compose Canvas progress rings drawn directly — no chart library dependency

Data & Sync

  • 7 Room entities/DAOs mixing Flow reads and suspend writes; sync-bearing rows carry a remoteUid
  • SyncManager push() upserts to Supabase and pull() decodes back into Room; scheduled 6h periodic + 10s one-shot
  • FoodSeeder loads the 94-food asset JSON only on first run

Sensors & Platform

  • Foreground StepCounterService with a per-day DataStore baseline that re-bases on reboot or counter reset
  • Secrets (Supabase URL/key, Google client id) injected via Gradle BuildConfig with empty-string defaults
  • CI builds the debug APK and publishes to GitHub Releases (3 builds shipped)

Impact

A trustworthy, locally-relevant health app that runs anywhere

  • Gives Pakistani users accurate, culturally-relevant tracking — including Ramadan meals and South-Asian BMI — that works entirely offline.
  • Keeps health math transparent and verifiable through a unit-tested domain engine rather than opaque targets.
  • The codebase outruns its own README: two-way Supabase sync, the desi diet-plan generator, and 49 Lottie workout animations are fully implemented despite being listed there as TODO; remaining stubs are limited to Credential-Manager nonce auth, full Urdu/RTL localization, and Health Connect.