Books Module Integration Guide
Quick Start
The Books module has been fully implemented and integrated into the Oter codebase. Here’s what you need to know:
What Was Created
Module Structure
books/
├── books_data/ # Data layer (Room, DAOs, DataSource)
├── books_domain/ # Domain layer (Models, Repository, Use Cases)
├── books_presentation/ # Presentation layer (UI, ViewModels, Navigation)
└── README.md # Full documentationKey Files
Data Layer:
BookDao.kt/ReadingLogDao.kt- Room DAOsBookLocalDataSource.kt- Offline-first data sourceBooksRepositoryImpl.kt- Repository implementation- Room entities:
Book,ReadingLog
Domain Layer:
- Models:
Book,ReadingLog,BookStatus,BookDetail,BooksStats BooksRepositoryinterface- Use cases:
GetBooks,AddBook,UpdateBookStatus,LogReadingMinutes, etc.
Presentation Layer:
- ViewModels:
BooksViewModel,BookDetailViewModel,BooksStatsViewModel - Screens:
BooksLibraryScreen,BookDetailScreen,BooksStatsScreen - Bottom Sheets:
AddBookBottomSheet,LogMinutesBottomSheet - Navigation:
BooksNavGraph.kt,BooksDestination.kt
Integration Steps
1. Database Migration
The AppDatabase has been updated to version 6 with the new entities:
BookentityReadingLogentityBookDaoandReadingLogDaoadded
2. Dependency Injection
BooksDataModule- Provides data layer dependenciesBooksDomainModule- Provides use casesAppModule- Provides DAOs
3. Navigation
The books graph has been added to NavHostWrapper.kt:
booksGraph(navController)4. Routes
books- Main library screenbooks/{bookId}- Book detail screenbooks/stats- Statistics screen
How to Access
From Navigation
Navigate to the books screen:
navController.navigate("books")Add to Bottom Navigation (Optional)
If you want to add Books to the bottom navigation, update Routes.kt:
val BOOKS = BottomNavRoute("books", "books", "Books")Then add it to your navigation graph.
Testing the Module
-
Add a Book:
- Navigate to
books - Tap ”+” FAB
- Enter title (required), author (optional)
- Tap “Add”
- Navigate to
-
Log Reading Time:
- Open a book detail
- Tap “Log Minutes”
- Enter minutes and date
- Tap “Log”
- If book was WANT, it auto-transitions to READING
-
Change Status:
- From book detail, use action buttons:
- “Start Reading” → READING
- “Finish Book” → FINISHED
- “Drop Book” → DROPPED
- From book detail, use action buttons:
-
View Stats:
- Tap stats icon in library
- View reading statistics
Features
✅ Minimal Friction:
- Add book: Title only (author optional)
- Log minutes: Default 15 min, today’s date
- Big tap targets, no multi-step flows
✅ Automatic Transitions:
- Logging minutes on WANT → automatically sets to READING
- Records
startedAtwhen first moved to READING - Records
finishedAtwhen FINISHED
✅ Offline-First:
- All data stored locally in Room
- No network required
- Fast, instant operations
✅ Stats Tracking:
- Minutes today/week/month
- Reading streak (consecutive days)
- Books finished this month
- Currently reading count
Database Schema
books table:
- id, title, author (nullable), status, createdAt, updatedAt, startedAt (nullable), finishedAt (nullable)
reading_logs table:
- id, bookId, date (YYYY-MM-DD), minutes, createdAt
Notes
- No notes/highlights: As per requirements, this is tracking-only
- Time-based only: No page/chapter tracking in MVP
- Local storage only: No sync/cloud features
- Simple UI: Fast, minimal, focused on quick logging
Troubleshooting
If you encounter issues:
- Database migration: Ensure app database version is 6
- DI errors: Check that
BooksDataModuleandBooksDomainModuleare properly installed - Navigation: Verify
booksGraphis added toNavHostWrapper - Imports: All imports should be from
com.esteban.ruano.books_*
Next Steps
The module is ready to use! To add it to your app’s main navigation:
- Add a navigation item/link to “books” route
- Optionally add to bottom navigation bar
- Test the full flow: add → log → finish
For detailed API documentation, see books/README.md.