Draft: Update on Monolith Modularization Strategy
What does this MR do and why?
Adds modular.md — a strategy document for decomposing the GitLab Rails
monolith into in-repo Ruby gems, covering five phases:
- Library extraction — pure-logic gems from
lib/gitlab/(already underway) - Layer gems —
gitlab-rails-api,-graphql,-sidekiq,-controllers - Feature-domain gems —
gitlab-<domain>-backend+ transport gems per domain - gRPC interfaces — formal contracts between gems, enabling microservice graduation
- Native extensions — Rust rewrites for performance-critical paths
Key design decisions
- Backend gems (
-backend) own domain models, services, finders, policies. Transport gems (-api,-graphql,-sidekiq,-controllers) are thin layers included by the correspondinggitlab-rails-*layer gem. - Four deployment modes per domain: monolith-owned → transport extracted → backend extracted with callbacks → fully standalone.
- Callbacks start as direct Ruby lambdas in initializers, evolve to gRPC. Backend gems must not use monolith AR models directly (allowed during transition as tech debt).
- Transport gems can use monolith AR models directly — they run in-process.
Internalnamespace enforced by RuboCop to prevent cross-gem access to private implementation.- Phase ordering driven by business impact, not phase number. Phase 1 establishes patterns; Phase 2-5 are prioritized per domain need.
- Glue layer between monolith and domain is expected to be substantial; dependency direction (monolith → backend or backend → monolith) is per-domain.
Relation to existing proposals
References the Modular Monolith and Hexagonal Rails Monolith proposals. This strategy uses gems instead of Packwerk for isolation, and extends scope with gRPC interfaces, native extensions, and data-layer extraction.
Author and Reviewer Checklist
Please verify the check list and ensure to tick them off before the MR is merged.
- Provided a concise title for this Merge Request (MR)
- Added a description to this MR explaining the reasons for the proposed change, per say why, not just what
- Copy/paste the Slack conversation to document it for later, or upload screenshots. Verify that no confidential data is added, and the content is SAFE
- Assign reviewers for this MR to the correct
- The when to get approval handbook section explains when DRI approval is required
- The who can approve handbook section explains how to identify the DRI
- If the MR does not require DRI approval, consider asking someone on your team, such as your manager.
- The approver may merge the MR. If they approve but don't merge, you can merge.
- For transparency, share this MR with the audience that will be impacted.
- Team: For changes that affect your direct team, share in your group Slack channel
- Department: If the update affects your department, share the MR in your department Slack channel
- Division: If the update affects your division, share the MR in your division Slack channel
- Company: If the update affects all (or the majority of) GitLab team members, post an update in #whats-happening-at-gitlab linking to this MR
- For high-priority company-wide announcements work with the internal communications team to post the update in #company-fyi and align on a plan to circulate in additional channels like the "While You Were Iterating" Newsletter
Commits
- Add Modular Monolith
Edited by Kamil Trzciński