Loading…
Under Deconstruction: The State of Shopify’s Monolith
2023-10-18
- Source
- Shopify
- Published
- Added to Yomu
Summary
Shopify describes the ongoing effort to modularize its core Ruby on Rails monolith, which contains more than 2.8 million lines of Ruby and 500,000 commits. The initiative organizes code into independently owned components intended to narrow developer focus, reduce affected test suites, preserve contracts, and clarify operational ownership, while recognizing that large-scale refactoring is also a people problem. The work has already improved exception triage, distributed codebase chores, and design awareness, while its current practices emphasize grassroots participation, tooling, targeted reviews, and a holistic architectural view. Packwerk restricts dependencies for about a third of the 37 main-monolith components. Shopify is pursuing a cleaner dependency graph, componentized Rails applications by default, and isolated component tests, while reserving service extraction for cases such as storefront rendering and credit-card vaulting.
Context
Shopify’s core Rails monolith has accumulated more than 2.8 million lines of Ruby and 500,000 commits as features and system complexity increased. Rails does not provide patterns or tooling for managing that complexity in structured, well-bounded ways. The scale and continuous development of the codebase also mean that modularization requires changing the behavior and understanding of many contributors, not just applying a centralized refactor.
Approach / What changed
Shopify created a team to divide the monolith into smaller, independently owned components. The effort combines grassroots education and collaboration with automated tooling, targeted code reviews, dependency restrictions through Packwerk, public component entrypoints, and progressive cleanup of the dependency graph. The company is also preparing new Rails applications to be componentized by default and selectively extracts separate services when the use case justifies the added distributed-system complexity.
Takeaways
- Shopify’s main monolith has 37 components, and Packwerk is used on about a third of them to restrict dependencies and protect internal implementation privacy.
- The modularity effort treats developer behavior as central: prompts from tooling and reviews are insufficient without the motivation and ability to make modular changes.
- Shopify reserves service extraction for cases with clear separation benefits, including high-throughput storefront rendering and sensitive credit-card vaulting; other applications may remain modular monoliths.