Modulith
A modular monolith architecture that combines the simplicity of monoliths with the organizational benefits of microservices.
Also known as: Modular Monolith, Structured Monolith
Category: Software Development
Tags: architecture, software-engineering, software-design, systems, patterns, modularity
Explanation
A modulith (modular monolith) is an architectural pattern that structures a monolithic application into well-defined, loosely coupled modules while maintaining a single deployment unit. It represents a middle ground between traditional monoliths and microservices, offering many organizational benefits without the operational complexity of distributed systems. Key characteristics include: (1) Clear module boundaries with explicit public interfaces, (2) Modules communicate through well-defined APIs (not direct database access), (3) Each module owns its data and domain logic, (4) Single deployment artifact and shared infrastructure, (5) Modules can be developed by separate teams. Design principles: modules should align with business domains (often using Domain-Driven Design's Bounded Contexts), dependencies between modules should be explicit and minimized, and each module should be independently testable. Advantages over traditional monoliths: better code organization, clearer ownership boundaries, easier refactoring, and a clear migration path to microservices if needed. Advantages over microservices: simpler deployment and operations, no network latency between modules, easier debugging and tracing, simpler transactions, and lower infrastructure costs. The modulith pattern is particularly valuable when: (1) Starting a new project where microservices would be premature, (2) The team is small but expects growth, (3) Domain boundaries are still being discovered, (4) Operational complexity of microservices is not justified. Popular frameworks supporting moduliths include Spring Modulith for Java and similar patterns in other ecosystems.
Related Concepts
← Back to all concepts