In Development
iOS
Android
Desktop

MindYourGain

KotlinKtorCompose MultiplatformMongoDBWebSocketsCloudflare R2KoinKMP
MindYourGain

MindYourGain is a personal project — a fitness SaaS platform built on scientific evidence rather than trend-chasing. The goal is to give users, trainers, and an AI coach a single platform where every interaction is backed by data.

The platform’s multi-role architecture enforces tier-based authorization: free users get core tracking, premium users unlock AI coaching, and certified trainers get a dedicated dashboard to manage their clients. Every role sees a different version of the same app.

The most interesting technical challenge was keeping the backend and mobile clients in sync without a separate contract layer. The solution was a shared Kotlin Multiplatform module — shared-models — that both the Ktor backend and the Compose Multiplatform frontend consume from the same source. Change a DTO once, both sides see it immediately. Desynchronization between API contract and client expectations is structurally impossible.

Highlights

  • Multi-role architecture: user, trainer, and AI coach with tier-based authorization
  • Shared KMP module ensures zero API contract drift between backend and clients
  • Real-time features via WebSockets for live coaching interactions
  • Cloudflare R2 for cost-effective media storage
  • Single monorepo with composite Gradle build — one atomic commit covers backend, frontend, and shared models
Technical details

Architecture

Monorepo with three modules: backend (Ktor + MongoDB), frontend (Compose Multiplatform — Android, iOS, Desktop), and shared-models (KMP DTOs and enums). Composite Gradle build resolves shared-models by includeBuild — no Maven Local publishing needed in development. Backend deployed on Coolify via Docker; iOS ships to TestFlight via GitHub Actions + Fastlane.

**Backend:** Ktor on Kotlin, MongoDB as the primary store, JWT auth, WebSocket endpoints for real-time coaching. Deployed on Coolify (self-hosted PaaS) with a Dockerfile that builds the full monorepo.

**Frontend:** Compose Multiplatform targeting Android, iOS, and Desktop from a single codebase. MVI architecture with Koin for DI and Coroutines/Flow for async state.

**Shared Models:** KMP library exporting DTOs and enums consumed by both backend (JVM target) and frontend. `@Serializable` on every model. Enums used for Roles, Tiers, and States instead of raw strings.

**CI/CD:** GitHub Actions workflow triggers on pushes to `main` touching `frontend/**` or `shared-models/**`, builds the iOS framework, and uploads to TestFlight via Fastlane.