Embeded phoenix instance for offline Live View support

I just finished my first LiveView powered app. And I am really happy about the whole app structure and organization.

The only thing missing from LiveView is mobile app/offline support.

So I had an idea. I’m quite sure I am not the first, but I could not find any discussion of it.

What about some sort of SDK with an embedded phoenix server running on the client. I know erlang can be compiled on both iOS and android (or at least it used to work).

Basically it would be:

phoenix (server)->phoenix (client)->webview (client)

I know it is not a simple project, as it requires quite a few elements:

  • Compiling erlang and elixir for iOS and Android
  • Creating a caching DB for client data (ETS saved to file?)
  • Sync protocol and conflict resolution between the two phoenix instances

Live View wouldn’t need any changes, but views, instead of using ecto to load data, would use some library that run the code remotely, and gracefully fallback in case of the user being offline.

I have a rough idea of the architecture, and again, I know it is not a small task, but as removing JS has been so successful (for me, and I think others), I’d like to extend the idea to mobile app.

What are your thoughts? If there is some real interest, I might dedicate times to this.

5 Likes

There is an Elixir/Beam to Javascript compiler that could likely be leveraged for that. Otherwise if you are making an app for installation just use the native ecosystem.

Hi, has this idea been abandoned?
I’m very much interested in being able to use LiveView for offline scenarios.
I’d like to build PWAs as an easier to maintain alternative for native mobile apps.

So your idea about having an offline “version” of LiveView features, would be perfect.

Thanks for letting me know.
I’m new to Elixir / Phoenix, planning to reorient my consultancy to full-stack development.

Best regards
Marc

2 Likes