Scaling Slack’s Mobile Codebases: Modularization
Slack split its monolithic iOS and Android app targets into owned Feature, Service and Library modules with strict linking rules, such as interface/implementation pairs on iOS, to cut build times, untangle dependencies and clarify code ownership. On iOS, adopting Bazel made module creation easy, eliminated project-file merge conflicts, enabled static linking that improved pre-main launch time, and powered code generation for modules, CoreData models and feature flags. On Android, Slack abandoned a per-module Dagger 'graph of graphs' in favor of Square's Anvil, cut KAPT usage by moving to KSP, Moshi and Kotlin data classes, and enabled Gradle configuration caching, saving 20-45s on builds after configuration changes.
Related posts
- Scaling Slack’s Mobile Codebases: Modernization
Slack Engineering mediumAdeptSlack's year-and-a-half Duplo initiative concluded by modernizing its iOS and Android codebases: iOS moved to a custom VIPER-style feature architecture, stricter SwiftLint rules banning singletons and NotificationCenter, Combine (via CombineX until iOS 12 was dropped), and broader SlackKit adoption, while Android replaced Gson with Moshi, Android Priority Job Queue with WorkManager, and handwritten API calls with an internal Retrofit-based library, and introduced coroutines and Compose incrementally. iOS ended 68% modernized and 81% modularized with CI stability rising from 77% to 90% and average time-to-merge down 64%, Android reached 92% modularization, and local builds later dropped nearly 50% with Bazel and M1 Macs. Follow-up work includes layered module dependency rules to stop circular dependencies, possibly adopting Needle for dependency injection, and splitting Android modules into API/implementation pairs for build parallelism.
- Stabilize, Modularize, Modernize: Scaling Slack’s Mobile Codebases
Slack Engineering easyNoviceSlack chose to refactor its iOS and Android codebases in place through Project Duplo, a cross-platform effort in three phases: Stabilization, Modularization and Modernization. A full rewrite and shared cross-platform code (React Native, Flutter, C++, Kotlin Multiplatform) were rejected because of risk, performance and tooling costs. The six-month Stabilization phase used a dedicated core team to finish stalled migrations. On iOS that meant porting about 80,000 lines of Objective-C to Swift and fully adopting internal data-access and networking libraries. On Android it meant splitting the monolithic SlackApi and database interfaces, moving queries to SQLDelight, standardizing on the repository pattern and removing Otto bus events.
- Mobile Developer Experience at Slack
Slack Engineering mediumAdeptA dedicated mobile Developer Experience team grew from 3 to 8 engineers and cut CI feedback time and failure rates by targeting the pain points that surveys, NPS and metrics like time to merge showed hurt developers most. iOS test time fell from about 50 minutes to an average of 9 by moving from Xcodebuild to Bazel with disk caching and bazel-diff, so only affected targets are tested. On Android, test sharding (in-house Fuel, later Flank) cut runs from 50+ minutes to under 20, and replacing Calabash with Espresso took suites from ~350 to ~60 minutes. Further gains came from auto-suppressing flaky tests (failure rate 57% to 4%), migrating from Jenkins to Buildkite (CI stability ~87% to 95%, TTM down 41%), generating Xcode projects with Xcodegen to avoid merge conflicts, and adopting a merge queue.
- Build better software to build software better
Slack Engineering mediumAdeptSlack cut the 60-minute build pipeline for Quip and Slack Canvas's backend by applying classic software engineering principles (hermetic, idempotent, granular units of work and clean separation of concerns) before adopting Bazel. A dependency edge from the built Python backend into the TypeScript frontend build zeroed the cache hit rate and cost about 35 minutes per build. The team untangled build code from application code, rewrote orchestration in Starlark, cut Python build scripts down to the standard library only, and used a Rust diffing tool to verify the new artifacts matched the old ones. The core lesson is that Bazel's caching and parallelism only pay off once the build graph is acyclic, well-defined and finely granular.
- How we rebuilt the Shopify app in 12 weeks
Shopify Engineering mediumAdeptThirty engineers rebuilt the 300+ screen Shopify mobile app from React Native to native Swift and Kotlin in 12 weeks, with agents writing most of the code. The key work was building a system around the agents: a shared Reflex architecture for iOS and Android that lets ViewModels run headless from a CLI in milliseconds, CI checks that fail on cross-platform drift, and Helix verifying small checkpoints against the legacy app, which served as the spec instead of written documents. As code generation got faster, the bottlenecks moved to laptops, code review, merging and coordination. Shopify answered with remote dev environments, agent-first adversarial review on small dual-platform PRs, a daily loop that turns review comments into rules, agent-driven merge queues, and pod ownership by product area. Launch time dropped about 50% on Android and 14% on iOS, and the Android binary shrank by 40%.