Fundamentals 9 min read

Designing a New Project with DDD: Architecture Evolution and Bounded Contexts

This article explains how to start a new project using Domain‑Driven Design, covering terminology, architecture evolution from monolith to microservices, bounded‑context definition, the four DDD boundaries, clean layered, hexagonal and onion architectures, and practical guidelines for effective system design.

IT Architects Alliance
IT Architects Alliance
IT Architects Alliance
Designing a New Project with DDD: Architecture Evolution and Bounded Contexts

1. Key Terminology

Defines common service models: IaaS (Infrastructure‑as‑a‑Service), PaaS (Platform‑as‑a‑Service), and SaaS (Software‑as‑a‑Service).

2. Architecture Evolution

The diagram shows three stages:

SaaS : Starts as a monolithic application where business logic is tightly coupled; later refactored using MVC, SSM, and layered approaches to decouple services.

PaaS : As business grows, a separate subsystem is needed; common technologies such as service mesh, SOA, and micro‑services are extracted to speed up subsystem creation.

IaaS : High‑traffic services require multiple servers across different OSes; virtualization, Docker, and Kubernetes abstract the underlying OS.

3. Bounded Context

A bounded context (BC) groups a cohesive domain model. For example, the "product" concept differs between the Order context (price, discount) and the Inventory context (stock, cost, location).

Technical implications: BCs must be aggregated at the application layer, which may require synchronous calls (e.g., Order → Inventory) or asynchronous messaging via middleware.

Guidelines for defining BCs:

Consider team size—too fine‑grained BCs increase operational overhead.

Assess semantic and functional cohesion, both business‑related and technical.

Question: Does one BC correspond to one microservice? A microservice is a deployable unit with its own technology stack, but a BC may map to multiple microservices or be combined depending on traffic and cohesion.

4. The Four DDD Boundaries

First Boundary : Define vision, goals, problem space, and identify core, generic, and supporting sub‑domains.

Second Boundary : The bounded context forms a physical process isolation layer within the solution space.

Third Boundary : Inside each BC, apply layered architecture (interface, domain, application, infrastructure) to achieve minimal coupling.

Fourth Boundary : Use aggregates in the domain layer to preserve model integrity.

5. Clean Layered Architecture

The clean architecture separates interfaces from implementations, keeping the domain layer independent of technical details. Domain logic resides in the domain layer, while infrastructure concerns (databases, external services) are injected via interfaces, enabling easy swapping and better testability.

6. Hexagonal Architecture

Passive adapters : Access external resources such as storage or third‑party services.

Active adapters : Handle input from UI, command line, or other user‑driven sources via controllers.

All interactions are expressed as ports and adapters, forming a polygon‑shaped diagram often called the "six‑sided" architecture.

7. Onion Architecture

Extends the hexagonal model by further separating the inner layers into application services, domain services, and the domain model itself.

Build applications around an independent domain model.

Define interfaces in the inner layer; outer layers implement them.

Dependencies point inward, but outer layers may also depend directly on inner layers when appropriate.

Application code can run without the infrastructure layer, improving portability.

8. Summary

Domain‑Driven Design, when applied through its four boundaries, provides a systematic way to decouple domains, support vertical and horizontal scaling, and lay a solid foundation for future extensions. Combining DDD with clean, hexagonal, and onion architectures yields a maintainable, testable, and technology‑agnostic system.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Clean ArchitectureHexagonal ArchitectureBounded Contextonion architecture
IT Architects Alliance
Written by

IT Architects Alliance

Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.