In Onion Architecture, core business logic belongs in the domain layer (the center), expressed through domain entities, value objects, domain services, and—in most formulations—the application/use-case services that orchestrate them, with all dependencies pointing inward toward that core. Infrastructure concerns (databases, HTTP, messaging, file systems, third-party APIs) sit on the outer rings and depend on the domain, never the reverse.
The short answer holds across the common variants of Onion Architecture, but it needs two clarifications early. First, "business logic" is not one thing: domain logic (the invariants and rules of the business itself) and application logic (the workflow that coordinates a use case) are often treated as distinct rings or distinct modules, even though both live inside the infrastructure boundary. Second, Onion is a structural pattern, not a doctrine; different teams draw the inner rings differently—some merging application services with the domain model, others keeping them separate. What never changes is the direction of dependency: toward the model that encodes the rules.
Why the center is the right home
Onion Architecture, introduced by Jeffrey Palermo in a 2008 blog series, organizes code as concentric layers around a domain model. The defining rule is the dependency inversion principle applied at the architectural scale: inner layers define interfaces; outer layers implement them. The center is the most stable part of the system—the part that would still make sense if you replaced the database, the web framework, or the payment provider. Business rules are exactly that kind of knowledge: they change for business reasons, not for technological ones. Putting them in the center protects them from churn in the periphery.
A concrete illustration. A subscription service has a rule: a customer may not have more than one active trial per product. That is domain knowledge. It is not SQL, not an HTTP concern, and not specific to Stripe or any other payment gateway. If that rule lives in a controller or a repository, it will be duplicated the moment a second entry point (a scheduled job, a message consumer, an admin tool) needs to enforce it. If it lives in a domain entity or a domain service, every entry point gets it for free, and no test of it needs a database.
The directional rule also makes testing honest. Domain logic at the center can be unit-tested with plain in-memory objects. If a rule can only be tested by spinning up a database and a web server, that is a signal the rule has drifted outward.
The important ambiguity: domain logic versus application logic
Many explanations of Onion collapse "business logic" into a single ring, then disagree about what belongs in it. The useful distinction:
Domain logic is the invariant-preserving rule set of the business: pricing calculations, eligibility rules, state transitions on an aggregate, validation that is intrinsic to the concept (an order cannot ship before payment clears). This belongs in entities, value objects, and domain services—pure, framework-free code. Application logic is use-case orchestration: "register a user" means load the account, check the trial rule, call the payment port, persist, publish an event, commit. It contains no business rule of its own; it sequences domain operations and coordinates transactions and ports.
In strict Onion, application services sit in the ring just outside the domain model, still inside the infrastructure boundary, still depending only inward. In looser readings, they are folded into "the domain layer" as the innermost application core. Either placement is defensible; the mistake is the opposite one—putting orchestration in controllers or repository implementations, where it becomes untestable and invisible.
A quick test for where a piece of logic goes: If the business changed its policy tomorrow, would this code change? If yes, it is domain logic and belongs at the center. If only the delivery mechanism changed—REST to gRPC, one database to another—would this code change? If yes, it belongs in an outer ring.
What must not be in the domain center
The center must stay free of infrastructure. That means no ORM attributes or base classes tying entities to a specific persistence framework, no HTTP request/response types, no SQL, no direct calls to email or payment SDKs. This is easier said than done: many ORMs encourage entity classes annotated for mapping, and it is common, pragmatic practice to let persistence-mapped entities double as domain entities. That is a real trade-off, not a violation of physics. The cost is that the domain model is now coupled to the ORM's lifecycle (lazy loading, proxies, tracked changes), which can leak into tests and behavior. The purist alternative—separate persistence models mapped to domain objects—adds mapping code. Both are used in production; Onion itself does not settle the question, and honesty about the trade-off matters more than dogma.
What Onion does settle is the interface placement. If the domain needs to check whether an email is already registered, it should depend on an abstraction it owns—say, an AccountExistenceChecker interface declared in the inner layer—and let an outer adapter implement it against the database. The dependency points inward; the implementation points outward.
Outer rings and the ports-and-adapters overlap
Onion Architecture is closely related to Hexagonal Architecture (ports and adapters) and to Clean Architecture. They share the dependency rule and the idea of a domain core. Onion's distinctive visual is the concentric rings; Hexagonal's is the boundary around the application with ports on the edge. In practice, teams often describe the same codebase with either vocabulary. The practical consequence for the question is the same in all three: business logic at the core, adapters at the edge, interfaces owned by the core.
Typical outer-ring responsibilities that are not business logic: controllers and presenters, repository and gateway implementations, message-broker adapters, scheduled-job triggers, configuration wiring, and transaction management glue (though transaction boundaries are often declared in application services, with the actual mechanism supplied by infrastructure).
Where Onion stops applying
Onion is a poor fit when there is no meaningful domain—a thin CRUD service over a single table, a data-transformation pipeline, or a prototype. Forcing rings onto such code produces ceremony without payoff. It also stops applying as guidance when the "business logic" is genuinely statistical or computational and lives naturally in a separate numerical service; that service can have its own internal structure, and Onion describes how it is wired to the rest, not how its math is organized.
Two further boundaries. First, Onion says nothing about how to model the domain—aggregates, bounded contexts, and invariants come from Domain-Driven Design, which composes well with Onion but is a separate body of practice. Second, Onion is not a deployment pattern; all rings may run in one process, and the layering is about source dependencies and testability, not about microservices.
Common confusions, briefly
A frequent error is reading "dependencies point inward" as "inner layers may not call outer layers at all." They may—through interfaces the inner layer defines and the outer layer implements (dependency injection at composition time). Another is treating the application layer as infrastructure because it touches repositories; it touches them only as abstract ports. And a subtler confusion: "business logic" is sometimes used to mean any code specific to the application rather than to the framework—by that definition even serialization choices are "business logic," which drains the term of usefulness. The Onion-relevant meaning is the one tied to business invariants and use-case rules.
For teams deciding where a given function lives, the reliable heuristic is the change-reason test combined with the dependency test: put code where its reasons to change align with the layer's reasons to change, and keep every arrow in the source graph pointing toward the rules.