Dagger and Multi-Module Architecture in Traveloka Android App
Article Summary
Alifa Nurani Putri and Yusuf Cahyo Nugroho from Traveloka reveal how their single Dagger component ballooned to 17,705 lines of code across 25+ products. Their refactoring journey cut initialization time and build times while preparing for Dynamic Feature Modules.
Traveloka's Android team started with a simple Dagger setup in 2016, but as they scaled to 25+ products, their AppComponent became a god object with 82 modules and 36 subcomponents. This deep dive walks through their multi-year refactoring journey to fix build times, memory issues, and enable modularization.
Key Takeaways
- Single AppComponent grew to 17,705 generated lines with 82 modules and 36 subcomponents
- Refactoring one product module reduced Dagger initialization from 357ms to 219ms
- Introduced product api and base modules to break diamond-shaped dependency pattern
- Dagger-bridge layer decreased incremental build time by skipping app module recompilation
- Cross-sell architecture required contract-based approach to avoid circular dependencies
By splitting their monolithic Dagger component into product-specific api, base, and internal modules, Traveloka reduced initialization time by 39% and significantly improved incremental build times.