mikesax

mikesax

Firebase+Vue or Phoenix LiveView?

Facing a fundamental decision while looking to build a web app for small farms — pretty much a typical SAAS database app but with a non-traditional, more interactive UI. The problem is that a lot of these farms have terrible Internet connectivity (just check out this report!). Eventually, the app will go international where connectivity is possibly even worse.

I really love Elixir, Phoenix and especially LiveView. I’ve built some test apps, and tried them both using bad cellphone connections and with browser latency/speed limits. The efficiency of LiveView on the wire goes a long way but if the signal drops, the user is really stuck.

Looking for alternatives, the most viable option seems writing a Vue app that interacts with Firebase. Firestore has good data caching and even stores writes while offline locally (reflecting them back to your app) while re-syncing as soon as the Internet connection is back. To build an occasionally-offline app, it seems like this would be ideal, but I feel very suspicious about that beyond a simplistic CRUD example. It’s the opposite of the elegance of LiveView.

Phoenix (either LiveView or old-fashioned HTML with minimal JS) provides a single source of truth with everything always in sync, plus so many other advantages that make the app more robust and easier to develop. No wonder the forums here exude developer satisfaction.

Another possible solution may consist of both:

  1. To deal with poor connection, minimize LiveView trips, so don’t use it on every keystroke, or in simple interactions like clicking a different tab or a menu.
  2. To deal with no connection, embed an almost entirely separate “offline” version of the app that looks the same but is merely a read-only version snapshot with the most recent data (which would have to be refreshed periodically).

Both would several reduce the elegance and speed of LiveView, but maybe there could be generalized way to implement this so it doesn’t need lots of extra code for every feature.

Am I overthinking this? Or wishing for something impossible? Or is there a way to make this work?

Thank you!

First Post!

cmo

cmo

You may consider https://electric-sql.com/

Most Liked

mikesax

mikesax

Thanks Pal — I agree about LiveView alone offering much of what I need, and in some ways it offers a much better solution for poor connectivity. If people have high latency and terrible bandwidth, they’re not going to download (or, importantly, update!) a big, heavy client-side app, so being able to serve pages quickly and then using minimal network (which is exactly what LV) is hugely beneficial.

Yes, I’ve looked at LiveView native with great interest. My (recent) background is in iOS development so I may even be able to find some opportunities to contribute (especially around navigation).

There is still so much to learn but the deeper I get into this, the more exciting and affirming everything feels!

Pal

Pal

Ive recommended this post elsewhere on the forum, this is a super &very interesting approach:

mikesax

mikesax

A thought, while looking into this: just like a “Reduce Motion” feature in accessibility that will skip animations, I am thinking of a “Reduce Network Use” mode for my app that would minimize both bandwidth (choosing lower res WebP images, for example) and server roundtrips (like keystroke validation) but still keep the app fully functions. This could eventually make its way into a separate library (or even as part of LIveView) to address perf concerns on poor connections.

Last Post!

codeanpeace

codeanpeace

It’d be pretty nifty if that mode’s automagically toggled on/off based on a sliding window tracking connection/signal strength!

Where Next?

Popular in Questions Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement