Blueprint of Our Boundary Layer

Let's take a look at the structure of our boundary layer along with the OTP GenServers we'll be using in it.

Implementing the boundary layer

Recall our simple counter that wrapped a tiny core with processes and recursion to manage state. That wrapper is our service layer. We then took that ad hoc server and wrapped it in an API. This last layer exists as a convenience.

Structure of the boundary layer

We’re going to follow the same pattern here. Think about the boundary in two parts:

  • The service layer

  • The API layer

A boundary needs a service layer around each process type and an external API for clean, direct access across services. In Mastery, we’ll first need to decide what our GenServers are. We’ll need a service layer for each of two GenServers:

  • A quiz session where users can take a quiz.

  • A quiz manager where we’ll hold the state for individual quizzes.

Then we’ll put an API like this:

Get hands-on with 1200+ tech skills courses.