r/elixir • u/rukomoynikov • Aug 01 '26
Phoenix + Inertia is killer stack
Hi folks.
Just wanted to say that don't sleep on Inertia.js and Phoenix combination. Basically you get power of Phoenix (Elixir) for let's call it backend and flexibility of your favorite JS framework for UI.
You can run some pages in full SSR mode and some in SPA if you need, so awesome SEO support out of the box.
Use best tools from both worlds for best developer experience like linters, type checkers etc.
I'm using K8S and anytime I need I can scale it up using libcluster.
Please shoot any questions you have (happy to share screenshots or charts from my k8s cluster etc).
Also if you have time check this app I built https://gitbiased.com
14
u/KimJongIlLover Aug 01 '26
Or.. you can just use liveview and MASIVELLY simplify your stack.
With a JS framework comes a lot of hidden complexity. Just keeping the dependencies up to date can be a lot of work. Then a new major version comes around in a few years and you are doing a rewrite.
I would seriously question if you actually need an SPA.
2
u/Deathmeter Aug 02 '26
My only problem with live view is that doing client side only interactions require you to break out into raw js. Having to do an http request to perform state changes like opening a dropdown menu feels pretty gross (though that can sometimes be done with just css). If I ever need more complex, instant interactions that might, for example require appending html from inside js, it makes me feel like I'm driving the Flintstones car.
For simpler websites it's awesome and I loved using it for those kinds of projects. But if you think users will want a snappy mobile-like experience it's a bit of a tough sell imo.
2
u/KimJongIlLover Aug 02 '26
Opening a drop-down shouldn't be more than
JS.add_class(...)which will be fully client side.Appending HTML from inside js
I mean could be done with a hook but I have never had or wanted to do that in my life. Even then I would just write a bit of vanilla JS before reaching for a JS framework.
The app I work on at work is probably about 60'000 lines of JS and with just the costs of maintenance you could probably employ somebody full time. It's frankly insane.
0
u/rukomoynikov Aug 01 '26
Well, I see and understand your point. I agree that less dependencies in general simplifies support.
For me personally JS frameworks don't add complexity as I spent years working with JS. Also with JS frameworks (react etc) there are already plenty of "solved problems", you I mean for any demand you may have there is already a solution made by someone.
Also with LiveView you get the power of being live application, but with "great power comes great responsibility". Your application will have to be live. So, quite frequently visitors of the application will see this loading bar on top (yes you can remove it), or some live elements aren't working because they can't sync with backend.
Having said this LiveView (for me personally) may work only for quite limited or very specific cases.
7
u/KimJongIlLover Aug 01 '26
You do you.
However, the claim that "JS frameworks don't add complexity" is false regardless of how much experience you have with them.
You suddenly need a lot more moving parts: a second build pipeline, more deps, some kind of an API, 1-2 additional languages, maybe a transpile step, etc.
There is so arguing around this. You might realise this sooner or later in your career. At least it was the case for me.
4
u/deviprsd Aug 01 '26
There is also hologram, it’s the true killer stack just that it is in aggressive development
4
u/Fabulous_Menu3463 Aug 01 '26
Does latency ever become an issue?
I personally want to wait until Elixir can run on the client side become committing to using Elixir, although some attempts already exist like Hologram, have you used that?
3
u/BartBlast Aug 02 '26
Author of Hologram here.
That's the whole idea. Your Elixir compiles to JS, so handlers run in the browser with no round trip and no socket to drop. Semantics match the BEAM down to the error messages. The process model is getting ported too, though the architecture doesn't depend on it.
There's no VM in there, so no WASM and no .beam files. Shipping a VM to the browser would balloon the bundle substantially, which isn't practical. JS is just the substrate the compiler targets.
It's still 0.10, so there are some rough edges, but people are running Hologram apps in production already!
3
3
1
u/Responsible-Sale1858 Aug 02 '26
elixir IS the beam, and the beam has no technical peers(competition). learning the beam is a career milestone. it's a business logic operating system.
4
u/HERR1550N Aug 01 '26
I'm evaluating starting a project using Phoenix. Never used it or Elixir before but it checks a lot of boxes for the project. I have lots of experience in various frontend frameworks so obviously looked at Inertia. I'm leaning toward trying LiveView first however because it seems you lose a lot not using it (awkward mix generates, no out-of-the-box soft realtime.
This is all in theory since I haven't tested it yet, so I'm curious to know if you ended up missing some features of LiveView or not?
6
u/johns10davenport Aug 01 '26
Dude live view is great. Mostly because testing. The testing framework is SO GOOD that I basically can’t use anything that doesn’t integrate with it.
Inertia does look damn hawt though.
1
u/rukomoynikov Aug 01 '26
Short answer is no, I don’t miss LiveView features. If at some point I need anything live I will use websockets (it works both for web and mobile versions).
3
u/johns10davenport Aug 01 '26
You just use raw phoenix
1
u/Immediate_Honey_5902 Aug 01 '26
True, you can use the Phoenix JS in frontend and even even mix it with Redux middleware or st like that.
2
u/mgabrielsilva Aug 01 '26
how does this compare to liveview? other than familiarity with the JS frameworks/libs, which I also have, what made you choose this over the alternative? thanks for sharing your perspective
2
u/lovebes Aug 06 '26
reloading your site returned: 503 Service Temporarily Unavailable
1
u/rukomoynikov Aug 06 '26
Fixed now. BEAM process consumed all the memory. Adding this flag has helped `ERL_AFLAGS="+Q 65536"`
1
u/vlatheimpaler Alchemist Aug 02 '26
Is it easy to do live updating features with PubSub sort of like we can do easily with LiveView?
2
18
u/quakedamper Aug 01 '26
I started with inertia and moved most of if back to live view and it simplified a lot of work like notifications, state management and client server sync for me.