modular-monolith

Design modular monolith architectures with enforced module boundaries and migration-ready structure.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill modular-monolith-maicongambini
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modular-monolith
Source: https://github.com/MaiconGambini/opencode-harness-guide/tree/main/skills/modular-monolith
Command: npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill modular-monolith-maicongambini

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Monoliths without clear internal structure degrade into big balls of mud, while adopting microservices too early creates distributed complexity. This Skill provides architecture principles for building monoliths with enforced module boundaries, clean contracts, and a viable path to microservices extraction later. ## Core Features & Use Cases - Module Boundary Definition: Identify bounded contexts, size modules correctly, and define public API contracts via index exports. - Communication Patterns: Decide between synchronous public API calls and asynchronous event-driven communication with a decision framework. - Data Isolation & Shared Kernel Rules: Enforce per-module data ownership, minimize shared code, and prevent cross-module coupling. - Use Case: When starting a new application that doesn't justify microservices, use this Skill to structure modules (users, orders, notifications) with isolated data, event-driven side effects, and a composition root — so any module can later be extracted into a service with only communication-layer changes. ## Quick Start Ask the AI to design a modular monolith structure for your application with defined module boundaries, public APIs, and event-based communication.

Frequently Asked Questions about modular-monolith

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a modular monolith application?

Organize code into modules per bounded context, each with api, domain, services, repositories, and events folders plus an index.ts exposing only the public API. Wire all modules together in a single composition root using dependency injection.

When should I use a modular monolith instead of microservices?

Use a modular monolith when the application doesn't need independent scaling, separate deployment cycles, or different tech stacks per component. It provides clean boundaries and simple deployment without distributed-systems overhead.

How do modules communicate in a modular monolith?

Modules communicate synchronously through public API exports when an immediate response is needed, or asynchronously via an in-process event bus for side effects and notifications. Never import another module's internal files.

Can modules in a monolith share database tables?

No. Each module owns its tables exclusively, cross-module access goes through the owning module's public API, and cross-module SQL JOINs are prohibited. Data duplication with event-driven synchronization is acceptable.

How do I migrate a modular monolith module to a microservice?

Replace synchronous calls with HTTP or gRPC clients, swap the in-process event bus for a message broker, move the module to its own repository, and deploy it independently. Clean boundaries make these steps mechanical.

What are the limitations of the modular monolith approach?

It is unsuitable when you are already committed to microservices, when the project is a small script without domain complexity, or when you need infrastructure and DevOps guidance rather than code architecture.