small medium large xlarge

Functional Web Development with Elixir, OTP, and Phoenix: Rethink the Modern Web App


Cover image for Functional Web Development with Elixir, OTP, and Phoenix

Functional Web Development with Elixir, OTP, and Phoenix

Rethink the Modern Web App


Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web applications. For decades OTP has helped developers create incredibly robust, scalable applications with unparalleled uptime. Make the most of them as you build a stateful web app with Elixir, OTP, and Phoenix. Model domain entities without an ORM or a database. Manage server state and keep your code clean with OTP Behaviours. Layer on a Phoenix web interface without coupling it to the business logic. Open doors to powerful new techniques that will get you thinking about web development in fundamentally new ways.

Customer Reviews

A must-have for new Elixir programmers ready to take on modern web development with the unique features of the platform. Lance gently guides readers through complex topics using fun, digestible examples. From OTP to proper Phoenix architecture, this book takes you step by step from the basics to building your own powerful, real-time applications.

- Chris McCord

Author of the Phoenix Framework

What makes this book important and unique is the fact that it focuses more on development practices and less on technology mechanics. I recommend this book to anyone who wants to build production systems with Elixir and Phoenix.

- Saša Juric

Software Developer, Aircloak

Every Elixir developer should buy and read Lance’s book. There are a lot of questions in the rapidly growing Elixir community about how to structure apps with Phoenix and OTP, and Lance provides compelling and thoughtful answers. The Islands app that the reader builds throughout the book isn’t simply an app to learn functional web development; it’s the blueprint for correctly building out almost any Elixir app.

- Ben Marx

Lead Engineer, Bleacher Report

For many people, their first experience with Elixir is in the context of Phoenix, and when they build their app it’s a “Phoenix app”—which is great! But eventually they hit a wall and want to learn more about OTP and Elixir. This is the book they should reach for, and the book I am sending to as many people as I can.

- Jason Stiebs

Partner, RokkinCat LLC

Functional Web Development with Elixir, OTP, and Phoenix teaches the radical design shift from traditional web development architecture to one that leverages stateful servers, persistent client connections, and a full embrace of the separation of concerns. If you’re interested in a modern web architecture that meets the demands of today and tomorrow, I highly recommend this book.

- Moxley Stratton

Elixir Software Engineer, Weedmaps

I’m an experienced developer, but new to Elixir; to get maximum benefit from a new language, I know it’s vital to learn to use its tools idiomatically. This book has shown me new ways to think about structuring my Elixir applications. It’s full of great examples and strategies for effective use of the tools provided by Erlang, Elixir, and Phoenix’s standard libraries: it’s got the “how,” but it’s driven by the “why.”

- Bryan Stearns

Senior Software Engineer and Consultant

Lance Halvorsen continues to show a knack for finding the practical steps hidden in complex problems. In this book, he tackles the future of functional web design with the simple idea that “Phoenix is not your application.” Expanding on that concept, he builds an essential guide for the next generation of Phoenix applications. This is an absolute must-read for all Elixir and Phoenix developers.

- Jesse J. Anderson

Front-End Developer, Planning Center

This book presents learning powerful OTP constructs wrapped up in the excitement of completing a game in Elixir and Phoenix end to end. By the time you come up for air, you’ve read most of the book and learned some very powerful skills to roll into your own projects.

- Erik Ketcham

Engineering Manager, Le Tote

I’ve been using Elixir and Phoenix for several years and still managed to learn a few new tips and tricks.

- Jeff Weiss

Software Engineer, Le Tote

See All Reviews

Choose Your Format(s)

  • $47.95 In Stock

    Save $14.95 on the combo pack.

  • $37.95 In Stock
  • $24.95 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

What You Need

You’ll need a computer that can run Elixir version 1.5 or higher and Phoenix 1.3 or higher. Some familiarity with Elixir and Phoenix is recommended.

Contents & Extracts

  • Define the Functional Core in Elixir
    • Model Data and Behavior
      • The Benefits
      • Let’s Build It
      • Discover the Entities and Model the Domain
      • Transforming Data
      • Putting the Pieces Together
      • Wrapping Up
    • Manage State with a State Machine
      • A Quick Look at State
      • A Bit of History
      • State Machines
      • A Functional State Machine for Islands
      • Working Through the States
      • Wrapping Up
  • Add OTP for Concurrency and Fault Tolerance
    • Wrap It Up in a GenServer
      • A Look at Micro-Services
      • OTP Solutions
      • Getting Started with GenServer excerpt
      • Initializing GenServer State
      • Customizing GenServer Behavior
      • Naming GenServer Processes
      • Wrapping Up
    • Process Supervision for Recovery
      • Fault Tolerance
      • Linking Processes
      • Introducing the Supervisor Behaviour
      • Supervision Strategies
      • The Child Specification
      • A Supervisor for the Game
      • Starting the Supervision Tree
      • Starting and Stopping Child Processes
      • Putting the Pieces Together
      • Recovering State After a Crash
      • Wrapping Up
  • Add a Web Interface with Phoenix
    • Generate a New Web Interface with Phoenix excerpt
      • Frameworks
      • Applications
      • Generate a New Phoenix Application
      • Adding a New Dependency
      • Call the Logic from the Interface
      • Wrapping Up
    • Create Persistent Connections with Phoenix Channels
      • The Beauty of Channels
      • The Pieces That Make a Channel
      • Let’s Build It
      • Establish a Client Connection
      • Converse Over a Channel
      • Connect the Channel to the Game
      • Phoenix Presence
      • Authorization
      • Wrapping Up


Lance Halvorsen is a member of the Phoenix core team, the author of the Phoenix Guides, and a senior software architect at Le Tote.