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

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 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
    • Generated the document

    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).

    modular-monolith-architecture-style-eval.pdf

    PDF · document

    Generated

    Example file from a real run - the skill writes it into your workspace.

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

    What you get

    Determine if internal module boundaries fit team and scaling forcesCompare modular monolith trade-offs against microservice alternativesDefine mechanical enforcement for domain-driven capability seamsIdentify reversal triggers for future microservice extraction

    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

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 12 days ago

    • Passed all security checks, Safe to install

    Listed12 days ago

    What's inside

    Frequently Asked Questions