architecture-paradigm-modular-monolith
npx machina-cli add skill athola/claude-night-market/architecture-paradigm-modular-monolith --openclawThe Modular Monolith Paradigm
When To Use
- Organizing large codebases into well-bounded modules
- Teams wanting microservice boundaries without distributed complexity
When NOT To Use
- Already distributed as microservices
- Tiny applications where module boundaries add unnecessary complexity
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
Source
git clone https://github.com/athola/claude-night-market/blob/master/plugins/archetypes/skills/architecture-paradigm-modular-monolith/SKILL.mdView on GitHub Overview
It delivers a single deployable architecture with well-bounded modules to grant team autonomy without distributed overhead. By enforcing internal module boundaries and public contracts, it preserves monolith simplicity while enabling future service evolution.
How This Skill Works
Define modules aligned with business capabilities, then encapsulate internals using visibility modifiers, packages, or namespaces. Each module exposes well-defined contracts through facades, APIs, or events and forbids direct cross-module access; automated dependency checks and tests enforce these boundaries in CI/CD.
When to Use It
- Organizing large codebases into well-bounded modules
- Teams wanting microservice boundaries without distributed overhead
- Autonomy for teams without introducing distributed systems
- Release velocity slowed by tangled internal dependencies
- Planning to evolve toward a service-based model while keeping a single deployment today
Quick Start
- Step 1: Identify Modules: Define module boundaries that align with distinct business capabilities or bounded contexts
- Step 2: Encapsulate Internals: Use visibility modifiers, packages, or namespaces to hide module implementation details
- Step 3: Expose Public Contracts: Provide APIs, facades, or events for inter-module interactions and add automated checks
Best Practices
- Define modules aligned with business capabilities or bounded contexts
- Encapsulate internals with visibility modifiers, separate packages, or namespaces
- Expose public contracts via well-defined facades, APIs, or events
- Enforce boundaries with automated dependency checks and tests in CI/CD
- Maintain ADRs and formal contract documentation for module interactions
Example Use Cases
- A large e-commerce platform reorganized from a single codebase into modules like catalog, orders, and payments while preserving a single deployable artifact
- A SaaS product where multiple teams own modules but operate under one deployment with stable API contracts
- A CRM system decoupled into modules to reduce cross-team changes and minimize blast radius
- A legacy monolith modernization project focusing on module boundaries and automated dependency checks in CI
- An internal tool suite evolving toward services while keeping a unified deployment today
Frequently Asked Questions
Related Skills
architecture-paradigm-space-based
athola/claude-night-market
'Data-grid architecture for high-traffic stateful workloads with linear
architecture-paradigm-layered
athola/claude-night-market
'Consult this skill when implementing layered patterns or enforcing layer
architecture-paradigm-microkernel
athola/claude-night-market
'Minimal core system with plugin-based feature extensibility for platform
architecture-paradigm-microservices
athola/claude-night-market
'Consult this skill when designing or evolving microservices architectures.
architecture-paradigm-pipeline
athola/claude-night-market
'Consult this skill when designing data pipelines or transformation workflows.
architecture-paradigm-serverless
athola/claude-night-market
'Serverless FaaS for event-driven workloads with minimal infrastructure