HandbookXV the PantheonModules and boundaries
XVthe Pantheon, Design the systemModules and boundaries
In plain words
A module boundary is a line inside one codebase where a part, such as billing, exposes a small public interface and keeps its tables and internals private, so other parts can't reach in.
Where you see it
In Harbor's codebase, the deploys code imports billing's database models to check a customer's plan. When billing renames a column, deploys break. Giving billing one exported function, getPlanFor(accountId), and banning other imports stops that happening again.
What goes wrong
- Sharing tables across modules
When deploys queries billing's subscriptions table directly, billing can't change its own schema without breaking someone. Each module owns its tables, and others ask through its interface.
- Boundaries that exist only as folder names
Folders called billing and deploys mean little if any file can import any other. Enforce the rule with a lint or dependency check in CI.
- A shared utils folder that knows everything
A common folder that slowly collects business rules becomes the thing every module depends on and nobody owns. Keep shared code generic, such as dates and formatting, and move business rules to the module they belong to.
What to tell your agent
Quick check
Sign in to earn +10 XP for itHarbor's deploys module reads billing's subscriptions table directly. Billing renames a column and deploys break. What's the lasting fix?