|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Code/Flipcash is a mobile wallet app for instant, global, private payments using self-custodial blockchain (Solana/Kin) technology. The Android app is a multi-module Gradle project with 100+ modules. |
| 8 | + |
| 9 | +## Build Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Build debug APK |
| 13 | +./gradlew :apps:flipcash:app:assembleDebug |
| 14 | + |
| 15 | +# Build release bundle |
| 16 | +./gradlew :apps:flipcash:app:bundleRelease |
| 17 | + |
| 18 | +# Run unit tests (all modules) |
| 19 | +./gradlew test |
| 20 | + |
| 21 | +# Run unit tests for a specific module |
| 22 | +./gradlew :apps:flipcash:features:<feature>:test |
| 23 | + |
| 24 | +# Run instrumented tests |
| 25 | +./gradlew connectedAndroidTest |
| 26 | + |
| 27 | +# Run tests via Fastlane (used in CI) |
| 28 | +bundle exec fastlane android flipcash_tests |
| 29 | +``` |
| 30 | + |
| 31 | +**Requirements**: Java 21 (Corretto), `google-services.json` in `apps/flipcash/app/src/`, API keys in `local.properties` (BUGSNAG_API_KEY, FINGERPRINT_API_KEY, GOOGLE_CLOUD_PROJECT_NUMBER, MIXPANEL_API_KEY). |
| 32 | + |
| 33 | +## Module Structure |
| 34 | + |
| 35 | +``` |
| 36 | +apps/flipcash/ |
| 37 | + app/ — Main application entry point (FlipcashApp, MainActivity) |
| 38 | + core/ — Base Compose utilities, payment models, billing state, cache policies |
| 39 | + features/ — 20+ isolated feature modules (login, cash, balance, etc.) |
| 40 | + shared/ — 30+ shared modules (auth, tokens, payments, notifications, etc.) |
| 41 | +
|
| 42 | +services/ |
| 43 | + flipcash/ — Flipcash gRPC services and models |
| 44 | + opencode/ — Open Code Protocol gRPC services |
| 45 | + *-compose/ — Compose wrappers for services |
| 46 | +
|
| 47 | +definitions/ |
| 48 | + flipcash/ — Protobuf definitions for Flipcash |
| 49 | + opencode/ — Protobuf definitions for OCP |
| 50 | +
|
| 51 | +libs/ — 20+ internal libraries |
| 52 | + crypto/ — Solana, Kin, Ed25519, encryption, key management |
| 53 | + network/ — Connectivity, JWT, exchange rates, Coinbase |
| 54 | + models, messaging, logging, etc. |
| 55 | +
|
| 56 | +ui/ — Shared UI layer |
| 57 | + core/, components/, theme/, resources/ |
| 58 | + navigation/, scanner/, biometrics/, analytics/ |
| 59 | +
|
| 60 | +vendor/ — Third-party: Kik scanner, TipKit, OpenCV |
| 61 | +build-logic/ — Convention plugins for consistent module setup |
| 62 | +``` |
| 63 | + |
| 64 | +## Convention Plugins (build-logic) |
| 65 | + |
| 66 | +All modules use convention plugins applied via `build.gradle.kts`: |
| 67 | +- `flipcash.android.library` — Base Android library config (compile SDK 36, min SDK 29, Java 21) |
| 68 | +- `flipcash.android.library.compose` — Adds Jetpack Compose support |
| 69 | +- `flipcash.android.feature` — Full feature module: Compose + Hilt + KSP + Parcelize + common UI dependencies |
| 70 | + |
| 71 | +The feature plugin automatically includes `:libs:logging`, `:ui:core`, `:ui:components`, `:ui:navigation`, `:ui:resources`, `:ui:theme`, and `:apps:flipcash:core`. |
| 72 | + |
| 73 | +## Architecture |
| 74 | + |
| 75 | +- **Pattern**: MVI/MVVM hybrid with Compose-driven UI and reactive state |
| 76 | +- **DI**: Hilt — all feature modules get Hilt via the convention plugin |
| 77 | +- **Navigation**: Jetpack Navigation + Voyager for compose-based screens; custom `Router` controller |
| 78 | +- **Networking**: gRPC with Protobuf for backend services; Retrofit/OkHttp for REST |
| 79 | +- **Async**: Kotlin Coroutines + RxJava 3 (both coexist) |
| 80 | +- **Persistence**: Room (encrypted with SQLCipher), DataStore for preferences |
| 81 | +- **Crypto**: Libsodium, Ed25519, Solana/Kin SDK for on-chain operations |
| 82 | + |
| 83 | +## Key Patterns |
| 84 | + |
| 85 | +- **CompositionLocal injection**: `MainActivity` provides dozens of controllers/services via `CompositionLocalProvider` — features access dependencies through `Local*` composition locals rather than direct injection |
| 86 | +- **Feature modules are self-contained**: Each has its own state, controllers, and UI; communicates via shared modules |
| 87 | +- **Protobuf models**: Backend models are generated from `.proto` files in `definitions/`; don't hand-edit generated code |
| 88 | +- **Dark mode only**: App forces `MODE_NIGHT_YES` |
| 89 | + |
| 90 | +## Namespaces |
| 91 | + |
| 92 | +- App: `com.flipcash.app.android` (debug: `com.flipcash.app.android.dev`) |
| 93 | +- Legacy/shared: `com.getcode` |
| 94 | +- Features: `com.flipcash.features.*` |
| 95 | +- Shared modules: `com.flipcash.shared.*` |
| 96 | +- UI: `com.getcode.ui.core` |
| 97 | + |
| 98 | +## Git Conventions |
| 99 | + |
| 100 | +- Conventional commits: `feat:`, `fix:`, `chore:`, with optional scope in parens (e.g., `feat(oc):`, `fix(tokens):`) |
| 101 | +- Main branch: `main` |
| 102 | +- CI runs on all PRs (tests via Fastlane) |
0 commit comments