Talk Club Sessions: #2 Phoenix LiveView

Phoenix LiveView

In this new session we talked about Phoenix LiveView. We based the discussion around Chris McCord's Keynote on ElixirConf 2019:

Phoenix LiveView is a library that enables rich, real-time user experiences with server-rendered HTML.

I chose this video because it's by the Phoenix and Phoenix LiveView creator, it explains how it works and it has some cool demos of the latest features the library offers. Check the "Further reading" section of this post in case you need to gather some context!

I think Elixir and Phoenix are really interesting technologies, and Phoenix LiveView is the latest of a bunch of crazy and awesome techs around the Phoenix framework.

In this Talk Club session I'd like to discuss what uses we could find for this tech, what use-cases it could solve for us. Could it replace a whole JAMstack website? Would it only be useful for admin sites?

The topic created some interesting discussions, of which we extracted these conclusions:

  • LiveView seems like a good fit between usual "static" apps (no API-based frontend apps, so a click renders the full HTML from the backend) and frontend apps backed by APIs. Also, it seems like a good fit for reactive data (eg data visualization dashboards) and admin dashboards, where we wouldn't build APIs.
  • Does it make sense to combine it with frontend frameworks like Vue? That is, can LiveView render Vue components? Can a Vue component render a LiveView-ready HTML markup? We can't answer this confidently, but our guess is that it's at least troublesome because HTML would be updated from two different sources and that usually causes merge problems with virtual DOMs.
  • It sparks some doubts, though: how does the server handle the memory? We know Elixir and Phoenix are very memory-efficient, but this library forces us to keep some state in the server for each connection. Do we need to worry about that?

We will try LiveView in an upcoming Phoenix project, so we'll keep you updated!

Further reading

Cover photo by Nathan Fertig on Unsplash