# How We Decomposed Tinder’s Monolith

[Tinder](https://yomu.fyi/company/tinder) · Tinder · May 23, 2025

**Type:** Problem & solution

## Summary

Tinder faced significant agility and build performance challenges caused by an iOS codebase monolith containing over 1,000 files and 150,000 lines of code. Manual extraction efforts risked creating massive, unmanageable pull requests that would require constant rebasing against the main branch. To systematically decompose the target into Swift sub-modules, the team mapped declarations and references via the Swift compiler into a directed graph. They iteratively extracted leaf nodes with an in-degree of zero across sequential phases and automated common code adjustments, including module dependencies, imports, access control levels, and dependency injection. The automated decomposition completed in under six months with zero P0 incidents, reducing monolith build times by 78% and disallowing future additions to the monolith target.

## Context

The Tinder iOS application contained a core monolith target with over 1,000 files and more than 150,000 lines of code accumulated over ten years. This entangled structure caused slow build times, lacked clear code ownership and tests, and hindered organizational agility. Additionally, deep build graphs lengthened compilation critical paths by restricting parallel compilation across machine cores.

## Approach / What changed

The team modularized the codebase by extracting code from the main monolith target into Swift sub-targets. Using Swift compiler declaration and reference data, they modeled the monolith as a directed graph and removed leaf nodes with an in-degree of zero in sequential phases. To avoid an estimated twelve-year manual effort, they automated file extractions and necessary downstream adjustments—such as updating module dependencies, imports, access control levels, and dependency injection—which allowed pull requests to be re-healed automatically during rebases.

## Takeaways

- Extracting files starting with leaf nodes (in-degree of 0) prevents sprawling pull requests that occur when pulling deeply intertwined dependencies out of a monolith.
- Each moved file required edits across an average of 15 other files, predominantly consisting of module dependency updates, import adjustments, access control changes, and dependency injection fixes.
- Automating code extraction and compilation fixes reduced the estimated project timeline from twelve years to under six months while cutting monolith build times by 78% with zero P0 incidents.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Developer Experience](https://yomu.fyi/topic/developer-experience), [iOS](https://yomu.fyi/topic/ios), [Monoliths](https://yomu.fyi/topic/monolith), [Refactoring](https://yomu.fyi/topic/refactoring)

[Read original post](https://medium.com/tinder/how-we-decomposed-tinders-monolith-48dcf01a6066)
