A production-ready Kotlin Multiplatform (KMP) application demonstrating modern mobile development practices with Clean Architecture, MVI pattern, and Compose Multiplatform. Track your cryptocurrency portfolio across Android, iOS, and Desktop platforms with a single shared codebase.
- π Real-time Crypto Tracking - Live cryptocurrency prices and market data
- πΌ Portfolio Management - Buy/sell cryptocurrencies with balance tracking
- π Performance Analytics - Track your gains/losses with visual charts
- π Offline Support - Local database with Room for offline access
- π¨ Material Design 3 - Modern UI with dynamic theming
- π Secure API Key Management - Build-time injection with environment variants
- ποΈ Clean Architecture - Separation of concerns with domain/data/presentation layers
- π MVI Pattern - Unidirectional data flow for predictable state management
β οΈ Type-safe Error Handling - ComprehensiveResult<T, DataError>pattern with HTTP, network, and business errors- π Type-safe Navigation - Compose Navigation 2.8+ with serialization
- π Dependency Injection - Koin for KMP
- π§ͺ Testable - Unit tests with Turbine and AssertK
βββββββββββββββββββββββββββββββββββββββββββββββ
β Presentation Layer (UI) β
β β’ Compose Multiplatform UI β
β β’ MVI ViewModels β
β β’ Navigation & State Management β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Domain Layer (Business) β
β β’ Use Cases / Interactors β
β β’ Domain Models β
β β’ Repository Interfaces β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Data Layer (Sources) β
β β’ Repository Implementations β
β β’ Remote Data Sources (Ktor) β
β β’ Local Data Sources (Room) β
β β’ DTOs & Mappers β
βββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββ
β UI State β βββββββ
ββββββββββββββββ β
β β
β renders β updates
βΌ β
ββββββββββββββββ β
β View β β
ββββββββββββββββ β
β β
β sends β
βΌ β
ββββββββββββββββ β
β Intent β β
ββββββββββββββββ β
β β
β processes β
βΌ β
ββββββββββββββββ β
β ViewModel βββββββββ
ββββββββββββββββ
Type-safe error handling with Result<T, DataError>:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DataError β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Remote (enum) β Local (enum) β Business β
β βββββββββββββββββ β ββββββββββββ β (sealed class) β
β β’ UNAUTHORIZED β β’ DISK_FULL β β’ InvalidCreds β
β β’ FORBIDDEN β β’ NOT_FOUND β β’ KycRequired β
β β’ NOT_FOUND β β’ INSUFFICIENT β β’ LimitReached β
β β’ NO_INTERNET β β’ UNKNOWN β β’ SessionExpiredβ
β β’ REQUEST_TIMEOUT β β β’ Unknown(code)β
β β’ SERVER_ERROR β β β
β β’ SERIALIZATION β β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Read more: Network & Error Handling
- Kotlin Multiplatform - Share code across platforms
- Compose Multiplatform - Declarative UI framework
- Kotlin Coroutines - Asynchronous programming
- Ktor Client - HTTP networking
- Kotlinx Serialization - JSON serialization
- Room Database - Local persistence with KMP support
- Koin - Dependency injection for KMP
- Lifecycle ViewModel - State management
- Navigation Compose - Type-safe navigation
- Material Design 3 - Modern design system
- Coil 3 - Image loading for Compose
- Custom Design Tokens - Consistent theming
- Gradle Build Variants - Dev/Staging/Prod environments
- ProGuard/R8 - Code obfuscation & shrinking
- Detekt - Static code analysis
- ktlint - Code style enforcement & formatting
Coins/
βββ composeApp/ # Main application module
β βββ src/
β β βββ commonMain/ # Shared code (all platforms)
β β β βββ kotlin/org/poc/app/
β β β βββ core/ # Core utilities & config
β β β β βββ config/ # App configuration & BuildConfig
β β β β βββ data/ # Core data (database, network)
β β β β β βββ network/ # HTTP client, error handling
β β β β β βββ datasource/ # Data source interfaces
β β β β βββ domain/ # Core domain models (Result, DataError)
β β β β βββ presentation/ # MVI base classes
β β β βββ feature/ # Feature modules
β β β β βββ coins/ # Crypto list feature
β β β β βββ portfolio/ # Portfolio feature
β β β β βββ trade/ # Buy/Sell feature
β β β βββ navigation/ # App navigation
β β β βββ ui/ # Design system
β β β βββ components/ # Reusable UI components
β β β βββ foundation/ # Colors, typography, spacing
β β β βββ theme/ # Theme configuration
β β βββ androidMain/ # Android-specific code
β β βββ iosMain/ # iOS-specific code
β β βββ desktopMain/ # Desktop-specific code
β βββ build.gradle.kts # Build configuration
β βββ proguard-rules.pro # ProGuard rules
βββ iosApp/ # iOS Xcode project
βββ docs/
β βββ NETWORK_AND_ERROR_HANDLING.md # Error handling architecture
βββ config/
β βββ detekt/detekt.yml # Code quality config
βββ local.properties.example # Template for API keys
βββ API_KEYS_SETUP.md # API key security guide
βββ BUILD_VARIANTS.md # Build variants documentation
βββ README.md # This file
- JDK 17+ - Java Development Kit
- Android Studio Ladybug+ - Latest stable version
- Xcode 15+ (for iOS) - macOS only
- Gradle 8.14+ - Build tool
git clone https://github.com/hossam9k/Coins.git
cd Coins# Copy the example file
cp local.properties.example local.properties
# Edit and add your API keys
# Get free API keys from: https://coincap.io/
nano local.propertieslocal.properties:
# Development
DEV_COINCAP_API_KEY=your_dev_key_here
DEV_API_BASE_URL=https://api.coincap.io/v2
# Staging
STAGING_COINCAP_API_KEY=your_staging_key_here
STAGING_API_BASE_URL=https://api.coincap.io/v2
# Production
PROD_COINCAP_API_KEY=your_prod_key_here
PROD_API_BASE_URL=https://api.coincap.io/v2π Read more: API_KEYS_SETUP.md
# Development build
./gradlew :composeApp:assembleDevDebug
# Install to device
./gradlew :composeApp:installDevDebug# Build iOS framework
./gradlew :composeApp:linkDebugFrameworkIosSimulatorArm64
# Open Xcode project
open iosApp/iosApp.xcodeproj# Run desktop app
./gradlew :composeApp:runπ Read more: BUILD_VARIANTS.md
The project supports three environment variants:
| Variant | App ID | Debug | Analytics | Use Case |
|---|---|---|---|---|
| dev | org.poc.app.dev |
β | β | Local development |
| staging | org.poc.app.staging |
β | β | QA testing |
| prod | org.poc.app |
β | β | Production |
# Build different variants
./gradlew :composeApp:assembleDevDebug
./gradlew :composeApp:assembleStagingDebug
./gradlew :composeApp:assembleProdRelease./gradlew test./gradlew :composeApp:connectedDevDebugAndroidTest# Run Detekt static analysis
./gradlew detekt
# Run ktlint code style check
./gradlew ktlintCheck
# Auto-format code with ktlint
./gradlew ktlintFormatComing soon...
- β
No Hardcoded Secrets - API keys in gitignored
local.properties - β Build-time Injection - Keys embedded during compilation
- β ProGuard Obfuscation - Code obfuscation in release builds
- β Environment Separation - Different keys per environment
- β CI/CD Ready - Environment variable support
- β Detekt - Static code analysis with custom rules
- β ktlint - Automated code formatting & style enforcement
- β Compose Function Naming - Proper @Composable conventions
- β Explicit Imports - No wildcard imports for clarity
- β Consistent Naming - SCREAMING_SNAKE_CASE for constants
- π API Keys Security Setup
- π Build Variants Guide
- π Network & Error Handling
- π Architecture Documentation (coming soon)
- π Contributing Guide (coming soon)
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- CoinCap API - Cryptocurrency data provider
- Kotlin Multiplatform
- Compose Multiplatform
- Material Design 3
Hossam Atef - @hossam9k
Project Link: https://github.com/hossam9k/Coins