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:

  1. Library extraction — pure-logic gems from lib/gitlab/ (already underway)
  2. Layer gemsgitlab-rails-api, -graphql, -sidekiq, -controllers
  3. Feature-domain gemsgitlab-<domain>-backend + transport gems per domain
  4. gRPC interfaces — formal contracts between gems, enabling microservice graduation
  5. 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 corresponding gitlab-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.
  • Internal namespace 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

Commits

  • Add Modular Monolith

Edited by Kamil Trzciński

Merge request reports

Loading