Baseleg Docs
Reference · Diagrams / Architecture layers · Baseleg Docs

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

LayerMay import from
UIApplication, UI (shared), selected Domain types/value objects
ApplicationDomain, Shared
DomainShared only
InfrastructureDomain, Shared

See Package boundaries for the full import rules with code examples.