Understanding the Lifecycle Building Blocks

At the risk of sounding like a broken record, we’ll repeat that our project may never need to create its processes. Many projects are libraries, meaning they’ll never need to have their service layer. They don’t need start links or supervisors at all. In the terms we’ve discussed so far, these libraries will never use the “big, loud worker-bee” layers.

Handling processes using OTP

When our project does need processes, it will often use the OTP architecture. OTP might be overkill for some use cases, but most often, OTP lets our processes exist seamlessly with others that need the common lifecycle services we’ll discuss in the sections that follow. For example, a typical OTP architecture means that when we start Phoenix, it automatically starts our database pool if we need it with a few short lines of configuration.

Slices of the lifecycle layer

Let’s go one step deeper by defining the different slices of the lifecycle layer and what each one does. We’ll start with three main pieces for now. They are depicted in the figure below:

Get hands-on with 1200+ tech skills courses.