Jump to ratings and reviews
Rate this book

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

Rate this book

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.


Elixir and OTP provide exceptional tools to build rock-solid back-end applications that scale. In this book, you'll build a web application in a radically different way, with a back end that holds application state. You'll use persistent Phoenix Channel connections instead of HTTP's request-response, and create the full application in distinct, decoupled layers.


In Part 1, start by building the business logic as a separate application, without Phoenix. Model the application domain with Elixir functions and simple data structures. By keeping state in memory instead of a database, you can reduce latency and simplify your code. In Part 2, add in the GenServer Behaviour to make managing in-memory state a breeze. Create a supervision tree to boost fault tolerance while separating error handling from business logic.


Phoenix is a modern web framework you can layer on top of business logic while keeping the two completely decoupled. In Part 3, you'll do exactly that as you build a web interface with Phoenix. Bring in the application from Part 2 as a dependency to a new Phoenix project. Then use ultra-scalable Phoenix Channels to establish persistent connections between the stateful server and a stateful front-end client.


You're going to love this way of building web apps!


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.

354 pages, Kindle Edition

Published January 25, 2018

21 people are currently reading
190 people want to read

About the author

Lance Halvorsen

1 book2 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
33 (40%)
4 stars
32 (39%)
3 stars
13 (16%)
2 stars
3 (3%)
1 star
0 (0%)
Displaying 1 - 12 of 12 reviews
Profile Image for Sebastian Gebski.
1,187 reviews1,338 followers
Read
May 26, 2017
Not really finished enough at this point (Beta 2.0) for a star rating.

This is not really a book about web development. At this point 65-70% of the book is about functional domain modeling & ... frankly, this part is nice. It assumes prior Elixir competency, so you're not getting through all the basics & you jump straight into the problem domain, but ... my main problem was that the scenario that is implemented within the book (just 1 for whole book) is just way too
simple. Really, one would have to struggle a lot to break SRP here. I realize that the form of written book comes with certain limitations, but unfortunately oversimplification here keeps reminding you all the time that what you're dealing with is barely more complicated than a to-do app ;/

Web part (~30% of the book) is ultra-short & ends very "suddenly". It feels like it was written very hasty - it took more place to cover Presence theory than practical examples. Hopefully this part will get some more love soon. Another drawback of the web part is a bit odd - domain modelling part assumed being familiar with Elixir, so you had a feeling of immediate dive into interesting content, but web part doesn't assume the same about Phoenix, so it makes it a bit dull.\

In the end: it's hard to tell at this point - it may end up as a good book, but there's no guarantee. For sure there's space & need for such a book, but it may be just too simple to become truly useful. We'll see quite soon, I guess.
4 reviews1 follower
August 29, 2018
The example application doesn't quite feel finished and is not the best use-case for a websocket / bi-directional connection, but the book explains the concepts nicely and shows a clean functional approach to strictly separate the business logic from the website/interface.
Profile Image for Geoff Lanotte.
164 reviews6 followers
January 23, 2018
I have been teetering between 3 and 4 stars on this one.

The good - it presented how you could use phoenix in an OTP kind of a way.

What I felt could have been better - There were no real exercises, everything was handed to you. This is a fairly serious detractor for me as it did little to close the learning loop or help close the loop. The work was mostly tested in the console and the web console. While I sometimes will do this, it is terribly inefficient. In the forums, the author said that he decided to not do testing because the book was becoming about testing, but the book was about trying things and typing in the console, which isn't the best experience. The author could have showed how to just type the same things in a test file and not the console and would have been mostly home and would have shown a way to build.

To sum up, it is a reasonable entry-level book on OTP and coordinating that with Phoenix. I would recommend coupling this with other books and reading that present topics in more detail.
Profile Image for Joel Meador.
24 reviews
December 18, 2017
I want to like this more, but the book presents a lot of code to type in and then many chapters later that code pays off, but without context it's hard to remember all the decisions that were made before. This is the right book for that if you're going to work through it in an afternoon, but not if you're spreading things out over a week or more. A different style of iterative building than used, or any testing probably would have helped in that regard.

Another digression: there is a lot of JavaScript you need to plug into the browser by hand. Do yourself a favor and serve the helper bits of that via your phoenix server from the get-go or at least save it in a file so you can copy-paste. It was ridiculous the first time and the 4th time I was like "this is not how to do this"
Profile Image for Jeremy Carman.
65 reviews2 followers
July 9, 2018
Very useful book. He walks you through building up a game, and then interfacing to it via Phoenix channels. This book provided some interesting insights.

Pros: The author was always quick to show via iex, console, or browser what the implemented code did. It really helped me make the connection. I also like building this app from the ground up, and the authors explanation of why we used the tools we used.

Cons: The code zip/tar doesn't have a complete project to peruse, it just has pertinent files arranged by topic.
1 review
April 10, 2020
this book sux in its current form.

sure it starts out good and there's lots to learn about Elixir and OTP, but then it all turns to custard in the most unsatisfying way possible. typing functions into the js console? really? please change this part of the book to create an actual interface for the engine, one that readers can actually run instead of getting errors with require and then not being able to follow any of this part of the book. what a waste of time.
Profile Image for Andreas Altendorfer.
4 reviews6 followers
July 23, 2018
Very clear with complete example and code you can try immediately.
You should have little knowledge of Elixir/Phonix but it's definitely good for Elixir/Phoenix beginners. Although, you should have programming experience in other languages.
Profile Image for Chad.
2 reviews
July 10, 2020
Was slightly disappointed that “building a web app” was merely typing JS into a browser developer console, but otherwise thought the author did a great job describing a layered architecture of a functional core with OTP. Would recommend for new Elixir developers.
2 reviews
May 11, 2019
Really good book

Really liked this book, I recommend it to any elixir developer, the writer explain every action deeply and why he does that. Learn by example.
Profile Image for Héctor Iván Patricio Moreno.
426 reviews22 followers
December 25, 2018
I liked the approach the author took to building the app used as an example, I think it is truly revolutionary talking about how we build software in general, we're infected by frameworks and do not code for our use cases, we program for the framework instead.

Learning about this "fresh" perspective and how Elixir and Erlang allow us to achieve it was awesome.

I also learned a lot about Elixir, OTP, and Phoenix along the way. The only thing that I think could be better is building a more complex app, maybe in a sequel one with more complex and real-world use cases that show how to use and build something many clients would use.

I also felt the last chapters a bit too shallow and ended too quickly. But in general this a very good read for everyone wanting to upgrade his/her skills in coding and web development in general.
Displaying 1 - 12 of 12 reviews

Can't find what you're looking for?

Get help and learn more about the design.