Skip to main content
InterviewHubPRO
Section Overview
Q13

Question 13 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

26%
Domain-Driven Design (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is the difference between Domain Services, Application Services, and Infrastructure Services?

senior LevelCode ExampleSystem Design

In Simple Words: Three distinct service layers in DDD architectures:

  1. Domain Service: Pure business logic that spans multiple aggregates (e.g. PricingEngineService). Zero dependencies on databases, UI, or frameworks.
  2. Application Service: Orchestration layer (Use Cases). Coordinates domain objects, loads aggregates from repositories, manages transactions, and sends notifications (e.g. CreateOrderCommandHandler). Contains zero domain business rules.
  3. Infrastructure Service: Concrete technical adapters for external concerns (e.g. SmtpEmailSender, PostgreSqlOrderRepository, S3FileUploader).
text
DDD Service Layers:
[Application Service (Use Case)] ──► Loads Aggregate from [Repository]
               │
               ▼
[Domain Model / Domain Service]  ──► Executes Pure Business Invariants
               │
               ▼
[Infrastructure Service]         ──► Writes to DB / Sends Email / Kafka