Baseleg Docs

ADR-004: Architectural layering

Date: 2026-04-28 Status: Accepted

Context

We want domain-led modularity with clear dependency direction, while avoiding heavy enterprise DDD patterns.

Decision

Adopt the layering:

  • UI โ†’ Application โ†’ Domain โ†’ (Infrastructure implementations)

With explicit rules:

  • Domain depends only on Shared.
  • Application depends on Domain and Shared.
  • Infrastructure depends on Domain and Shared.
  • UI depends on Application, UI, Shared, and selected Domain types/value objects.

Consequences

  • UI cannot shortcut to database/repositories.
  • Business rules remain portable and testable.

Alternatives considered

  • Fully anemic domain model (business rules drift into UI/infrastructure)
  • Microservices (too heavy for early stage)