d-led

d-led

LiveView independent micro-frontend idea: somewhat stuck + repo

Hi,

For some reason the idea that micro-frontends could profit from the optimizations of Phoenix LiveView does not leave me in peace.

If anyone has been thinking about it, and would like to experiment, or point to an existing blog/talk/repo, that’d be great.

I have a repo with an experiment, and am stuck due to lack of time,

but it has a minimal functionality to play around with already.

Constraints:

  • no iframes

  • no dependence on OTP app update mechanisms

The imagined architecture:

  • Separate, independent teams can build and operate both LiveView UIs with maximum simplicity and deployment flexibility

  • The front-end degrades gracefully if micro-front-ends are down

  • Optimizations of LiveView can be utilized, trading for some chattiness between the services

Currently:

  • 3 independent nodes are connected in a cluster

  • the main_app acts as the front-end, serving the main page

  • 2 services push rendered partial LiveViews to which the main_app is subscribed, rendering them as they are, within the main view

I naively tried sending the diffs only but failed, presumably, since the services are independent and using the diff

optimizations would require calling functions, available in each separate app only.

I’m sure it can be done better :blush:

Most Liked

superchris

superchris

You might have a look at LiveState. Full disclosure, I am the author :slight_smile: I think it shares several of your goals (no iframe needed, etc) and has multiple apps in production, some for years.

victor23k

victor23k

Hey Dmitry, you might want to take a look at this: support multiple livesockets by gfrancischelli · Pull Request #3564 · phoenixframework/phoenix_live_view · GitHub

Related to that, I’m working on a way to take this a step further and use LiveView for embedded widgets. The difference in that approach is that the owner of the main page would be a third party. Maybe there is some overlap and it could solve both problems. You can take a look at the proposal here.

superchris

superchris

The client js lib is a very thin wrapper around the phoenix channels js client. It definitely works fine for react, I wrote a react hook in <30 lines. It should work anywhere I would think

Where Next?

Popular in Discussions Top

Other popular topics Top

Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
nobody
Hi! In PHP: $SERVER['SERVERADDR'] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
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
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement