Search⌘ K

Establishing Our Boundaries

Explore building the boundary layer in Elixir projects by creating processes and APIs that handle state and side effects. Learn to implement message passing and recursion manually to understand the workings of GenServer, preparing you to use OTP effectively.

Boundary layer

The boundary layer deals with side effects and state. This layer is where we’ll deal with processes and where we’ll present our API to the outside world. In Elixir, that means OTP. To be more precise, the boundary layer provides the following functionality:

  • The machinery of processes, message passing, and recursion, which form the heart of concurrency in Elixir systems.

  • An API of simple functions that hide that machinery from clients.

Getting started

We typically call the collective machinery a server, the code that calls that server an API, and the code that calls that API a client. In OTP’s case, the server in that boundary layer is called a GenServer, an ...