Independence from Frameworks
Clean Architecture groups code into concentric circles. The primary rule is: code dependencies must only point inward. High-level business rules must not know anything about the database, web framework, UI, or host system.
The Core Domain Layer
At the center sits the Domain Layer (Entities, Use Cases, Calculations). It contains purely abstract business rules. It contains zero imports from Express, Next.js, Prisma, or external SDKs. If you switch from React to a CLI tool, this core remains unchanged.
Ports and Adapters
External layers communicate with the core domain via Ports (interfaces defined in the core domain) and Adapters (implementations in the infrastructure layer).
For example, the domain defines a `PaymentPort` interface. The infrastructure layer provides a `StripePaymentAdapter` implementing that interface.
