small medium large xlarge

Designing Elixir Systems with OTP: Write Highly Scalable, Self-Healing Software with Layers


Cover image for Designing Elixir Systems with OTP

Designing Elixir Systems with OTP

Write Highly Scalable, Self-Healing Software with Layers


You know how to code in Elixir; now learn to think in it. Learn to design libraries with intelligent layers that shape the right data structures, flow from one function into the next, and present the right APIs. Embrace the same OTP that’s kept our telephone systems reliable and fast for over 30 years. Move beyond understanding the OTP functions to knowing what’s happening under the hood, and why that matters. Using that knowledge, instinctively know how to design systems that deliver fast and resilient services to your users, all with an Elixir focus.

Customer Reviews

This book has a pragmatic approach that (correctly) prioritizes what you need to
do over what the frameworks do.

- Dave Thomas

Author of "Programming Elixir 1.6"

James and Bruce have a way of teaching that distills ideas into easily understandable
chunks. Designing Elixir Systems with OTP brings their reliable teaching
techniques to print. You will walk away with a solid foundation of functional
programming design principles and a wheelhouse of simple techniques to help
you along your journey.

- Amos King

CEO, Binary Noggin

This isn’t a textbook or a reference. It’s a mentorship. It doesn’t teach you how to
do something. It teaches you how to think about all the things you do in Elixir.

- Adrian P. Dunston

Senior Software Engineer,, Papa, Inc.

This is the book I wish I’d had after getting comfortable with Elixir syntax but was
struggling to learn crucial core OTP concepts that make it so powerful. The book
uses a great coding example to see each of these concepts in use and would have
been invaluable to me while fumbling through learning them on my own. 10/10,
would recommend.

- Jon Carstens

Embedded Systems Engineer, SmartRent

A straightforward guide on how to design OTP applications. This book shows some
of the best techniques behind popular Elixir projects. A great read for anyone
working with Elixir.

- Pedro Medeiros

Senior Software Developer, Shopify

An invaluable book for Elixir developers wishing to leverage framework/libraryagnostic
techniques to craft robust, complex, functional systems that are layered
and unit testable. Packed with indispensable tips from the trenches, including
techniques to integrate with persistence libraries like Ecto, web frameworks like
Phoenix, and newer UI frameworks like Scenic.

- Eoghan O’Donnell

Software Engineer

See All Reviews

Choose Your Format(s)

  • $21.95 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

What You Need

Elixir Version 1.7 or greater.

Contents & Extracts

  • Introduction
    • Build Your Project in Layers excerpt
      • We Must Reimagine Design Choices
      • Choose Your Layers
      • Begin with the Right Data Types
      • Build Your Functional Core
      • Establish Your Boundaries
      • Test Your Code
      • Plan Your Lifecycle
      • Invoke your Workers
  • Do Fun Things…
    • Know Your Elixir Datatypes
      • Primitive Types
      • Lists
      • Maps and Structs
      • Strings
      • Tuples
      • Functions as Data
      • When to Leave Elixir
      • Know Your Elixir Datatypes
    • Start with the Right Data Layer
      • Access Patterns Shape Data Structures
      • Immutability Drives Everything
      • Try It Out
      • Start with the Right Data
    • Build a Functional Core
      • Organize Core Functions by Purpose
      • Compose a Quiz from Functions
      • Build at a Single Level of Abstraction
      • Keep the Left Margin Skinny
      • Try Out the Core
      • Build Your Functional Core
    • Test Your Core
      • Simplify Tests with Common Setup Functions
      • Improve the ExUnit Infrastructure
      • Provide Test Data with Fixtures
      • Prime Tests with Named Setups
      • Make Tests Repeatable
      • Compose Within Tests
      • Take Tests Beyond the Elixir Base
      • Test Your Functional Core
  • …with Big, Loud Worker-Bees
    • Isolate Process Machinery in a Boundary
      • Maintain Composition Through Uncertainty
      • Build Your Optional Server
      • Wrap the Server in an API
      • Prefer Call Over Cast to Provide Back Pressure excerpt
      • Extend Your APIs Safely
      • Wrap Your Core in a Boundary API
    • Customize Your Lifecycle
      • Understand the Lifecycle Building Blocks
      • Configure Applications to Start Supervisors
      • Start Per-User Processes with a Dynamic Supervisor
      • Touch Up the API Layer
      • Manage Your Lifecycles with Supervisors
    • Summon Your Workers
      • Know Your Motivations
      • Know Your Tools
      • Add a Proctor to Run Timed Quizzes
      • Summon Your Workers
    • Assemble Your Components
      • Add Persistence as a Boundary Service
      • Integrate MasteryPersistence into Mastery
      • Integrate Your OTP Dependencies into Phoenix
      • Organize Code for OTP Abstractions
      • Build Scenic Projects with Layers
      • Assemble Your Components
    • Test the Boundary
      • Tests Call the API as a User Would
      • Isolate the Proctor’s Boundary Concerns
      • Test Your Boundary


James Edward Gray, II has been a full time programmer for over 15 years. He has worked with Ruby, Elixir, Elm, and more to tackle challenges in Market Research, Education, Medicine, Finance, and other interesting domains. James is inspired by the sharing of knowledge in the programming communities by contributing documentation, code, and books.

Bruce Tate is a programmer and CEO of Groxio where he is helping to redefine how computer languages are taught and learned. He’s the author of Seven Languages in Seven Weeks and Programming Phoenix among other titles and has been involved with Elixir from the very beginning.