Namespaces

DDD and Microservices Namespaces Naming Conventions

Building software systems using the microservices approach in combination with DDD allows you to reduce the overall complexity and simplify development by dividing the entire complex system into separate small subsystems, called bounded contexts in the DDD approach. To simplify the implementation of each subsystem as a separate microservice, it is proposed to use the namespace naming conventions in the application that implements the microservice in .NET.

Namespace Templates

System — software system short name
Context — bounded context name (subsystem)

Domain Layer

{System}.[Context].Domaindomain entities and value objects

Application Layer

{System}.[Context].Contractsservice and other interfaces and data contracts
{System}.[Context].Servicesservice implementations
{System}.[Context].UnitTestsentity and service unit tests

Infrastructure Layer

{System}.[Context].AdaptersImplapplication host which includes services, adapters and controllers
{System}.Host.ControllersAPI controllers
{System}.Hostapplication host which includes services, adapters, and controllers
{System}.Testsintegration and component tests

Adapter Suffixes

-Repository
-Adapter
-Gateway
-Provider
-Store
-Db