Programming Phoenix
Productive |> Reliable |> Fast
by Chris McCord, Bruce Tate, and Jos Valim
Version: P1.0 (April 2016)
Copyright 2016 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/frequently-asked-questions/ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/phoenix, the book's homepage.
Thanks for your continued support,
Dave Thomas and Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Jacquelyn Carter (editor) Potomac Indexing, LLC (indexer) Eileen Cohen (copyeditor) Gilson Graphics (layout) Janet Furlow (producer)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2016, The Pragmatic Bookshelf.
Early Praise for Programming Phoenix
Programming Phoenix is an excellent introduction to Phoenix. You are taken from the basics to a full-blown application that covers the MVC layers, real-time client-server communication, and fault-tolerant reliance on 3rd party services. All tested, and presented in a gradual and coherent way. Youll be amazed at what youll be able to build following this book.
Xavier Noria |
Rails Core Team |
I write Elixir for a living, and Programming Phoenix was exactly what I needed. It filled in the sticky details, like how to tie authentication into web applications and channels. It also showed me how to layer services with OTP. The experience of Chris and Jos makes all of the difference in the world.
Eric Meadows-Jnsson |
Elixir Core Team |
A valuable introduction to the Phoenix framework. Many small details and tips from the creators of the language and the framework, and a leader in using Phoenix in production.
Kosmas Chatzimichalis |
Software Engineer, Mach7x |
Programming Phoenix is mandatory reading for anyone looking to write web applications in Elixir. Every few pages I found myself putting the book down so I could immediately apply something Id learned in my existing Phoenix applications. More than merely teaching the mechanics of using the Phoenix framework, the authors have done a fantastic job imparting the underlying philosophy behind it.
Adam Kittelson |
Principal Software Engineer, Brightcove |
Acknowledgments
Most of this book is written in a collective voice, but acknowledgments are deep and personal things. For this chapter alone, well speak some as a team but also in each of our individual voices. Youll notice that Chris has more to say than the rest of us, and as the creator of Phoenix, its right and proper that he does so.
As a team, wed like to thank this production crew. Its been the finest any of us have ever worked with. Potomac Indexing, LLC handled our indexing, Eileen Cohen did our copyedit, and Janet Furlow managed the endless production details.
These contributions were invaluable, but wed also like to single a couple out for deeper praise. Jackie Carter, our longtime friend and editor, has as much to say about the quality of this book as any of the authors on this team. Your voice is constant, and your gentle encouragement pushed us at the right times and in the right ways. Also, Dave Thomas did the layout and cover for this book, but hes also served as a tireless advocate for Elixir and Phoenix and has shared many plates of Indian food with this team. Your friendship and guidance are always appreciated. We might not have had the opportunity to write this book without your tireless contributions. The next plate of Indian is on us. And we mean it.
Our reviewers worked hard to provide excellent feedback, even though the code serving as the foundation for this book was constantly shifting. Bryan Weber, Eric Meadows-Jnsson, Colby Blaisdel, Adam Guyot, Adam Kittelson, Jason Stiebs, Ian Warshak, Xavier Noria, George Guimaraes, Carlos Antonio da Silva, Bernardo Chaves, Ian Dees, Vince Foley, Brian Hogan, and Lauro Caetano all did various levels of reviews for us. Xavier Noria stands out for providing extraordinary service while going through broken examples and also providing excellent feedback for the concepts in this book. Thanks also to the beta readers who did great work for us.
Jos Valim
Elixir has been a labor of love and a project that has exceeded my wildest expectations. Elixir wouldnt exist without the support of my partners at Plataformatec. They were the first to believe Elixir could make a dent in the world, and their investments in the community have helped Elixir grow with strength and grace.