Skip to content

Software Architecture · Editable reference architecture

Onion architecture diagram

An editable onion architecture diagram reference showing Web interface → Application service → Domain service and downstream dependencies. Infrastructure implements contracts owned by inner layers.

Open & Edit in DrawArc (Free, No Login Required)

Your changes stay in a separate draft on this browser. Download an editable project to keep a portable copy.

LinkedInTelegramReddit

Onion architecture diagram diagram: Web interface, Application service, Domain service, Domain model and their connections
Onion architecture diagram — follow the component relationships, then open the editor to adapt the design. View diagram image.

7 components · 6 connections · Open the editor to zoom, move nodes and edit source.

Architectural overview

Onion architecture diagram addresses the responsibilities and boundaries shown in this reference rather than prescribing an entire production deployment. The primary flow starts at Web interface and reaches Domain model through Application service, Domain service. Use this view to explain which component initiates work, which component owns a decision, and where a dependency can affect the caller. Infrastructure implements contracts owned by inner layers.

The diagram contains 7 distinct components and 6 directed relationships. A separate path connects Application service → Repository contract → Infrastructure adapter → Database. These arrows describe logical interactions; they do not establish authentication, network access, atomic transactions or delivery guarantees. Label the actual protocol, payload contract and owner when adapting the drawing to your system. Keep synchronous and asynchronous boundaries explicit so that a reviewer can identify where a request ends and a later operation begins.

Before implementing this architecture, define expected load, data classification, latency budgets and recovery objectives. Give Web interface a bounded dependency timeout and a documented failure response. For Database, specify ownership, retention, access control and a tested recovery procedure. Validate the decision above against your workload instead of treating the presence of a component as proof of reliability. Open the editable canvas, replace generic labels with real deployment units, and document the decisions that differ from this reference.

The real-world problem

Design or explain onion architecture diagram with explicit ownership and dependency paths. Infrastructure implements contracts owned by inner layers.

Data flow

Connections from this diagram. Branches and control signals are not a single chronological sequence.

  • Web interface → Application service. Define the interaction contract and trace the resulting response or state change.
  • Application service → Domain service. Define the interaction contract and trace the resulting response or state change.
  • Domain service → Domain model. Define the interaction contract and trace the resulting response or state change.
  • Application service → Repository contract. Define the interaction contract and trace the resulting response or state change.
  • Repository contract → Infrastructure adapter. Define the interaction contract and trace the resulting response or state change.
  • Infrastructure adapter → Database. Define the interaction contract and trace the resulting response or state change.

Security boundaries

  • Authenticate callers at the boundary before Application service accepts protected work; authorize the specific operation rather than trusting network placement.
  • Use separate service identities and least-privilege permissions for Application service, Domain service, Domain model. Encrypt sensitive traffic, protect credentials and avoid placing confidential payloads in logs.
  • Restrict and audit access to Database; define retention and deletion requirements for the actual data.

Failure handling

Web interface is unavailable or slow

Response: Apply bounded timeouts and controlled backoff only where retrying is safe. Return an explicit failure or durable acceptance; do not report success before required work is committed.

Verify: Interrupt Web interface in an isolated test and measure errors, recovery and any repeated side effects.

Database loses or returns stale state

Response: Use workload-specific durability, reconciliation and tested recovery. Specify how stale reads or a failed write affect callers.

Verify: Exercise the failure path with representative records and verify both the visible response and the resulting state.

An invalid or incompatible input reaches Application service

Response: Validate the input contract before effects are committed. Preserve rejected input identifiers without exposing secrets, and document a safe replay or correction procedure.

Verify: Send malformed and older-version inputs through Web interface and verify rejection, observability and unchanged valid state.

Trade-offs and alternatives

Infrastructure implements contracts owned by inner layers.

Benefit
Makes the ownership and interaction boundaries visible for a focused design review.
Cost
The 7 illustrated components still require contracts, monitoring and operational ownership; extra boundaries can add latency and failure modes.
Alternative
Use a simpler deployment when it meets the same requirements, or split a boundary only after measuring a specific need.

Logical boundaries versus deployment units in Onion architecture diagram

Benefit
Keeps the responsibilities of Web interface, Application service, Domain service visible without requiring a separate server for each box.
Cost
A logical view does not establish isolation, independent scaling or high availability; those require a separate deployment design and operational tests.
Alternative
Co-locate components in a simpler deployment first when ownership and workload requirements permit it.

When to use this architecture

  • Explain onion architecture diagram to engineers or stakeholders using a concrete visual flow.
  • Review this decision before deployment: Infrastructure implements contracts owned by inner layers.
  • Adapt a starting diagram for your own requirements, then record and validate every changed boundary.

Key components

Web interface
Web interface participates in onion architecture diagram. Web interface → Application service. Define its contract, owner and access permissions in your implementation.
Application service
Application service participates in onion architecture diagram. Web interface → Application service; Application service → Domain service; Application service → Repository contract. Define its contract, owner and access permissions in your implementation.
Domain service
Domain service participates in onion architecture diagram. Application service → Domain service; Domain service → Domain model. Define its contract, owner and access permissions in your implementation.
Domain model
Domain model participates in onion architecture diagram. Domain service → Domain model. Define its contract, owner and access permissions in your implementation.
Repository contract
Repository contract participates in onion architecture diagram. Application service → Repository contract; Repository contract → Infrastructure adapter. Define its contract, owner and access permissions in your implementation.
Infrastructure adapter
Infrastructure adapter participates in onion architecture diagram. Repository contract → Infrastructure adapter; Infrastructure adapter → Database. Define its contract, owner and access permissions in your implementation.
Database
Database participates in onion architecture diagram. Infrastructure adapter → Database. Define its contract, owner and access permissions in your implementation.

Questions about this template

What does this onion architecture diagram diagram show?

It shows 7 components with the core flow Web interface → Application service → Domain service → Domain model. Infrastructure implements contracts owned by inner layers.

Can I edit this diagram without signing in?

Yes. Open the template in the browser-local canvas to change nodes, connections and source. AI generation and cloud account storage require sign-in.

Is this a complete production implementation?

No. It is an editable reference. Validate the security controls, dependency behavior, capacity and recovery plan against your own requirements before implementation.

Validate your implementation

Use the relevant platform documentation to verify service limits, supported features and configuration. This diagram is an original reference rather than a reproduction of a provider deployment.