tonydang

tonydang

Hi everyone! I’m new to the forums and new to Elixir in general. To learn Elixir, I recently just completed my first app. It’s a todo app built with Phoenix LiveView, but with a twist, it can also work offline :smirk:

By using the LiveSvelte package, I was able to use LiveView to render Svelte components which allows for offline-support. I know an offline app was not what LiveView was intended for, but I thought it was neat that it was possible to still use LiveView in such an app.

I haven’t gotten the chance to dive deeper into Phoenix Channels yet so I’m not sure if the app would perform better just using that instead. However, so far the app has been working well for me and the DX of using LiveView has been great. Anyhow, I thought I would share in case anyone else is interested in building offline-enabled apps with LiveView :slight_smile:

Here’s a video I made walking through how I made the app:

Source code:

Live Demo:

Any questions and feedback welcomed!

Showing Posts 27 to 18

tonydang

tonydang OP

Whoa, thanks for sharing! I’ll definitely check it out when I get the chance.

It’s also awesome that the creator of Yjs mentioned he’d add the project to the Yjs README. Hopefully, that will get more people to try it out. :smiley:

And thanks for the kind words about the Yjs/Svelte/LiveView example! I’m really glad it was helpful.

mmmrrr

mmmrrr

I just saw that someone created a wrapper for y-crdt (the Rust library) in elixir: https://github.com/satoren/y_ex

Here is the announcement post on the YJS forum: https://discuss.yjs.dev/t/yrs-elixir-bindings/2826/3

That beeing said: thanks a ton for creating the example of combining yjs with svelte and live_view. It was a great read and I learned a lot from it :slight_smile:

tonydang

tonydang OP

Hi @andreaa, the app I built uses PostgreSQL as the database on the server-side. It also stores data locally in the browser’s IndexedDB, LocalStorage, and SessionStorage.

andreaa

andreaa

Does this use any database?

mindreframer

mindreframer

@coen.bakker This sounds cool! Any chance of open-sourcing the Rust NIF? How much effort was it to wrap Automerge?

coen.bakker

coen.bakker

The comparison was between the JS and the wasm version of the Automerge client side library. I actually ended up never benchmarking the two :slightly_smiling_face:. So I don’t know how big the difference is. But probably the Automerge community has made some comparisons in the process of building the wasm implementation. But not sure if that info is publicly available.

tonydang

tonydang OP

That’s awesome! Sounds like using the Rust NIF turned out to be the more performant solution between the two?

coen.bakker

coen.bakker

Oh and I remember now using the wasm version of their client side code also. To compare performance.

coen.bakker

coen.bakker

I did the latter.

I used a Rust NIF to be able to create and merge crdt docs on the Elixir server. In combination with creating, merging and editing on the client side with their js library.

tonydang

tonydang OP

Automerge is a really cool CRDT solution as well! I haven’t tried in much besides setting up a hello world project with it once.

I’m curious, how did you handle syncing? Were you using Automerge’s public sync server or did you build your own Phoenix solution?

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
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
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews