How mathroda/dashcoin works
Project Type and Purpose
• This is a Kotlin Multiplatform Mobile (KMM) full-stack mobile application (Android + iOS)
• Purpose: Crypto-currency tracker using Clean Architecture with shared business logic and UI components, plus native Android and iOS launchers
Layers and Modules
A. Presentation Layer
• AndroidApp (Jetpack Compose UIs + AndroidDI/Hilt)
• iOSApp (SwiftUI/AppKit + UIKit integration)
• shared module UI entrypoint (DashCoinApp.kt, SharedViewModel, Navigation graphs)
• Feature UIs (coins, coin-details, chart, news, favorite-coins, onboarding, auth, profile)
B. Domain Layer
• core-domain: Entities, value objects (Coin, Charts, User, News, Events)
• Use-case interfaces reside in core-datasource/usecases (e.g., DashCoinUseCases, GetFavoriteCoinsUseCase)
C. Data Layer
• core-network: Retrofit/Ktor client, DTOs, network module & engine (KtorEngine, OkHttp interceptor)
• core-cache: Room database + DataStore, DAOs, converters, cache module
• core-datasource: Repositories (DashCoinRepository, FirebaseRepository), platform modules (androidMain, iosMain)
D. Infrastructure Layer
• core-infrastructure: Internet connectivity, phone shaking sensor, WorkManager tasks (DashCoinWorker), notifications
• Modules providing platform-abstraction implementations
E. Dependency Injection
• Koin modules defined in shared (Koin.kt, ViewModelsModule) and each core-*/feature module (DataSourceModule, NetworkModule, CacheModule, InfrastructureModule, CoreModule.android/ios)
External Services & Platforms
• External REST API: CoinStats (HTTP)
• Firebase Authentication & Firestore
• Local SQLite via Room, DataStore on device
• WorkManager on Android, background tasks on iOS
• Notifications (Android Notification Manager, iOS UNUserNotificationCenter)
Relationships & Data Flow
• UI → Shared ViewModels (StateFlow) → Use-cases (core-datasource)
• Use-cases → Repositories (core-datasource)
– Repositories → network client (core-network) for remote data
– Repositories → cache (core-cache) for local persistence
• Infrastructure modules injected where needed (e.g., connectivity checks before network calls, scheduling sync tasks)
• Shared DI modules bootstrap the graph at app launch
Architectural Patterns & Principles
• Clean Architecture (Presentation → Domain → Data → Infrastructure)
• MVVM + StateFlow for UI state management
• KMM for code reuse across Android and iOS
• Single-responsibility modules: each feature is its own Gradle submodule
• Dependency inversion: domain/usecases depend on repository interfaces, implementations injected via DI
Must-Include Elements
• Component labels (module name + primary classes/tech)
Final Checklist
[ ] Presentation/UI layer (AndroidApp, iOSApp, shared DashCoinApp)
[ ] Feature modules (coins, details, chart, auth, etc.)
[ ] Domain layer with entities & use-cases
[ ] Data layer: network, cache, repos
[ ] Infrastructure layer: connectivity, background workers, notifications
[ ] DI modules for each layer
[ ] External dependencies: CoinStats REST, Firebase, local DB