akin
Hey everyone,
Recently, I’ve been working on a project that uses LiveView for most of the UI, but for some parts with very complex client state, it leverages Gleam’s Lustre framework.
If you’re not familiar with it, Lustre is a Gleam frontend framework that implements the Elm architecture and takes advantage of Gleam’s ability to compile to JS for building highly interactive UIs.
I wrote a few simple helpers and components to make integration easier and improve DX. They allow Lustre to be rendered anywhere inside HEEX and communicate with LiveView from Gleam via the WebSocket connection. It’s similar to LiveSvelte or other JS integrations, but with Gleam and Lustre. It also supports server-side rendering.
Would you be interested if I release this as an open source library (lissome)? I Just want to collect feedback before start extracting the code into a library.
Trending in Discussions
Other Trending Topics
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
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
lawik
That does sound very interesting
Getting to keep going with the well built-out Elixir ecosystem and proven LiveView but being able to use Gleam for shared logic between front and back seems like a neat capability.
Does this all use Plug and that server or how does Lustre get integrated?
MikaelFangel
Like the idea of this! Would love to try it out for some small hobby projects in the beginning.
akin
That’s exactly the motivation.
It compiles Gleam to Erlang and calls it to produce the initial html. Then compiles Gleam to JS and bundle it using esbuild binary to hydrate.This is different when using Lustre server components.
The integration is via a component, for example:
The library will rely on mix_gleam, which is a tool to manage Gleam with Mix. I’ll probably change the under-hood details if I figure out a more efficient approach but now the above works well.
ignasiesbr
I would be really interested on trying this out.
I think a way to have client side state on certain parts of the application is needed for more complex UIs.
Will keep an eye on this thread
akin
Hey all! Just released the library, it’s still extremely early stage and a lot of work to do, but here is the repo and the hex package.
https://github.com/selenil/lissome/
I’ll be sharing here some new features as I add them.
Papipo
I am working on gleam support for mix. Do you want to try it out?
akin
Sure! I’ve been running into some issues with mix_gleam, and what you’re doing will definitely help.
hayleigh
Wow what a cool project!
I see you’re using Lustre in its typical “SPA” mode:
and decoding flags and state like you would for traditional ssr/prerendering purposes.
You might also want to dig into Lustre’s component system: because these are built on native Web Components and you’d be able to communicate directly with a LiveView app through attributes and events like any other HTML element
akin
Thank you @hayleigh.
My plan is to eventually support all Lustre’s modes, I think that offers a lot of versatility.
akin
Release 0.3.1
Hey, everyone! This release brings new features and a refactor to the approach taken by the library for doing the integration between Lustre and LiveView.
The highlights are:
Next step will be support for
lustre.componentcomponent and Lustre’s server components.