Don’t accept the compromise between fast and beautiful: you can have it all. Phoenix creator Chris McCord, Elixir creator José Valim, and award-winning author Bruce Tate walk you through building an application that’s fast and reliable. At every step, you’ll learn from the Phoenix creators not just what to do, but why. Packed with insider insights, this definitive guide will be your constant companion in your journey from Phoenix novice to expert, as you build the next generation of web applications.
Programming Phoenix: Productive |> Reliable |> Fast
by Chris McCord, Bruce Tate, and José Valim
About This Book
Phoenix is the long-awaited web framework based on Elixir, the highly concurrent language that combines a beautiful syntax with rich metaprogramming. The authors, who developed the earliest production Phoenix applications, will show you how to create code that’s easier to write, test, understand, and maintain.
The best way to learn Phoenix is to code, and you’ll get to attack some interesting problems. Start working with controllers, views, and templates within the first few pages. Build an in-memory repository, and then back it with an Ecto database layer. Learn to use change sets and constraints that keep readers informed and your database integrity intact. Craft your own interactive application based on the channels API for the real-time, high-performance applications that this ecosystem made famous. Write your own authentication components called plugs, and even learn to use the OTP layer for monitored, reliable services. Organize your code with umbrella projects so you can keep your applications modular and easy to maintain.
This is a book by developers and for developers, and we know how to help you ramp up quickly. Any book can tell you what to do. When you’ve finished this one, you’ll also know why to do it.
What You Need
To work through this book, you will need a computer capable of running Erlang 17 or better, Elixir 1.1, or better, Phoenix 1.0 or better, and Ecto 1.0 or better. A rudimentary knowledge of Elixir is also highly recommended.
Resources
Contents & Extracts
This book is currently in beta, so the contents and extracts will change as the book is developed.
- Building with Functional MVC
- The Lay of the Land
- Simple Functions
- Installing Your Development Environment
- Creating a Throwaway Project
- Building a Feature excerpt
- Going Deeper: The Request Pipeline
- Wrapping Up
- Controllers, Views and Templates
- The Controller
- Creating Some Users
- Building a Controller
- Coding Views
- Using Helpers
- Showing a User
- Wrapping Up
- Ecto and Changesets
- Understanding Ecto
- Defining the User Schema
- Using the Model to Add Data
- Building Forms
- Creating Resources
- Wrapping Up
- Authenticating Users
- Preparing for Authentication
- Managing Registration Changesets
- Creating Users
- The Anatomy of a Plug excerpt
- Writing an Authentication Plug
- Implementing Login and Logout
- Presenting User Account Links
- Wrapping Up
- Ecto Queries excerpt
- Exploring Ecto in the Console
- Mapping to Models
- Diving Deeper into the Query API
- Fragments
- Using Generators
- Wrapping Up
- Adding Relationships and Constraints
- Preparing Generated Code for Associations
- Adding Categories
- Constraints
- Wrapping Up
- The Lay of the Land
- Writing Interactive and Maintainable Applications
- Watching Videos
- Watching Videos
- Adding JavaScript
- Creating Slugs
- Wrapping Up
- Using Channels
- A Channels Overview
- The Transport Layer
- Joining Channels
- Channel Messages
- Annotating Videos
- Socket Authentication
- Persisting Annotations
- Mix and OTP
- Testing
- Watching Videos
Brought to You By
This is the team that drove the implementation of Elixir and Phoenix. Chris McCord, the creator of Phoenix, professionally trains new developers for the rising framework and works with teams adapting it. Bruce Tate, the author of many award-winning books and creator of the Seven Languages in Seven Weeks series, is the CTO for icanmakeitbetter.com, which is already running Phoenix in production. José Valim, the creator of Elixir and member of the Phoenix core team, is the co-founder and director of research and development at Plataformatec.