A marketplace-style messaging app for Android, built with Jetpack Compose and PubNub Chat SDK. Demonstrates real-time chat features like typing indicators, read receipts, and live inbox updates in a clean architecture codebase.
- Real-time messaging with message history
- Typing indicators and read receipts
- Conversation inbox with unread counts and live updates
- Product context per conversation (title, price)
- Date separators and message status tracking
- Channel invites with automatic subscription
| Layer | Technology |
|---|---|
| UI | Jetpack Compose, Material 3 |
| Real-time | PubNub Chat SDK |
| Architecture | MVVM + Clean Architecture |
| DI | Hilt |
| Local storage | Room, DataStore |
| Networking | Retrofit, OkHttp, Moshi |
| Language | Kotlin 2.0 |
app/src/main/java/dev/guillem/samplechat/
├── data/ # Repositories, Room DB, PubNub data source
├── di/ # Hilt modules
├── domain/ # Use cases, models, repository interfaces
├── ui/ # Compose screens, components, navigation, theme
└── util/ # Constants, date formatting, keys (gitignored)
- Android Studio Ladybug or later
- JDK 11+
- A PubNub account (free tier available)
Create an app and keyset in the PubNub Admin Portal with the following features enabled:
| Feature | Setting |
|---|---|
| Message Persistence | Enabled, 7+ days retention |
| App Context | Enabled |
| Presence | Enabled (optional) |
-
Clone the repository:
git clone https://github.com/GuillemRoca/sample-chat.git cd sample-chat -
Create the keys file at
app/src/main/java/dev/guillem/samplechat/util/Keys.kt:package dev.guillem.samplechat.util object Keys { const val PUBNUB_PUBLISH_KEY = "pub-c-your-publish-key" const val PUBNUB_SUBSCRIBE_KEY = "sub-c-your-subscribe-key" }
-
Open the project in Android Studio and run it, or build from the command line:
./gradlew installDebug
The app requires API 24+ (Android 7.0) and targets API 36.
The project follows Clean Architecture with three layers:
- UI -- Compose screens and ViewModels that observe state
- Domain -- Use cases and repository interfaces (pure Kotlin, no Android dependencies)
- Data -- Repository implementations, Room database, and PubNub data source
See ARCHITECTURE.md for a detailed breakdown.
This project is provided as a sample/demo. See the repository for license details.