Modular Monolith Architecture Style Evaluation

    1

    Evaluates Modular Monolith: logical module boundaries, in-process calls, schema separation, and microservice trade-offs.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Modular Monolith Architecture Style Evaluation

    Example session with this skill installed

    Evaluate the Modular Monolith architecture style for our Retail Loan Origination & Servicing Platform.

    • Subject: retail-loan-platform v3.0 (run-id: loan-modmono-style-001) serving 6.5 million retail borrowers with 35 engineers across 4 squads.
    • Deciders: Chief Architect (David O'Reilly) and Head of Retail Lending Systems (Elena Rostova).
    • Scope: Peak 6,200 applications/hour; decisioning budget p99 <= 120 ms; single shared PostgreSQL Aurora database.
    • Tension: Squads proposed immediately breaking into 18 Kubernetes microservices; David O'Reilly and Elena Rostova resist premature distribution, citing audit AUD-4912 showing the team lacks dedicated SRE staff, and a microservice experiment quadrupled cloud costs while rollbacks caused 4.2% data drift. They mandate an evaluation comparing Modular Monolith (Spring Modulith + ArchUnit) against Microservices and Traditional Monoliths, evaluating in-process latency, operational overhead, and logical schema boundaries.

    Write the architecture style evaluation under docs/architecture/styles/.

    • Read your context and instructions
    • Compiled the modular monolith architecture

    Wrote docs/architecture/styles/modular-monolith-style-evaluation.md. Complete Modular Monolith style evaluation establishing logical module boundaries, in-process zero-network communication, schema separation, and ArchUnit compile-time enforcement.


    skill: modular-monolith-style

    Architecture Style Evaluation: Modular Monolith Style [STYLE-MODMONO-001]

    Summary

    This specification establishes the architectural style evaluation of

    Modular Monolith Architecture for retail-loan-platform v3.0 under run ID loan-modmono-style-001. It evaluates candidate architectural styles for orchestrating loan origination, credit scoring, underwriting, and monthly loan servicing across 35 engineers (4 squads) serving 6.5 million retail borrowers. The evaluation resolves the operational overhead and distributed data inconsistency identified in audit AUD-4912 (where an experimental microservices pilot quadrupled cloud infrastructure expenditure and generated 4.2% data inconsistencies during network partition rollbacks, in an engineering team lacking dedicated 24/7 SRE staff). The evaluation compares three primary architecture styles: Traditional Big-Ball-of-Mud Monolith, 18 Distributed Microservices, and Modular Monolith with Compile-Time Boundary Enforcement (Spring Modulith + ArchUnit). It selects Modular Monolith as the optimal style, specifying strictly encapsulated in-process modules, zero-network in-memory event channels, isolated database schemas on a single PostgreSQL Aurora instance, and clean extraction seams for future selective microservice decoupling.

    Detailed Description

    Organizations with fewer than 50 engineers frequently suffer catastrophic productivity loss when adopting microservices prematurely. The operational burden of managing 18 distinct CI/CD pipelines, Kubernetes Helm charts, service meshes, and distributed tracing distracts small engineering teams from delivering business features. A Modular Monolith provides the structural hygiene, clear domain boundaries, and independent squad code ownership of microservices, while executing within a single deployment runtime. In-process function calls replace brittle network RPCs, atomic database transactions replace fragile distributed sagas, and compile-time boundaries prevent code spaghetti.

    Incoming Loan Application (REST API: 6,200 apps/hour)
                             │
                             ▼
    ┌────────────────────────────────────────────────────────┐
    │ Single Deployment Runtime (JVM 21 Spring Modulith)     │
    │                                                        │
    │ [ Module: `origination` ] ──(In-Process Event)──┐      │
    │   ├── Package-Private Implementation            │      │
    │   └── Public API: `LoanApplicationService`      ▼      │
    │                                           [ Event Bus] │
    │ [ Module: `underwriting` ] ◄────────────────────┘      │
    │   ├── Package-Private Invariants                       │
    │   └── Dedicated Logical DB Schema: `underwriting.*`    │
    └────────────────────────────────────────────────────────┘
                             │
                             ▼ (Single Local ACID Transaction)
    [ Unified AWS Aurora PostgreSQL Cluster ]
      ├── Schema: `origination.*` (Private to origination module)
      └── Schema: `underwriting.*` (Private to underwriting module)
    

    Criteria and weights

    CriterionWhy it matters hereWeightSource of the weight
    Operational Overhead & SRE SimplicityTeam of 35 engineers lacks 24/7 dedicated SRE staff to operate 18 microservices (AUD-4912).0.40David O'Reilly (Chief Architect)
    Transactional Consistency & Zero Data DriftFinancial loan allocations must not experience 4.2% data loss from distributed network rollbacks.0.30Elena Rostova (Head of Retail Lending)
    In-Process Execution Latency (p99 <= 120 ms)In-memory function calls eliminate 18 network hops, guaranteeing sub-millisecond module transit.0.15Core Retail Lending SLA
    Future Microservice Extraction ReadinessModule boundaries must be clean enough to extract into independent microservices if scale requires.0.15Enterprise Architecture Policy

    Comparison

    Architecture Style CandidateOperational OverheadConsistency ModelNetwork Call Graph HopsDelivery Velocity (35 devs)Evaluation
    Option A: Big-Ball-of-Mud MonolithVery Low (1 repo)ACID (Shared DB)0 hopsLow (Code coupling spaghetti)Rejected: Unbounded code bleed; alter-table scripts break unrelated modules.
    Option B: 18 Kubernetes MicroservicesExtreme (18 pipelines)Eventual (Distributed 2PC)14 network RPC hopsPoor (SRE overhead chokes devs)Rejected: AUD-4912 4.2% data drift; $240k/yr cloud cost explosion.
    Option C: Modular Monolith (Chosen)Low (Single deployment)ACID (Modular schemas)0 hops (In-memory calls)Very High (Independent module code)Selected: Zero distributed tax, sub-120ms latency, clean module walls.

    Result

    Option C is selected. Modular Monolith enforces rigid module boundaries using Spring Modulith and ArchUnit; execution remains in-process on a single JVM; database schemas are strictly partitioned to guarantee future extraction optionality.


    Required Mechanisms

    1. Module Boundary & Package Encapsulation Model [MC-MB-01]
    • The codebase is structured into four authoritative top-level modules:
      1. com.bank.loan.origination
      2. com.bank.loan.underwriting
      3. com.bank.loan.scoring
      4. com.bank.loan.servicing
    • Strict Encapsulation Rule:
      • Only classes located directly in com.bank.loan.<module>.api are marked public.
      • All internal services, domain entities, and repositories reside in package-private packages (com.bank.loan.<module>.internal.*).
      • Cross-module access is enforced via ArchUnit and Spring Modulith @NamedInterface.
    2. In-Process Communication & Zero-Network Hops [MC-IC-01]
    • Modules interact strictly via:
      1. Direct Synchronous API Invocations: Invoking public interface methods exposed in the companion .api package.

    In-Process Application Events: Publishing Spring Application Events (LoanApplicationSubmittedEvent) consumed asynchronously via in-memory thread pools.

    Latency Impact: Cross-module interaction executes in

    < 0.05 milliseconds (compared to 15–40 ms for network HTTP/gRPC).

    3. Database Schema Partitioning & Foreign Key Governance [MC-SP-01]
    • The single AWS Aurora PostgreSQL database is partitioned into isolated relational schemas:
      • CREATE SCHEMA origination;
      • CREATE SCHEMA underwriting;
      • CREATE SCHEMA servicing;

    Zero Cross-Schema Foreign Keys: Foreign keys crossing schema boundaries are

    strictly barred. Modules reference entities in other schemas exclusively via immutable UUID primary keys, guaranteeing zero database coupling.

    4. Automated CI Architectural Enforcement [MC-AE-01]
    • Continuous Integration runs Spring Modulith verification on every commit:
      @Test
      void verifyModularStructure() {
          ApplicationModules.of(Application.class).verify();
      }
      
    • Any commit introducing an illegal cross-module internal reference or circular dependency immediately fails compilation and CI gating.

    Invariants and Contracts

    Strict Package-Private Module Encapsulation [INV-MODMONO-01]
      Classes outside a module's public `.api` package must be marked package-private.
      Directly importing internal classes from another module fails automated ArchUnit CI checks.
    
    Zero Cross-Schema Database Foreign Keys [INV-MODMONO-02]
      Relational database tables owned by one module must not establish foreign key constraints
      to tables owned by another module. Cross-module identity references must use plain UUID strings.
    
    In-Process Event-Driven Decoupling [INV-MODMONO-03]
      Cross-module business workflows that do not require immediate synchronous return values
      must be decoupled using in-process asynchronous domain events.
    

    Explicit Unknowns

    • Memory consumption growth on the single JVM heap when 35 concurrent developers deploy high-frequency integration tests (G-1).
    • Time required to perform automated database backups on a single 1.8 TB PostgreSQL database housing all 4 partitioned schemas (G-2).

    Traceability

    ClaimClassificationSourceFreshness
    35 engineers across 4 squadsprovidedOrganizational intakeCurrent
    6.5 million retail borrowersprovidedBusiness scope intakeCurrent
    Peak 6,200 loan applications/hourprovidedVolumetric traffic profileCurrent
    Audit AUD-4912 4.2% data drift & cloud cost surgeprovidedInternal architecture audit reportHistorical
    End-to-end decisioning budget p99 <= 120 msprovidedRetail Lending Systems SLACurrent
    Modular Monolith selected over MicroservicesdecidedDavid O'Reilly & Elena Rostova2026-09-15
    Zero cross-schema foreign keys invariantdecidedArchitectural invariant INV-MODMONO-022026-09-15

    Verification

    No validator was supplied, so no command was run.

    Reviewer self-check against Modular Monolith architecture standards:

    • Operational Fit: PASS. Avoids distributed microservice tax for a 35-engineer team without dedicated SREs.
    • Boundary Rigor: PASS. Spring Modulith and ArchUnit enforce compile-time package-private encapsulation.
    • Data Autonomy: PASS. Isolated relational schemas and zero cross-schema foreign keys preserve extraction seams.
    • Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to rule_markdown.md.

    Open Decisions

    • DEC-MODMONO-01: David O'Reilly to determine whether database migration scripts (Flyway / Liquibase) should be maintained in separate per-module directories or a single root migration folder (Owner: David O'Reilly).

    Next steps

    1. Core Engineering configures Spring Modulith and ArchUnit test verifications in the master build file.
    2. Refactor existing subdomains into explicit .api and .internal package structures.
    3. Migrate the shared PostgreSQL database into four isolated schemas (origination, underwriting, scoring, servicing).

    Connects securely to your tools. The creator never sees your data.

    About this skill

    What it does

    This skill evaluates whether enforceable capability/data seams inside one deployable fit supplied cohesion, change, transaction, scaling, team and operating forces. It compares simpler modules and distributed alternatives without designing modules.

    Use it when

    Use when an authorized style decision asks whether a scoped application should use a modular monolith rather than an unstructured/layered monolith or distributed services, with evidence about capability cohesion and enforceable seams.

    For example: “We were told to break up the monolith. Our two teams are already blocked on each other's merges but we don't have anyone to run a service estate.”

    What you get

    • Modular Monolith Assessment

    Written as Markdown to <your output folder>/architecture/tasks/<run-id>/modular-monolith-style/.

    What it will not do

    Do not use merely to decompose modules, design APIs/data ownership, reorganize packages, write architecture tests, choose DDD/Clean/Hexagonal, or extract services.

    How it works

    1. Check the framing is enforced modules in one deployable.
    2. Identify the boundaries the domain already suggests.
    3. Decide how the boundary will be enforced, mechanically.
    4. State what stays shared and why.
    5. Name the reversal trigger.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-task.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Do not use merely to decompose modules, design APIs/data ownership, reorganize packages, write architecture tests, choose DDD/Clean/Hexagonal, or extract services.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    Permissions

    Read Files
    Write Files

    Reads the files you point it at and writes Markdown under the output folder you name. No network access, no environment variables, and no bundled scripts.

    Listed1 month ago

    What's inside

    Frequently Asked Questions

    This skill evaluates if a modular monolith is the right architectural fit based on your team structure, scaling needs, and domain cohesion, helping you avoid the complexity of microservices when internal seams are sufficient.

    The package includes an OpenAI-compatible agent configuration (yaml), structured output templates, and specialized reference guides for domain and operating rules to ensure consistent evaluation.

    No, this skill focuses strictly on the 'style evaluation' phase; it assesses whether boundaries are enforceable and valid but does not perform the actual code refactoring or API design.

    This is an instruction-based skill that requires an AI agent capable of processing YAML configurations and Markdown templates, specifically optimized for OpenAI-style agents.

    The skill provides a comprehensive Modular Monolith Assessment in Markdown format, identifying suggested boundaries, enforcement mechanisms, and the specific triggers that would necessitate a move to a different architecture.

    New in APIs & Backend