Use Cases: Application Business Rules
You'll learn what use cases are in Clean Architecture and how they orchestrate entities to implement application-specific workflows without coupling to frameworks.
What Are Use Cases?
In Clean Architecture, use cases (also called interactors) represent your application's specific business rules—the workflows and scenarios your system performs. While entities contain enterprise-wide business logic that could theoretically be shared across multiple applications, use cases define what this particular application does.
Think of entities as the "nouns" of your business (Customer, Order, Product) and use cases as the "verbs"—the actions your application supports (PlaceOrder, CancelSubscription, GenerateReport).
Orchestration Without Dependencies
Use cases sit one layer outside entities in Clean Architecture. They:
- Orchestrate entities to fulfill specific application scenarios
- Coordinate data flow between the outer world (UI, database, APIs) and the core business logic
- Remain framework-agnostic—no references to web frameworks, databases, or UI libraries
- Define interfaces (ports) for data access or external services, letting adapters implement them
For example, a PlaceOrderUseCase might retrieve a customer entity, validate inventory through an interface, create an order entity, and trigger a payment—all without knowing whether data comes from PostgreSQL or MongoDB, or whether notifications go via email or SMS.
The Sweet Spot
Use cases capture application-specific rules like "users must be logged in to place orders" or "free-tier accounts are limited to 5 projects." These aren't fundamental business rules (entities), but they're also not UI or database concerns (adapters). They're pure application logic.
Key Takeaway: Use cases implement application-specific business workflows by orchestrating entities and defining interfaces for external dependencies, keeping your core logic independent of frameworks and infrastructure.