Programming Phoenix

Book description

Don't accept the compromise between fast and beautiful: you can have it all. Phoenix creator Chris McCord, Elixir creator Jose 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.

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.

Publisher resources

View/Submit Errata

Table of contents

  1.  Acknowledgments
    1. José Valim
    2. Bruce Tate
    3. Chris McCord
  2. 1. Introducing Phoenix
    1. Fast
    2. Concurrent
    3. Beautiful Code
    4. Interactive
    5. Reliable
    6. Is This Book for You?
    7. Online Resources
  3. Part I. Building with Functional MVC
    1. 2. The Lay of the Land
      1. Simple Functions
      2. Installing Your Development Environment
      3. Creating a Throwaway Project
      4. Building a Feature
      5. Going Deeper: The Request Pipeline
      6. Wrapping Up
    2. 3. Controllers, Views, and Templates
      1. The Controller
      2. Creating Some Users
      3. Building a Controller
      4. Coding Views
      5. Using Helpers
      6. Showing a User
      7. Wrapping Up
    3. 4. Ecto and Changesets
      1. Understanding Ecto
      2. Defining the User Schema and Migration
      3. Using the Repository to Add Data
      4. Building Forms
      5. Creating Resources
      6. Wrapping Up
    4. 5. Authenticating Users
      1. Preparing for Authentication
      2. Managing Registration Changesets
      3. Creating Users
      4. The Anatomy of a Plug
      5. Writing an Authentication Plug
      6. Implementing Login and Logout
      7. Presenting User Account Links
      8. Wrapping Up
    5. 6. Generators and Relationships
      1. Using Generators
      2. Building Relationships
      3. Managing Related Data
      4. Wrapping Up
    6. 7. Ecto Queries and Constraints
      1. Adding Categories
      2. Diving Deeper into Ecto Queries
      3. Constraints
      4. Wrapping Up
    7. 8. Testing MVC
      1. Understanding ExUnit
      2. Using Mix to Run Phoenix Tests
      3. Integration Tests
      4. Unit-Testing Plugs
      5. Testing Views and Templates
      6. Splitting Side Effects in Model Tests
      7. Wrapping Up
  4. Part II. Writing Interactive and Maintainable Applications
    1. 9. Watching Videos
      1. Watching Videos
      2. Adding JavaScript
      3. Creating Slugs
      4. Wrapping Up
    2. 10. Using Channels
      1. The Channel
      2. Phoenix Clients with ES6
      3. Preparing Our Server for the Channel
      4. Creating the Channel
      5. Sending and Receiving Events
      6. Socket Authentication
      7. Persisting Annotations
      8. Handling Disconnects
      9. Wrapping Up
    3. 11. OTP
      1. Managing State with Processes
      2. Building GenServers for OTP
      3. Supervision Strategies
      4. Designing an Information System with OTP
      5. Building the Wolfram Info System
      6. Wrapping Up
    4. 12. Observer and Umbrellas
      1. Introspecting with Observer
      2. Using Umbrellas
      3. Wrapping Up
    5. 13. Testing Channels and OTP
      1. Testing the Information System
      2. Isolating Wolfram
      3. Adding Tests to Channels
      4. Authenticating a Test Socket
      5. Communicating with a Test Channel
      6. Wrapping Up
    6. 14. What’s Next?
      1. Other Interesting Features
      2. What’s Coming Next
      3. Good Luck

Product information

  • Title: Programming Phoenix
  • Author(s): Chris McCord, Bruce Tate, Jose Valim
  • Release date: April 2016
  • Publisher(s): Pragmatic Bookshelf
  • ISBN: 9781680504361