A simple Android application created with JSONPlaceholder for demonstrating CRUD operations with offline-first functionality. The app built using Jetpack Compose, Kotlin Coroutines, and implementing a clean architecture approach with the MVVM (Model-View-ViewModel) pattern RoomDB for local storage and WorkManager for synchronizing data with the JSONPlaceholder API.
Posts List | Post Details | Create Details |
---|---|---|
Edit Post | Refresh Posts | |
- Create (POST): Add new posts to the local database. If offline, posts are queued for synchronization when online.
- Read (GET): Display a list of posts from the API if online or from the local database if offline.
- Update (PUT): Edit posts locally first. Changes are synchronized with the API when online.
- Delete (DELETE): Mark posts as deleted locally and sync deletions with the API when online.
- Synchronization: Automatically sync data between the local database and the JSONPlaceholder API using WorkManager.
- Offline First: Ensures a seamless user experience even without network connectivity.
This project follows Clean Architecture principles for scalability and maintainability. It is implemented using the MVVM (Model-View-ViewModel) pattern. Key layers include:
- Presentation Layer: Jetpack Compose for UI and ViewModels for state management.
- Domain Layer: Use cases encapsulating business logic.
- Data Layer: Repositories interacting with both RoomDB and the JSONPlaceholder API.
- MVVM Architecture: Implements Model-View-ViewModel pattern for separation of concerns.
- Kotlin: Official programming language for Android development.
- Jetpack Compose: Modern toolkit for building native UI.
- RoomDB: Local database for offline-first functionality.
- WorkManager: For managing background synchronization tasks.
- Retrofit: A type-safe HTTP client for API communication.
- Kotlin Coroutines: Asynchronous programming with structured concurrency.
- Material3 Design: UI/UX design framework.