How waseemabbas8/libroom-android works
Project type and purpose
• This is a single-module Android application (“libroom-android”) built in Kotlin with Jetpack Compose.
• It follows Clean Architecture, combining MVI (Model-View-Intent) and MVVM patterns.
• Its purpose is to let users explore, read, and listen to books, with features like authentication (Firebase), home feed (REST via Ktor), search, favorites, and a reader view.
File structure and README
• Top-level gradle files, an Android Studio App module under /app, and a clear separation in app/src/main/java/com/waseem/libroom into core and feature packages.
• core contains DI modules (Hilt), MVI/MVVM base classes, UI components (Compose widgets & theme), and use-case abstractions.
• Each feature (auth, book, author, category, favorites, home, onboarding, profile, reader, root, search) has its own:
• data layer (RepositoryImpl)
• domain layer (models & use cases)
• presentation layer (Screen, ViewModel, UI state, contract)
• External dependencies include Firebase Auth, Ktor for REST, DataStore for key-value, and Compose Navigation.
Main components
a. Presentation Layer
• Screens (Compose UIs)
• ViewModels (MVVM or MVI state holders)
• Navigation Graph (Compose Navigation)
b. Domain Layer
• Use Cases (e.g., SignInWithEmailPassword, GetHomeContent, GetTopAuthors)
• Domain Models (e.g., User, Book, Author, HomeContent)
c. Data Layer
• Repositories (e.g., AuthRepositoryImpl, BookRepositoryImpl)
• Data Sources:
• Remote via Ktor HTTP client (REST endpoints)
• FirebaseAuth (for login/logout)
• DataStore (for user preferences)
d. Dependency Injection
• Hilt modules: AppModule, FirebaseModule, plus feature-specific modules (AuthModule, BookModule, etc.) supply instances of Ktor client, FirebaseAuth, use cases, and repositories.
e. External Services
• REST API server
• Firebase Auth
• Local DataStore
Relationships and data flows
• User taps a button on a Screen → Screen sends an Intent/Action to its ViewModel.
• ViewModel invokes one or more Use Cases from the Domain layer.
• Use Case orchestrates business logic and calls the appropriate Repository.
• Repository either:
• performs a remote call through the Ktor client, or
• interacts with FirebaseAuth, or
• reads/writes DataStore.
• The result flows back: Repository → Use Case → ViewModel → Screen UI State.
Architectural patterns and design principles
• Clean Architecture layered approach: Presentation → Domain → Data.
• MVI for state management, where state flows are unidirectional.
• MVVM for simpler UI-ViewModel binding in certain screens.
• Hilt for constructor injection and module organization.
• Compose Navigation for screen routing.