Organize code by feature/domain (not only by technical layers), expose small internal APIs between modules, and forbid “reach-through” imports into other modules’ internals. Add ownership (who maintains what) and architectural checks (module boundaries) so boundaries don’t decay over time.
Expanding on the short answer — what usually matters in practice:
A tiny example (an explanation template):
// Example: discuss trade-offs for "how-do-you-keep-domain-boundaries-clear-inside-a"
function explain() {
// Start from the core idea:
// Organize code by feature/domain (not only by technical layers), expose small internal APIs
}