Architecture and Module Boundaries
Avoid tightly coupled backend code that slows delivery and increases regression risk.
Recommended approach
- Model backend as domain modules with clear public interfaces.
- Keep infrastructure adapters (DB, queues, third-party APIs) separated from domain logic.
- Allow inter-module communication through explicit contracts/events.
Alternatives and when to choose them
- Layer-first architecture for simple services.
- Event-first architecture when asynchronous integration is dominant.
Implementation checklist
- Define module responsibilities and ownership.
- Limit cross-module imports.
- Add architectural tests or lint rules for boundaries.
Common pitfalls
- Shared util modules turning into hidden dependency hubs.
- Circular module dependencies.