Phoenix In Action (Manning)

Greetings! I want to share how much I like one of the concepts in the book Phoenix in Action, which is assuming from the beginning that your app might be used in multiple ways in the future.
Before I switched to Elixir, I was writing PHP application. In most cases, I would assume I am building a web app and most of the business logic are written in the controller. At some points, I decouple the business logic to the service layer to increase the flexibility of the application.
However, in the book, it teaches to start by writing app logic as Elixir application. Then, bring the Elixir app into the Phoenix app.
An example architecture:

  • project_root/apps/your_app - elixir app (app logic)
  • project_root/apps/your_app_web - web app

With this architecture, you can have many entry points to the app logic, e.g. API, embedded device. For example, if you are going to support the mobile app with API, you can add project_root/apps/your_app_api and the app logic is sharing between web and API.
Happy learning!

This was originally posted at https://forum.elixirforum.com/t/phoenix-in-action-book-club/20456/3?u=co0lsky

1 Like