Phoenix in Action
Geoffrey Lessel
  • MEAP began November 2017
  • Publication in February 2019 (estimated)
  • ISBN 9781617295041
  • 350 pages (estimated)
  • printed in black & white

This book gives an excellent step by step introduction to Phoenix.

Samuel Bosch
Phoenix is a modern web framework built for the Elixir programming language. Elegant, fault-tolerant, and performant, Phoenix is as easy to use as Rails and as rock-solid as Elixir's Erlang-based foundation. Phoenix in Action builds on your existing web dev skills, teaching you the unique benefits of Phoenix along with just enough Elixir to get the job done.
Table of Contents detailed table of contents

Part 1: An introduction

1. Ride the Phoenix

1.1. Along Comes Phoenix

1.1.1. What is Phoenix?

1.2. Elixir And Phoenix Versus the Alternatives

1.2.1. Real-time Communication

1.2.2. Background Computation

1.2.3. Low Hardware Requirements / Low-cost Scaling

1.2.4. It’s Not All Roses

1.3. The Power of Elixir

1.3.1. Scalability

1.3.2. Supervision trees

1.3.3. Erlang VM

1.3.4. Macro and metaprogramming support

1.3.5. OTP

1.4. Functional vs OO Programming

1.4.1. Overview of Functional Programming

1.5. Summary

2. Intro to Elixir

2.1. The Basics

2.1.1. Basic Types

2.1.2. A Small Detour Into Functions

2.1.3. Data Type Details

2.1.4. Back to Modules and Named Functions

2.2. Other Idiomatic Elixir Language Features

2.2.1. The Pipe Operator

2.2.2. Pattern Matching

2.2.3. Using IEx.Helpers.v/1

2.3. Going Deeper

2.3.1. On the Web

2.3.2. Books

2.3.3. Community

2.4. Summary

3. A Little Phoenix Overview

3.1. Follow the Data

3.1.1. The Basics of a Web Request

3.1.2. Endpoint

3.1.3. Router

3.1.4. Controller

3.1.5. Views

3.1.6. Templates

3.2. Putting It All Together

3.3. Summary

Part 2: The Basics

4. Phoenix is Not Your Application�Just a Boundary

4.1. I thought this book was about Phoenix

4.1.1. Defining an Item

4.1.2. Adding a fake database

4.1.3. Getting an Item by id

4.1.4. Getting an Item by other information

4.2. We Stop at Item retrieval

4.3. Summary

5. Elixir Application Structure

5.1. Moving From A Single File to an Application

5.1.1. Using mix to create a new application

5.1.2. Generating our Auction umbrella application

5.2. Organizing, Compiling, And Running Our New Application

5.2.1. Breaking Apart the Three Modules

5.2.2. Compile and run!

5.3. Using hex To Get External Dependencies

5.3.1. Pulling in our dependencies

5.4. Summary

6. Bring in Phoenix

6.1. Installing Phoenix On Your System

6.2. Creating A New Phoenix Application

6.2.1. Running our server for the first time

6.3. Listing Items From Our Fake Repo

6.3.1. Modifying the Controller and Template

6.4. Summary

7. Being Persistent with a Database

7.1. FakeRepo Isn’t Going To Last Long

7.2. A Quick Intro To Ecto

7.3. Configuring Ecto

7.3.1. Using Ecto’s mix Tools to Set Up Your Database

7.4. Preparing Auction To Use The Database

7.4.1. Defining our Auction.Item schema

7.4.2. Migrating our database

7.4.3. Pointing our API to the new Repo

7.4.4. Instructing the Application To Supervise the Database Connection

7.4.5. Did it work? Let’s test it out!

7.5. Creating, Retrieving, and Deleting Data From the Database

7.5.1. Inserting data

7.5.2. Retrieving data

7.5.3. Deleting data

7.5.4. Updating data

7.5.5. What about the web site?

7.6. Summary

8. Making Changes with Ecto.Changeset

8.1. Can’t I Just…​? Update?

8.1.1. A brief intro to Changesets

8.1.2. Creating a Changeset for Auction.Item

8.2. Now You Can…​? Update!

8.2.1. Adjusting the API for updating

8.3. Summary

9. Transforming Data In Your Browser

9.1. Handling New Routes In Our Application

9.1.1. Adding A New Route

9.1.2. Adding a new controller

9.1.3. Adding a new view

9.1.4. Adding a new template

9.2. Viewing The Details Of A Single Item

9.2.1. Defining the show route and function

9.2.2. Defining the show.html template

9.2.3. Linking to individual items

9.3. Creating Items Through Web Forms

9.3.1. Defining the new and create routes

9.3.2. Defining the new controller function

9.3.3. Defining the new template

9.3.4. Defining the create controller function

9.4. Editing Items Through Web Forms

9.4.1. Defining the edit and update routes

9.4.2. Defining the edit controller function

9.4.3. Defining the edit.html.eex template

9.4.4. Defining AuctionWeb.ItemController.update/2

9.5. Summary

10. Plugs, Assigns, and Dealing With Session Data

10.1. User Registration

10.1.1. Defining the Auction.User schema

10.1.2. Creating a migration to create the users table

10.1.3. Defining changesets for Auction.User

10.1.4. Creating API functions in Auction

10.2. User Registration

10.3. Handling User Login and Sessions

10.3.1. Create the route, controller, view, and templates for handling logins and logouts

10.3.2. Implementing the dirty details of sessions and authentication

10.4. Plugs

10.5. Adding Site Navigation

10.5.1. Implementing the log out function

10.6. Restricting Users From Certain Pages

10.7. Summary

11. Accepting Auction Bids and Associating Records

Part 3: Getting Advanced

12. Building an API

13. Real-time updates with channels

14. Testing

About the Technology

Phoenix is a web framework for the Elixir language. Phoenix applications are blazingly fast, and as a developer you'll appreciate the attention to detail in the framework design that makes you super-productive almost immediately. In particular, Phoenix channels provide an easy way to set up and manage real-time communication. Phoenix runs on the battle-tested Erlang virtual machine, so your apps are guaranteed to be rock-solid.

About the book

Phoenix in Action is an example-based tutorial that teaches you how to use the Phoenix framework to build production-quality web apps. Following a running example of an online auction site, you'll design and build everything from the core components that drive the app to the real-time user interactions where Phoenix really shines. You'll handle business logic, database interactions, and app designs that take advantage of functional programming as you discover a better way to develop web applications. And if you're brand new to Elixir, don't worry! You'll find a Phoenix-oriented tour of the language, along with careful explanations, tips, and coding idioms scattered throughout the example code.

What's inside

  • A complete online auction example developed throughout
  • Database interactions with Ecto
  • Using Channels for real-time communication
  • Functional ideas in a web environment
  • An introduction to the Elixir programming language

About the reader

Written for web developers familiar with a framework like Rails or ASP.NET. No experience of Elixir or Phoenix required.

About the author

Geoffrey Lessel has been a web developer for over 15 years—first with PHP and Perl and now with Ruby on Rails and Phoenix. He has spoken at ElixirConf and blogs about Elixir and Ecto at geoffreylessel.com.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks

A really good book to learn about the Phoenix framework.

Anonymous reviewer

An incredible book that opens the doors to the world of functional programming.

Luis Miguel Cabezas Granado