Domain Layer

Learn what the domain layer in hexagonal architecture is and how to implement it.

To comprehend how software may be implemented based on hexagonal architecture, let us review an example regarding a restaurant.

Example definition

This restaurant wants to allow a customer to order something by using its website. The website consumes Rest APIs to execute the business logic. Therefore it is necessary to implement a microservice that exposes the functionality to create an order. This use case has the following restriction:

  • If a customer has no created orders, it is possible to create a new one
  • If a customer has already created orders, it is not possible to create a new one

Model definition

The following diagram depicts the domain layer and what domain objects should be implemented to accomplish the business rules.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy