Skip to content

maurocosentino/Coinpulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoinPulse

Kotlin Jetpack Compose Min SDK

A modern real-time cryptocurrency price tracker for Android demonstrating Clean Architecture, Coroutines + Flow, and reactive UI.

FeaturesArchitectureGetting Started


Architecture

CoinPulse follows Clean Architecture with three clearly separated layers:

Presentation  →  Domain  ←  Data
  • Presentation — Jetpack Compose screens, ViewModels exposing StateFlow<UiState>
  • Domain — Pure Kotlin use cases and repository interfaces. Zero Android dependencies
  • Data — Retrofit + Room implementations, DTOs, mappers, and background workers

Data flow

CoinGecko API (polling every 30s)
    └── flow { while(true) }
            └── map / combine / catch
                    └── StateFlow in ViewModel
                            └── collectAsStateWithLifecycle in Compose
                                    └── WorkManager (background alerts every 15min)

Tech Stack

Layer Technology
UI Jetpack Compose + Material 3
Async Kotlin Coroutines + Flow
DI Hilt
Networking Retrofit + OkHttp
Local storage Room
Preferences DataStore
Background WorkManager (CoroutineWorker)
Image loading Coil
Navigation Navigation Compose

Key Coroutines & Flow concepts demonstrated

  • flow { while(true) } — manual polling stream from REST API
  • StateFlow + stateIn() — converting cold flows to hot, lifecycle-aware state
  • combine() — merging market data stream with search query in real time
  • catch — error handling in the flow pipeline without crashing the stream
  • flowOn(Dispatchers.IO) — moving upstream work off the main thread
  • CoroutineWorker — background price alert monitoring via WorkManager
  • viewModelScope + SharingStarted.WhileSubscribed(5_000) — lifecycle-aware sharing

Features

  • Market — Live crypto prices with 30-second polling and real-time search filtering
  • Detail — Individual coin data with price and market cap
  • Favorites — Persist favorite coins with Room, reactive UI via Flow<List<Favorite>>
  • Alerts — Set price thresholds, monitored in background via WorkManager notifications

Project Structure

com.mauro.coinpulse/
├── core/
│   ├── di/          # Hilt modules (Network, Database, Repository)
│   ├── util/        # NotificationHelper, WorkManagerScheduler
│   └── ui/          # Theme, colors, typography
├── data/
│   ├── local/       # Room entities, DAOs, AppDatabase
│   ├── remote/      # Retrofit API service, DTOs
│   ├── mapper/      # DTO → Domain model converters
│   ├── repository/  # CoinRepositoryImpl
│   └── worker/      # PriceAlertWorker (CoroutineWorker)
├── domain/
│   ├── model/       # Coin, Alert, Favorite
│   ├── repository/  # CoinRepository interface
│   └── usecase/     # GetCoinsUseCase, GetCoinDetailUseCase, etc.
└── presentation/
    ├── market/      # MarketScreen + MarketViewModel
    ├── detail/      # DetailScreen + DetailViewModel
    ├── favorites/   # FavoritesScreen + FavoritesViewModel
    ├── alerts/      # AlertsScreen + AlertsViewModel
    └── navigation/  # NavGraph, Screen sealed class

Getting Started

  1. Clone the repository
git clone https://github.com/maurocosentino/coinpulse.git
  1. Open in Android Studio Hedgehog or later
  2. Run on emulator or physical device (API 26+)
  3. No API key required — uses CoinGecko public API

What I learned building this

This project was built to go deep on reactive programming in Android. The main takeaways:

  • The difference between cold and hot flows and when to use each
  • How stateIn() with WhileSubscribed prevents unnecessary upstream work during recomposition
  • Why CoroutineWorker is required over Worker when calling suspend functions in background tasks
  • How combine() allows merging independent data streams without manual synchronization
  • The value of Clean Architecture when the CoinGecko detail endpoint had a different shape than the list endpoint — only the DTO and mapper needed to change, zero impact on domain or UI

Author

Mauro Cosentino Android Developer GitHub

About

Real-time cryptocurrency tracker for Android featuring live prices, favorites, and background alerts.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages