Mobile app alternative (PWA) via ELM?

They are designed for different scenarios.

LiveView is about server side rendering and a smart JS library that synchronizes the DOM with data from the server based on events.

Elm is about client side rendering.

Combining the two is tricky because LiveView wants to modify the DOM and Elm wants the DOM to never be modified from outside itself.

You can combine the two by keeping them separate. For example, you can have one section of the page be implemented in Elm while some other sections could be implemented with LiveView. It depends on the use-case scenario.

I doubt that there will be an easy way to combine them if Elm controls the entire page or if it is used to handle routing.

In terms of PWA, to my understanding, it is advisable to have a SPA that is capable to handle losing the connection to the server. I think Elm is better suited for this particular usecase. You can still have the REST server implemented in phoenix but the frontend should be delegated to Elm. LiveView needs a websocket connection to the server so, it might not be a good fit for PWA.

1 Like