thinkingcat

thinkingcat OP

Hi, I am looking for a library for Elixir that helps to do offline-first type sync to the client. We are currently using Ecto and Absinthe but I don’t think subscriptions can help with asynchronous updates. We can do Listen/Notify, but I haven’t looked into that yet. Hoping there is someone out there who’s thought of this issue already and is working on it as there are a number of good alternatives in other languages :laughing:

We are running Flutter, and this is an example of a synchronization library that is available in Python:

https://github.com/mobync/python-server

Examples in other frameworks are Watermelon DB, Realm and Parse.

Research in Past forum posts have shown me something like Syncing deeply nested list of maps with client, which is very much ‘in the weeds’.

I’m looking for, as I am sure others might like, an easy plug and go library for syncing the database of a offline-first client to the server.

Thanks! :slight_smile:

First 3 of 3 Posts Switch mode

ruslandoga

ruslandoga

Subscriptions, listen and notify all require network and wouldn’t help you when the user is offline. Offline-syncing is very much depends on complexity of your data structures, how conflicts are to be resolved, whether you want to only push offline writes from a single client per object (easy), or you need to be able to resolve conflicts between multiple clients to the same object (hard), etc. I’m not aware of any off-the-shelf solutions in elixir ecosystem. There are some CRDT and the recently released Delta which seems to be OT libs out there but any of them might be not suitable in depending on your usecase.

Off-topic – there are really good lectures on youtube by Martin Kleppmann on this and related topics.

thinkingcat

thinkingcat OP

Thanks so much @ruslandoga!

Is there something that we can model on in Elixir from other languages?

I put this matter off for the past year or so (as you can see) but I will be back on it soon. Have a great one!

mdwaud

mdwaud

The Martin Kleppmann suggestion is great - his book is excellent as well.

I work on a similar problem where we have distributed devices running Elixir and Nerves that have intermittent connectivity, but need to reliably transmit data to and from the cloud. The approach I ended up taking was very similar to Kafka or database replication, where data is written to a sequential log on either end and the log is asynchronously replicated between client and server with at least once delivery. This approach solves many problems (reliable delivery, easy to audit or reconstruct system state, etc.), but introduces new ones (linearizability, immutable data, write amplification, etc.). Building on top of this you can use CRDT type approaches like a PN Counter to make eventually consistent values. Beware, though, distributed systems can be a real pain in the neck.

The system runs in production quite well and there is an example app here, however I am sharing this mostly for educational purposes since the protocol is still changing I’m not sure how much support I can give.

It’s a really interesting problem, though, and I’m happy to let you bounce any ideas you have off of me.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement