NextPost is a full-featured Android application that demonstrates Modern Android development concepts, including user authentication, remote data retrieval, offline support, and local data persistence.
- User Authentication: Simple registration and login using local data persistence.
- Posts Display: Retrieves and displays a list of posts from the JSONPlaceholder API.
- Search Functionality: Users can search for posts by title or body.
- Favorites: Users can mark and unmark posts as favorites.
- Offline Support: The app caches post data locally, allowing users to view posts, access favorites, and search content even without an internet connection.
![]() |
![]() |
![]() |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
When the app is first run it will attempt to load a list of posts from a JSONPlaceholder API.
The data layer is implemented as an offline-first source of app data. It is the source of truth for all data in the app.
Each repository has its own models. Repositories are the public API for other layers, they provide the way to access the app data. The repositories typically offer one or more methods for reading and writing data.
Data is exposed as data streams.
To write data, the repository provides suspend functions. It is up to the caller to ensure that their execution is suitably scoped.
A repository may depend on one or more data sources. For example, the OfflineFirstPostsRepository depends on the following data sources:
| Name | Backed by | Purpose |
| PostsDao | Room/SQLite | Persistent relational data associated with Posts |
| UserPreferencesDataSource | DataStore | Persistent data associated with user preferences, specifically which Posts the user marks as favorite. |
| AppNetworkDataSource | Remote API accessed using ktor | Data for posts, provided through JSONPlaceholder REST API endpoints as JSON. |
Repositories are responsible for reconciling data in local storage with remote sources. Once data is obtained from JSONPlaceholder it is immediately written to local storage. The updated data is emitted from local storage (Room) into the relevant data stream and received by any listening clients.
This approach ensures that the read and write concerns of the app are separate and do not interfere with each other.
- Language: Kotlin
- UI Toolkit: Jetpack Compose
- Architecture: MVVM (Model-View-ViewModel)
- Concurrency: Kotlin Coroutines and Flow
- Local Cache: Room
- Local Preferences: DataStore
- Architecture Practices: Clean Architecture
- Network Client: Ktor
- Dependency Injection: Hilt
- Data Serialization: Kotlinx Serialization
To build and run this project, you need the following:
- Android Studio: Latest version
- Java: 21 or later
- Android API:
compileSdk 36,targetSdk 36, andminSdk 29 - Kotlin: 2.2.10
- Gradle: 9.0.0
To set up and run the project locally, follow these steps:
-
Clone the repository:
-
Open in Android Studio:
-
Sync Gradle
-
Run the app
- Backend: User authentication is handled locally. No external backend service is used for this feature.
- Password Storage: For simplicity, user registration data is stored locally. In a production app, a more secure method should be used.
- UI Design: Simple bare-minimum UI, no fancy design.
- API: The app relies on the JSONPlaceholder API.







