ADR 008
Android apps packaged from web code with Capacitor
Context
The children's drawing and reading courses already existed as a tested TypeScript web app on the kids website. The goal was two paid Android apps with Play Billing, mainly for tablets and stylus use, without maintaining a second codebase in another language.
Options considered
| Option | For | Against |
|---|---|---|
| Native Kotlin and Jetpack Compose | Best performance and platform feel | Rewrites everything; two codebases to keep in step; slower to build |
| Flutter or React Native | Cross-platform, near-native | Still a rewrite of the drawing engine and the course content |
| Capacitor around the existing web app | Reuses the web code, content and tests; iOS possible later; native code only where needed | Web-view performance limits; web-view errors are invisible to Android crash reporting (see ADR 006) |
Decision
- Vite and TypeScript web code is packaged with Capacitor. The only native code is a Java plugin for Play Billing (one-time unlock, pending payments, restore on start).
- The whole Android toolchain (JDK, Node, Android SDK) runs in a Docker builder image, so builds are reproducible and nothing is installed on the host.
- GitHub Actions runs emulator tests on a phone and a tablet. A third job draws a full picture with real Android stylus input.
- The signing keys are never committed.
Consequences
- Good: two apps were built in days, not weeks, with the same course content as the website.
- Good: the reproducible Docker build means any machine can produce the release bundle.
- Cost: the app copy and the website copy can drift apart. One drawing-input bug fixed in the app is still open on the website by product choice.
Revisit when
- Profiling on low-end tablets shows real frame drops in drawing, or a feature needs deep native APIs.
At bank scale
The same trade-off shows up as "one platform team, many channels". Banks often share a design system and business logic across web and mobile, and keep native code for security-critical parts: secure storage, biometrics, certificate pinning and payment SDKs.