0Pricing
Erlang OTP: Distributed & Fault-Tolerant Systems Programming · Lesson

Building OTP Applications & Releases

Package your GenServers and supervisors into a proper OTP application and bundle it into a deployable release.

Building OTP Applications & Releases is a free Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Erlang OTP: Distributed & Fault-Tolerant Systems Programming learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Is an OTP Application?

An OTP application is a reusable component with a defined lifecycle: it starts, runs a supervision tree, and stops cleanly. It is the standard unit of packaging in Erlang.

The .app Resource File

Every application has an .app file describing its metadata: name, modules, dependencies, and the callback module that starts it.

{application, myapp,
 [{description, "My App"},
  {vsn, "1.0.0"},
  {modules, [myapp_app, myapp_sup]},
  {applications, [kernel, stdlib]},
  {mod, {myapp_app, []}}]}.

The application Behavior

The module named in mod implements the application behavior with start/2 and stop/1 callbacks.

-module(myapp_app).
-behaviour(application).
-export([start/2, stop/1]).

start/2

start/2 is called when the application launches. It starts the top supervisor and returns its pid.

start(_Type, _Args) ->
    myapp_sup:start_link().

stop/1

stop/1 is called on shutdown for cleanup. Often it simply returns ok.

stop(_State) ->
    ok.

Starting & Stopping

From the shell you can control applications at runtime.

application:start(myapp).
application:stop(myapp).

Application Environment

Configuration lives in the env section of the .app file and is read with application:get_env.

application:get_env(myapp, port).
% => {ok, 8080}

What Is a Release?

A release bundles your application, its dependencies, and a trimmed Erlang runtime into a single self-contained, deployable artifact.

Building with rebar3

The rebar3 build tool creates releases from a relx config in rebar.config.

{relx, [{release, {myapp, "1.0.0"}, [myapp]},
        {dev_mode, false},
        {include_erts, true}]}.

Running a Release

The generated release includes scripts to start, stop, and attach a console to the running node.

% rebar3 release
% _build/default/rel/myapp/bin/myapp foreground

Why Releases Matter

Releases give reproducible deployments: the exact runtime, app versions, and config travel together, and they support hot code upgrades, a hallmark of Erlang systems.

Quick Check

Test your OTP application knowledge.

Recap

You learned to package OTP code.

  • The .app file describes metadata and the start module
  • The application behavior provides start/2 and stop/1
  • Releases bundle app + runtime for reproducible deployment

Frequently asked questions

Is the “Building OTP Applications & Releases” lesson free?

Yes — the full text of “Building OTP Applications & Releases” is free to read here on the web, and the Erlang OTP: Distributed & Fault-Tolerant Systems Programming course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Erlang OTP: Distributed & Fault-Tolerant Systems Programming course, upgrade to CoddyKit PRO.

What will I learn in “Building OTP Applications & Releases”?

Package your GenServers and supervisors into a proper OTP application and bundle it into a deployable release. You practise Erlang OTP: Distributed & Fault-Tolerant Systems Programming with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Erlang OTP: Distributed & Fault-Tolerant Systems Programming?

No prior experience is required. Erlang OTP: Distributed & Fault-Tolerant Systems Programming on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Building OTP Applications & Releases” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson?

Yes. Every Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Understanding OTP & Behaviors
  2. Implementing GenServer Behavior
  3. Introduction to Supervisors
  4. Building OTP Applications & Releases
← Back to Erlang OTP: Distributed & Fault-Tolerant Systems Programming