name: architecture-paradigm-modular-monolith
description: |
Triggers: monolith, architecture, modular, team-autonomy, modular-monolith
Single deployable with enforced module boundaries for team autonomy without distributed complexity.
Triggers: modular monolith, module boundaries, single deployment, team autonomy
Use when: teams need autonomy without distributed overhead
DO NOT use when: already using microservices or system is small.
version: 1.3.7
category: architectural-pattern
tags: [architecture, modular-monolith, monolith, internal-boundaries, team-autonomy]
dependencies: []
tools: [dependency-analyzer, module-boundary-enforcer, refactoring-planner]
usage_patterns:
- paradigm-implementation
- monolith-modernization
- team-scaling
complexity: medium
estimated_tokens: 700
The Modular Monolith Paradigm
When to Employ This Paradigm
- When you desire team autonomy similar to that of microservices, but without the operational overhead of a distributed system.
- When release velocity is slowed by tangled dependencies between internal modules.
- When a monolithic architecture is simpler to operate today, but there is a clear need to evolve toward a service-based model in the future.
Adoption Steps
- Identify Modules: Define module boundaries that align with distinct business capabilities or Bounded Contexts from Domain-Driven Design.
- Encapsulate Internals: Use language-level visibility modifiers (e.g., public/private), separate packages, or namespaces to hide the implementation details of each module.
- Expose Public Contracts: Each module should expose its functionality through well-defined facades, APIs, or events. Forbid direct database table access or direct implementation calls between modules.
- Enforce Architectural Fitness: Implement automated tests that fail the build if forbidden dependencies or package references are introduced between modules.
- Plan for Evolution: Continuously track metrics such as change coupling and deployment scope to make informed decisions about if and when to split a module into a separate service.
Key Deliverables
- An Architecture Decision Record (ADR) that maps module boundaries and defines the rules for any shared code.
- Formal contract documentation (e.g., OpenAPI specs, event schemas) for every interaction point between modules.
- Automated dependency checks and dedicated CI/CD jobs for each module to enforce boundaries.
Risks & Mitigations
- Regression to a "Big Ball of Mud":
- Mitigation: Without strict enforcement, module boundaries will inevitably erode. Treat any boundary violation as a build-breaking error and maintain a disciplined approach to code reviews.
- Shared Database Hotspots:
- Mitigation: High contention on a shared database can become a bottleneck. Introduce clear schema ownership, use view-based access to restrict data visibility, or implement data replication strategies to reduce coupling.
Troubleshooting
Common Issues
Skill not loading
Check YAML frontmatter syntax and required fields
Token limits exceeded
Use progressive disclosure - move details to modules
Modules not found
Verify module paths in SKILL.md are correct
1---2name: architecture-paradigm-modular-monolith3description: - When you desire team autonomy similar to that of microservices, but without the operational overhead of a distributed system.4---5
6---
7name: architecture-paradigm-modular-monolith
8description: |
9
10Triggers: monolith, architecture, modular, team-autonomy, modular-monolith
11 Single deployable with enforced module boundaries for team autonomy without distributed complexity.
12
13 Triggers: modular monolith, module boundaries, single deployment, team autonomy
14 Use when: teams need autonomy without distributed overhead
15 DO NOT use when: already using microservices or system is small.
16version: 1.3.7
17category: architectural-pattern
18tags: [architecture, modular-monolith, monolith, internal-boundaries, team-autonomy]
19dependencies: []
20tools: [dependency-analyzer, module-boundary-enforcer, refactoring-planner]
21usage_patterns:
22 - paradigm-implementation
23 - monolith-modernization
24 - team-scaling
25complexity: medium
26estimated_tokens: 700
27---
28
29# The Modular Monolith Paradigm
30
31## When to Employ This Paradigm
32- When you desire team autonomy similar to that of microservices, but without the operational overhead of a distributed system.
33- When release velocity is slowed by tangled dependencies between internal modules.
34- When a monolithic architecture is simpler to operate today, but there is a clear need to evolve toward a service-based model in the future.
35
36## Adoption Steps
371. **Identify Modules**: Define module boundaries that align with distinct business capabilities or Bounded Contexts from Domain-Driven Design.
382. **Encapsulate Internals**: Use language-level visibility modifiers (e.g., public/private), separate packages, or namespaces to hide the implementation details of each module.
393. **Expose Public Contracts**: Each module should expose its functionality through well-defined facades, APIs, or events. Forbid direct database table access or direct implementation calls between modules.
404. **Enforce Architectural Fitness**: Implement automated tests that fail the build if forbidden dependencies or package references are introduced between modules.
415. **Plan for Evolution**: Continuously track metrics such as change coupling and deployment scope to make informed decisions about if and when to split a module into a separate service.
42
43## Key Deliverables
44- An Architecture Decision Record (ADR) that maps module boundaries and defines the rules for any shared code.
45- Formal contract documentation (e.g., OpenAPI specs, event schemas) for every interaction point between modules.
46- Automated dependency checks and dedicated CI/CD jobs for each module to enforce boundaries.
47
48## Risks & Mitigations
49- **Regression to a "Big Ball of Mud"**:
50 - **Mitigation**: Without strict enforcement, module boundaries will inevitably erode. Treat any boundary violation as a build-breaking error and maintain a disciplined approach to code reviews.
51- **Shared Database Hotspots**:
52 - **Mitigation**: High contention on a shared database can become a bottleneck. Introduce clear schema ownership, use view-based access to restrict data visibility, or implement data replication strategies to reduce coupling.
53## Troubleshooting
54
55### Common Issues
56
57**Skill not loading**
58Check YAML frontmatter syntax and required fields
59
60**Token limits exceeded**
61Use progressive disclosure - move details to modules
62
63**Modules not found**
64Verify module paths in SKILL.md are correct