Skip to content

Repository files navigation

From Erlang to Elixir

From Erlang to Elixir — A Practitioner's Guide to the BEAM Ecosystem

A Practitioner's Guide to the BEAM Ecosystem

You already know the hardest part: BEAM + OTP. Elixir gives you more places to apply it.

This book is a step-by-step migration guide for Erlang/OTP developers who want to move into the Elixir ecosystem — Web (Phoenix/LiveView), Data (Ecto/Broadway), Edge (Nerves/AtomVM), and AI (Nx/Axon/Bumblebee) — without abandoning anything they already know.


The Central Idea

Erlang/OTP provides the foundation. Elixir builds on it. The ecosystem expands into three major domains, each with flagship libraries:

flowchart TD
    OTP["Erlang / OTP"] --> EX["Elixir"]
    EX --> WEB["Web"]
    EX --> EDGE["Edge"]
    EX --> AI["AI"]
    WEB --> PHX["Phoenix<br/>LiveView"]
    EDGE --> NERVES["Nerves<br/>AtomVM"]
    AI --> NX["Nx<br/>EXLA / EMLX"]
    PHX --> P["Products"]
    NERVES --> P
    NX --> P
Loading

The arrow direction matters — knowledge flows down from Erlang/OTP through Elixir into products. You don't replace Erlang; you extend its reach.

Both languages compile to the same BEAM bytecode and use the same OTP libraries. The runtime — schedulers, GC, distribution — is identical. Only the syntax and tooling layer differ.


Table of Contents

Part I — Foundations: What Transfers

Ch Title What You'll Learn
01 You Already Know the Hard Part Mental model, what transfers, what doesn't
02 Syntax Translation Guide Modules, structs, pattern matching, full keyword map
03 Tooling: From rebar3 to Mix First project step-by-step, deps, tests, releases
04 Pipes, Enum & Stream Idiomatic data flow
05 Behaviours, Protocols & Structs Polymorphism in Elixir

Part II — Language Power-ups: What Elixir Adds

Ch Title What You'll Learn
06 Metaprogramming & DSLs Macros, AST, why Phoenix/Ecto feel native
07 Gradual Typing Set-theoretic types, mix compile diagnostics
08 The Compilation Model .ex → AST → macros → BEAM bytecode
09 Mix, Releases & Running OTP Apps Build pipeline, config timing, releases, hot upgrades

Part III — The Ecosystem Map

Ch Title What You'll Learn
10 Phoenix & LiveView OTP processes as web architecture
11 Ecto: The Data Layer Schemas, changesets, queries, migrations, sandbox testing
12 Ash: Declarative Domain Modeling Resources, actions, policies, swappable data layers
13 Data, Jobs & Pipelines Oban, Broadway/GenStage, Explorer
14 High-Level Process Frameworks Reactor sagas, Jido agents, the abstraction ladder
15 Livebook Interactive exploration of live systems
16 Edge, IoT & Mobile Nerves, AtomVM, Mob/Dala

Part IV — AI on the BEAM

Ch Title What You'll Learn
17 Nx Fundamentals Tensors, defn, autodiff
18 Backends: EXLA, EMLX & Hardware The what/how separation
19 Training Models with Axon MNIST end-to-end, CNNs, transfer learning
20 Bumblebee: Pre-trained Models Hugging Face in Elixir, zero Python
21 Production Inference: Nx.Serving Batched serving + the mnist_phoenix app

Part V — Practice & Direction

Ch Title What You'll Learn
22 LLM Integration & Agents Adapters, streaming, RAG, agent frameworks
23 Architecture Philosophy BEAM orchestrates; specialized runtimes compute
24 The Migration Roadmap 8-week step-by-step plan with checklists

Part VI — Under the Hood: Deep Dives

Ch Title What You'll Learn
25 Processes Deep Dive Spawn, mailboxes, links, monitors, exit signals
26 GenServer Under the Microscope The call protocol decoded, timeouts, terminate, debugging
27 Supervisors Deep Dive Child specs, strategies, restart budgets, shutdown order
28 Pattern Matching Deep Dive How = executes, pins, maps/structs, binary segments
29 OTP Wisdom Fail fast, isolation, matching as design, sagas/Reactor

How to Read This Book

Fast track (you want productivity this week): Ch 01 → 02 → 03 → 04 → 09 → 10 → 24.

Deep dive (you want the full ecosystem picture): Read straight through. Each chapter ends with a checkpoint.

Under the hood track (you want to know exactly how it works): Part VI — Ch 25 → 26 → 27 → 28 → 29. Self-contained deep dives; drop in whenever a mechanism surprises you, or read as a unit after Ch 14.

Hands-on track (learn by running things): Type and run every chapter's Step-by-step blocks as you read.


Prerequisites

  • Erlang/OTP 26+ minimum — new installs should use the latest stable line (OTP 28/29 as of writing); check Elixir's Compatibility and deprecations for the pairing
  • Elixir 1.15+, recommended 1.20+ for gradual typing (Ch 07; verified against 1.20.3)
  • Livebook for interactive exploration (Ch 15; several chapters run code in Livebook cells):
# macOS
brew install livebook

# Or via mix
mix escript.install hex livebook

# Start a server from the repo root
livebook server   # then open http://localhost:8080

Conventions Used

  • "From Erlang you know" boxes connect new material to existing knowledge.
  • Step-by-step blocks are meant to be typed/run as you read.
  • Checkpoint sections let you verify understanding before moving on.
  • Explore More sections point to the canonical docs and next exercises.
  • Code pairs show Erlang first, Elixir second, unless noted.

Built on the elixir_ecosystem_sharing collection of Livebooks and runnable examples. MIT licensed.

About

This is a guide for Erlang developers can go to Elixir ecosystem faster.

Topics

Resources

Stars

11 stars

Watchers

0 watching

Forks

Releases

Contributors