victorolinasc

victorolinasc

Phoenix frontend without the HTML stack?

The Elixir community and more specifically the Phoenix community have always been involved with some form of frontend development. Initially through server side rendered HTML/CSS/JS directly in Phoenix, passing through some native integrations like Scenic and recently through LiveView Native project. There are also many geared towards the embedded landscape that I am not familiar with…

The main target for Elixir frontend is usually the traditional web (HTML/CSS/JS, DOM model and so on). The platform is awesome for building web apps with easy to add real time capabilities using websockets/server sent events and so on.

The problem, in my opinion, is that the world of 2D GUI applications is trying harder and harder to move away from DOM and web specific architectures. Nonetheless, I think the Elixir community is going on the opposite direction… I’ve seen José’s talk about performance optimizations for LiveView which are now in the process of optimizing because we know we handle HTML/CSS/JS, recent LiveViewNative posts about transliterating HTML to SwiftUI and some other solutions…

In my humble opinion, HTML/CSS/JS is a horrible paradigm for 2D applications. More modern and functional approaches have been developed. Most of them use some kind of DSL to express view trees and interactions (QML, Jetpack compose, SwiftUI, etc, etc). Our approach in Elixir-land has been to re-use HTML and HTML based approaches (like tag based components) to drive UI even though the language is perfect for DSLs.

Also, most of the modern ones favor immutable data components for the view tree and need to invent some kind of message passing for handling events or interactions and Elixir is perfect for that.

Also again, many toolkits are now using compute runtimes to make it possible to use GPUs seamlessly. Nx is here just for that :slight_smile: . We seem to be heading in an awesome direction here too.

Also the third time, many applications are using a client/server architecture to provide “concurrent users” like Zed, Lapce (both code editors but full 2D GUI applications). Everything is a CRDT in Zed (from its docs) and we have CRDTs in Phoenix Presence since the beginning…

I guess that what I am trying to say is that from an outside perspective we are betting on the web. It seems we either have something special for keeping the HTML model and make it work better as a frontend toolkit or we are not actually agreeing these seem more modern and better at all.

I have a deep respect for everything the community is building on top of the HTML stack and it is absolutely awesome to see it running in things like LiveBook and so on. I feel confident to say we have the best SSR web framework possible. I just think that maybe we are still far away from the full potential of the BEAM/Elixir for a cross platform 2D application solution. Some more steps will be needed here.

What do you people think about it?

P.S.: One excellent post about frontend architectures and how different approaches can be achieved recently is this one from Ralph Levien in the Rust community. It is naturally more geared towards the Rust ecosystem but it is a nice read overall.

Have a nice day you all :slight_smile:

Most Liked Responses

thomas.fortes

thomas.fortes

Is it really though? Yeah, there are the frameworks that you refered to, but they aren’t web focused, qml is mostly used embedded and jetpack compose and swiftui mostly mobile (and backed by two trillion dollar companies that have control over the platforms where they are used), and as such they have a different set of constraints than the web, but for the web all I see are experiments and DSLs that in the end are compiled to html+js+css.

The parts about client server UIs in desktop land in my opinion in the same area, desktop software have a different set of constraints than the web.

Elixir isn’t betting on the web, but I think that the phoenix framework is betting on the web, it is (aside from liveview native and desktop) mainly a web framework and has to work with the constraints of the web, which at the moment are HTML, CSS and Javascript, all the abstractions will have to run as html+js+css and work with the DOM anyway.

So, what I think is that I’m a big fan of the small “magic” of the framework, I don’t think another abstraction would do any good for adoption or even development, quite the opposite, it would create an even bigger barrier for adoption.

What we have on the web is far from perfect, but I don’t think it is something that should be the focus of the community, otherwise it would be even more niche than it already is.

derek-zhou

derek-zhou

I am keeping my eyes on slint, which matches your description (DSL based 2D GUI). It should be possible to use Elixir for the data layer and business logic and Rust for the presentation layer.

derek-zhou

derek-zhou

Please name some. SwiftUI is proprietary and single platform. so is Flutter. Web is not perfect but it is the best we got.

Where Next?

Popular in Discussions Top

vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
axelson
Decided against including more info in the title, but the gist is that Plataformatec sponsored projects will continue with the assets bei...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
chuck
Let me start by stating an assumption: Phoenix is a great approach to building REST APIs. There are many reasons for this, but I will ass...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
ejpcmac
I have discovered Nix last month and I am currently on my way to migrating to it—both on macOS at home and the full NixOS distrubution at...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
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

We're in Beta

About us Mission Statement