Announcing my new side-project and second non-fiction, technical book: Phoenix Product Codex , a practical, hands-on tutorial on developign and deploying a production-grade REST API for Product Data Management with Elixir and Phoenix. After the ongoing success of Northwind Elixir Traders , here comes the early launch of its real-world kinda-sequel on Leanpub!
Though this book contains some exploratory learning like Northwind Elixir Traders before it, it assumes basic familiarity with Elixir and Ecto, but zero knowledge of the “main course”, which is Phoenix, for building REST APIs in particular. So, as Northwind Elixir Traders primarily targets building Ecto skills, Phoenix Product Codex follows a similar exploratory-learning recipe for building Phoenix skills. Once again, we use SQLite, but there’s absolutely nothing stopping you from transferring what we build to PostgreSQL.
As with Northwind Elixir Traders , we do not follow a completionist approach: this book is not meant to cover every single nook and cranny of Phoenix. Instead, we set an ambitious goal and some sub-goals (e.g., interfacing with an external service for Tax ID validation, refreshing external data with a GenServer, implementing rate limiting, authentication and authorization, caching and invalidating database query results), and gradually accomplish all that by using everything at our disposal that makes sense–including any Hex.pm packages required, such as Viex and Mox . Sometimes, we have to backtrack; however the rationale behind every decision is covered, to convey once again not merely the “happy path”, but to provide a rich understanding of both the business domain and the technical approach to the goal(s).
The chapters released so far cover:
- The business context and the goal
- Exploration of the database schema as it’s being shaped
- Domain-Driven Design and domain boundaries
- The conundrum of deciding on one taxonomy
- Modeling the first table (suppliers)
- Validating EU tax IDs with an external service (EU VIES)
- Implementing a validation plug with a helpful message, for mis-shaped JSON request bodies
- Implementing tests of the /api/suppliers endpoint with ExUnit
- Mocking the external service with Mox
Phoenix Product Codex is a real-world focused, business-driven sequel to its technologies-focused and toy-database-based kinda-prequel–which is still a great primer if you’re new to Elixir, Ecto or SQLite!
As with the previous book, I will continue updating this one every 2 to 3 weeks until it’s completed, targeting 100% by end of Q3.
For a full list of prospective topics that will be covered, check out the Leanpub page –also note that early adopters benefit from lower prices while the book is in development.