webdeb
Hi, we have an NextJS Frontend Application which is basically React.
Now we would like to use a Phoenix App as a Service for some Live data. But we only need the JSON no HTML. Is Phoenix LiveView a good fit for this, or should we go with the low-level Phoenix Channels.
In comparison, I think that Channels is really low-level. On the other hand LiveView is very high-level and too HTML specific. IMHO something like LiveState would be a cool thing.
For example const { state, dispatch } = useLiveState() (React hooks)
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
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
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
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
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 16 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Miserlou
I’ll throw my hat into the ring too, I guess.
Just pushed an alpha of this:
https://github.com/Miserlou/live_json
Built for my own needs, but maybe it’ll be handy for you as well.
It’s very simple and works with existing LiveViews - just use
LiveJson.push_patchthe way you’d useassignorpush_event. It has two modes,jsondiffandrfcmode, which use Jsondiff and JSON-Patch, respectively. jsondiff mode is very fast, and rfc mode is compatible everywhere.As an example you can:
Then, in your JS console:
Only deltas are sent over the wire, so it’s quite fast!
More details soon, but works for me.
webdeb
Guys, I started working my initial state as a service idea, which should be a simple way to share state. I call it livestate (livestate.io) And I would love you to check it.
The code is open source, and very basic livestate.io · GitHub
@methyl I liked your solution for special purpose state very much, as it made possible to use type generation for TS, and custom methods. And it was actually your ideas which inspired me to go with the json-patch method
justinmcp
100%. Sounds like a good idea. I have vaguely worked out having the reducers return a ecto.changeset instead of the entire new state, and then sending the changeset across the wire.. I’m still not 100% on the idea though, maybe just a json-diff thing is better as you say.
I’ll pop into the channel and we can chat about it all.
harmon25
That is awesome!
Looks like a lot of the same thoughts we are pursuing. Join us on the livedata slack group if you haven’t already, and we can collab on these ideas!
Thinking there is room for both a lower level API that could be dropped into a phoenix app for server-side state in your JS client, and something that integrates them together more, for a fullstack next.js(ish) Elixir framework - which does server-side react rendering, and wires it all up - which is what taper is shaping up to be…
One thing we have implemented is sending json-diffs, akin to live_view diffs. Taper is just sending the entire state each time from the looks of it. Think there is room for some testing to determine if the json diffing actually helps at scale. I could imagine if the json is not very big - the diff might actually be more bytes than just sending the full json. It also of course comes at a cost of calculating the diff, also on the client applying it…
justinmcp
Looks like I am pursing a similar idea over at GitHub - justinmcp/taper: Taper is a React (with SSR) and server-side-redux-like environment for Elixir+Phoenix. · GitHub. You can render react components directly from a template (.html.jsx) and they can connect to a server-side version of redux (basically the same API as redux). It can also render jsx server side only, skipping hydration on the client. There is currently one example at GitHub - justinmcp/taper-examples: Examples for the Taper project · GitHub.
Still really early days. I want to put back a “remote call” hook that could call out to any gen_server, handle store loading/persistence in a reasonable way, etc, etc.
Shaping up nice though.
methyl
@harmon25 @webdeb I started a channel livedata on Elixir Slack, let’s connect there and kick it off
harmon25
This looks is amazing, I would love to help polish LiveData and get it published on hex!
Exactly the kind of middle ground I am looking for - a lower level state abstraction than LiveView, but something a bit higher level than just channels.
I have had the exact mental model of redux <-phoenix-channel-> gen_server - and even made a similar proof of concept that leverages the gen_server state as the source of truth.
The addition of
fast-json-patchis a great idea and is what morphdom does but with just the state, genius!Any progress since the video and the code that you have posted?
If you started breaking it out into a new repo, I would be jumping on to contribute right away!
webdeb
Cool! I think this is what I had in mind!
Update
@methyl
After watching your screencast. I am sure it’s exactly what I had in mind
methyl
Hey there.
I actually think it’s an idea with a lot of potential and use-cases that could be supported either in LiveView or as a separate library.
Being able to use whole React ecosystem while keeping the state in sync with your GenServers (or other abstraction) is something that we already experimented with. Take a look at this repo: GitHub - surferseo/livedata_todomvc · GitHub which is a proof of concept for the idea.
While the POC implementation is hideous, the API is really clean and powerful - check out livedata_todomvc/lib/phoenix_livedata_todomvc_web/live_data/todo_state.ex at master · surferseo/livedata_todomvc · GitHub and livedata_todomvc/assets/js/containers/TodoList.js at master · surferseo/livedata_todomvc · GitHub.
If you are interested in hearing more, check out this video https://www.youtube.com/watch?v=fvNy9bh8_vs where I talk a bit about motivations and the ugly internals.
Trying to make it play well with LiveView makes a lot of sense, as it lowers the barrier of entry to integrate it with existing JS codebases.
lud
To me it looks like this library has no dependencies at all (besides the test lib for dev).
https://github.com/ElixiumNetwork/bert-elixir/blob/master/package.json