Behind the Scenes: Creating a New Phoenix LiveView Application
Thanks to modern web development frameworks, creating new applications has become an easy and straightforward process.
Developers run a couple of commands to generate the new project, finetune the necessary configurations, start the server, and that’s it. They have a barebone skeleton application that is up and running on the local server.
The Phoenix framework is no exception to that rule. The task — mix phx.new
is responsible for creating a new Phoenix project.
If you check out the official docs, you will notice that the task supports many optional parameters. Depending on which parameters you add, you will get a different baseline project.
One interesting option is --live
. It signals the generator to bootstraps Phoenix.LiveView
to the project codebase. In other words, you get a brand new LiveView application out of the box and can start building interactive, real-time features on top of it.
In today’s article, I want to take a look behind the scenes and explore the code generated by mix phx.new <app_name> --live
.
I believe this in-depth look will help the readers solidify their understanding of LiveView and how it fits together with the rest of the Phoenix framework.