11 Working with components

 

This chapter covers

  • Creating OTP applications
  • Working with dependencies
  • Building a web server
  • Configuring applications

It’s time to turn our attention toward producing releasable systems that can be deployed and started simply. To reach that goal, you need to learn about OTP applications, which let you organize your system into reusable components. Applications are a standard way of building Elixir/Erlang production systems and libraries, and relying on them brings various benefits, such as dependency management, simplified system starting, and the ability to build standalone, deployable releases.

In this chapter, you’ll learn how to create applications and work with dependencies. In the process, you’ll turn your to-do system into a proper OTP application and use some third-party libraries from the Erlang and Elixir ecosystem to expose an HTTP interface for your existing system. There’s a lot of work ahead, so let’s get started with OTP applications.

11.1 OTP applications

11.1.1 Creating applications with the mix tool

11.1.2 The application behavior

11.1.3 Starting the application

11.1.4 Library applications

11.1.5 Creating a to-do application

11.1.6 The application folder structure

11.2 Working with dependencies

11.2.1 Adding a dependency

11.2.2 Adapting the pool

11.2.3 Visualizing the system

11.3 Building a web server

11.3.1 Choosing dependencies

11.3.2 Starting the server

11.3.3 Handling requests

11.3.4 Reasoning about the system

11.4 Configuring applications

11.4.1 Application environment

11.4.2 Varying configuration

11.4.3 Config script considerations

Summary