slouchpie

slouchpie

Vague idea - IndexedDB + Ecto

PWAs use a thing called IndexedDB

I was reading the docs this morning and thought how cool it would be if there was some package built on top of Ecto that could automatically convert a project’s existing Ecto schemas to “object stores” (that’s what they’re called).

Even in a new project, maintaining the object store schemas to accord with the Ecto schemas is a burden (Absinthe devs will know this pain). It would be cool if it could be automated.

You can see an example of how an object store is built here:

https://github.com/mdn/dom-examples/blob/main/to-do-notifications/scripts/todo.js

I throw this vague idea into the void and see if anything resonates…

Most Liked

garrison

garrison

Might be better to look towards OPFS instead. I don’t have a source off the top of my head but I have heard many times that IndexedDB is, for various reasons, very unpleasant to deal with. My understanding is that going forward OPFS will be better (and is now widely available).

bartblast

bartblast

Creator of Hologram

I have something along these lines planned for the local-first stage of Hologram. I agree with @garrison that OPFS is probably the way to go here.

One thing to keep in mind though – it needs to be a little more involved than just storing data on the client. You’d probably want:

  • Auto-sync between client and server

  • Managing schema and data migrations on the client-side

  • Deciding what subsets of data to sync to the client-side (not everything should/can be synced)

slouchpie

slouchpie

@garrison Yes, OPFS looks much better. Thank you!

@bartblast Very exciting to hear about local-first plans. I might play with the OPFS stuff myself just to see what is possible.

Where Next?

Popular in Discussions Top

blackode
Elixir Upgrading is so Simple in Ubuntu and It worked for me Ubuntu 16.04 git clone https://github.com/elixir-lang/elixir.git cd elixir...
New
cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New
ejpcmac
I have discovered Nix last month and I am currently on my way to migrating to it—both on macOS at home and the full NixOS distrubution at...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
hazardfn
I suppose this question is effectively hackney vs. ibrowse but we are at a point in our project where we have to make a choice between th...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
griffinbyatt
Sobelow Sobelow is a security-focused static analysis tool for the Phoenix framework. For security researchers, it is a useful tool for g...
New
paulanthonywilson
I like Umbrella projects and pretty much always use them for personal Elixir stuff, especially Nerves things. But I don’t think this is ...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
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
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
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
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement