Stack
- Kotlin 2.2 · Compose Multiplatform 1.10
- Source sets:
commonMain/androidMain/iosMain - Ktor client (OkHttp / Darwin) · Coil 3 images
- Room for local persistence
- Google ML Kit for on-device OCR, translation, pose
Engineering at Power AI
How we build and ship offline-first AI apps on Android, iOS and the web — the architecture, the data, the AI models, and the agent-driven workflow that lets a tiny team move like a big one.
Every product shares the same foundations: a Kotlin Multiplatform monorepo for mobile, a static web site with serverless APIs, and one Python AI gateway. Clients never hold provider API keys — AI calls go through our own backends.
/api/*
Android and iOS share one Kotlin codebase: business logic and UI. Each iOS app is a thin Swift
host (*IosApp/) around the shared Compose Multiplatform UI.
commonMain / androidMain / iosMainUseCase classes on a shared BaseUseCaseBaseViewModel:shared — architecture base, utilities:account — Google / Apple / guest auth:iap · :ads — subscriptions, paywall, AdMob:setting · :ui-chrome — settings, design tokens:analytics · :crash-reporting · :feedback
Dependencies only go one way: app module → feature modules → shared modules. Shared
code never depends on an app. Every module has its own spec.md that states what it owns.
web/api/
Environments: localhost → dev.power-ai.app (feature branch) →
www.power-ai.app (develop). Every push gets a preview deploy.
powerai_aiA Python 3.12 / FastAPI gateway that runs heavy generative work (photo editing, face swap) for the mobile and web clients. Built with ports & adapters so we can switch model providers without touching clients.
api — routers, DTOs, auth headersdomain — Job entity, ports, use casesinfrastructure — provider clients, job store, object storagecore — settings, logging, API-key auth
Clients ask for a capability (image_edit, image_inpaint,
face swap) instead of a specific model. A ModelRegistry picks the provider and falls back automatically:
OpenRouter FLUX.2 → BFL FLUX.1 → local / mock
uv| Store | Holds | Why |
|---|---|---|
| On-device (Room / SQLite, settings) | Vocab library, workout plans, tracker logs, preferences | Offline-first: the core features work without a network |
| Firebase Firestore | User profiles, community content, cost ledger, work logs | Managed, real-time, shared across apps in one Firebase project |
| Cloudflare R2 | User media, AI results, test builds, CDN assets | S3-compatible, no egress fees |
| Server job store | AI job records and media | Simple, file/SQLite-backed, easy to inspect |
| Firebase Analytics / Crashlytics | Product events, crashes | Funnels and stability for every app |
ML Kit OCR + translation for OTG (translate text inside photos and PDFs) and Vocab lookup, plus pose detection for Workout. Private, free, and works offline.
Personalized workout plans and revisions, word explanations, IELTS Speaking band scoring on 4 criteria. Called through server-side proxies, with model fallback.
Prompt-based editing with FLUX.2 / FLUX.1 Kontext and Fill, plus face swap with InsightFace (ArcFace + InSwapper) on our own server.
We treat AI coding agents as part of the team. Humans set direction and review; agents do the implementation, testing, and release steps, following written rules that are versioned in the repo.
Sets goals and approves releases. Talks to agents in the IDE or over Telegram.
Breaks work down, does small tasks itself, assigns bigger ones, merges the reports.
Engineering, Review/QA, Growth (SEO, marketing), Release (store publishing).
One per app (workout-dev, photo-dev…), plus auto-test, SEO, and store-publish.
AGENTS.md — entry point every agent reads firstspec.md — ownership and behaviour contracts.cursor/rules — architecture, logging, i18n, UI layout rules.cursor/skills — repeatable playbooks: install, publish, auto-test, SEO, review/sync rebases a feature branch onto develop; /done merges itMaestro flows per app (smoke and full suites), with selectors and test cases documented in docs/testing/.
Paparazzi snapshots of shared UI run in CI, so visual changes in shared components get caught.
Firebase Test Lab Robo crawls on Android, plus a cloud emulator that agents use to capture artifacts.
Kotlin tests on use cases and repositories; pytest + ruff on the AI server.
Agent-run review-ui (screenshot-based UX audit) and review-biz (monetization, funnel), plus code review before merging.
Crashlytics with a daily crash digest, store-review alerts, and a cost/usage ledger for AI calls.
spec.md changes in the same commit.