Architecture layers
The four layers of Baseleg and the direction of allowed dependencies.
UI
apps/web/src/pages/ · packages/ui/Renders views · handles user interaction · calls use cases · no business rule decisions
calls use cases
Application
packages/application/<context>/Use cases · orchestration · transaction boundaries · defines ports for infrastructure
owns model
calls ports
Domain
packages/domain/<context>/Entities · value objects · domain rules · no infrastructure imports
Only depends on
@baseleg/shared-*Infrastructure
packages/infrastructure/D1/Drizzle · repository impls · auth · notification adapters
Implements ports · depends on Domain + Shared
Forbidden: UI → Infrastructure · Domain → Infrastructure · Application → Infrastructure implementations · UI → Drizzle schema
Dependency rules
| Layer | May import from |
|---|---|
| UI | Application, UI (shared), selected Domain types/value objects |
| Application | Domain, Shared |
| Domain | Shared only |
| Infrastructure | Domain, Shared |
See Package boundaries for the full import rules with code examples.