BlogHome

Zero To Production in Rust book review

2023-01-22

I recently had the opportunity to read Zero to Production, a comprehensive guide to building and deploying Rust backend applications. The book, written by a senior AWS engineer Luca Palmieri, is a must-read for any aspiring Rust developer looking to take their skills to the next level.

Throughout the book, Luca provides a step-by-step walkthrough of the entire backend and API development process, from ideation to deployment. He builds a fully functional email newsletter application with an API front-end that allows users to subscribe to the newsletter, and newsletter authors to send an email to all subscribers. He covers a wide range of topics, including choosing the right technology stack (like database, web framework etc.), setting up a development and continuous deployment environment, and deploying to a cloud service like Digital Ocean.

It took me just over 2 months to finish the book and by the end of it I had a fully functional email newsletter API.

  1. The book is aimed at seasoned backend developers and practictioners. By the end of the book, you would have built an email newsletter application with an API front end, talking to a Postgres database, including a basic but robust implementation of user authentication, complete with unit and integration tests.
  2. It shows you how to setup Continuous Integration and Deployment pipeline with Docker.
  3. It describes in detail how to host and deploy your application to Digital ocean.
  4. I started with zero knowledge of Actix-web framework and was a little intimidated by it initially, but by the end of the book I felt like I can now build my own app using Actix-web.
  5. The book emphasizes and prioritizes TDD with both unit and integration tests. We start with writing a failing unit or integration test and then work our way towards making it pass. We also learn on how to write integration tests for API endpoints with test isolation.
  6. It provides a comprehensive overview of how to make an API endpoint secure. The section covers Basic Authentication, password verification and storage, password reset, cookies, Session-based authentication, and building an Admin dashboard. I think most of us understand these concepts in abstract terms but implementing it from scratch helps you assimilate that knowledge. IMO it's worth buying the book for this chapter alone.
  7. Idempotency - How do you make your API retry-safe if the caller is unable to observe if a request was sent to server once or multiple times? This is a fairly complex but incredibly useful thing to know if you want to build fault-tolerant APIs.
  8. Error handling is an important topic in any programming language and more so in a systems programming language like Rust which (thankfully) does not support the concept of null. You will get plenty of opportunities to learn how to handle, convert, and/or propogate your errors as you build your app. It also covers error-handling crates like thiserror and anyhow.
  9. Telemetry - is all about building observability into your program to understand and debug an "unknown unknown" issue in your program. Whilst unit/integration testing and error handling is great for tackling known and "known unknown" issues in your program, telemetry is great for building an observable application. There is an entire chapter dedicated to this topic starting with basic logging to tracing.
  10. Few other things I learned along the way:
  • Even a moderately complex app requires a great many crates
  • Best practices around building a user facing API
  • How to write idiomatic Rust
  • If you are stuck, you can join the Discord channel run by the author to ask for help or advice

One of the things I appreciated most about 'Zero to Production' was the author's emphasis on practical, real-world advice. He provides clear, actionable steps for achieving specific goals. In addition to being a valuable resource for developers, its also an enjoyable read. The writing style is clear and engaging, and is sprinkled with personal anecdotes and light humour to keep things interesting.

CONCLUSION

This is not a book to learn the basics of Rust language(YMMV) but it is a useful resource for you to transition from theory to practice. Once you've mastered the basics of the language elsewhere, Zero To Production is a fantastic reference to become proficient in backend development. If you like learning by doing then I'd highly recommend giving the book a try.


This work is licensed under CC BY-NC-SA 4.0.