6 ms·
Phoenix LiveView 1.2
- cpursley 4mo agoLiveView is such a breath of fresh air, especially over the vibe coded NextJS rats nests that have become the norm (that need specialized hosting, are dog slow and require a ton of proprietary paid services bolted on like caching, background workers and even auth which Elixir and Phoenix provide out of the box). https://elixirisallyouneed.dev https://elixirisallyouneed.dev
- Tinkeringz 4mo agoWhat caching is provided out of the box for Phoenix framework?
- conradfr 4mo agoDoesn't seem to be mentioned in the page but if you're talking about request caching there's libraries like PlugHTTPCache or RequestCache. Otherwise I usually use Nebulex (annotations are nice for Ecto queries) with ETS as it's faster than with Redis (if you don't care about losing the cache on deployment).
- cpursley 4mo agoOut of the box in Elixir/Erlang, Phoenix is the web framework layer.
- solid_fuel 4mo agoThere's options, what do you want to cache? One thing to keep in mind is that with LiveView, there is a live process on the server side while the websocket remains connected. That means that many small things, like fetching user permissions, do not need to be performed again on every single request like a more tradition SPA application would require. Instead you can perform them once when the user connects and then simple store them in the LiveView process. That process can also subscribe to PubSub notifications for changes, which provides a cache invalidation method. Effectively, a LiveView process functions as a tiny dedicated cache for any given connected user.
- AdamConwayIE 4mo agoI've been loving LiveView. Been using it for a project for a client recently and it's so... chill. I like it a lot.
- Traubenfuchs 4mo ago> specialized hosting What do you mean? My private next.js fullstack slop runs dockerized on my kubernetes cluster and for auth I use auth0, because I am too lazy to run keycloak or whatever dockerized auth slop is currently en vogue.
- cpursley 4mo agoIt's possible but most default to vercel and it's required if you want the fancy stuff (hybrid). And you made my point, Kubernetes is overkill as well. Regarding auth, in phoenix it's literally as simple as "mix phx.gen.auth Accounts User users" and boom, your users live right in your database for free.
- candl 4mo agoWhat are the pros and cons compared to ASP.Net/Blazor?
- weatherlight 4mo agoThe BEAM virtual machine. Its has lightweight isolated processes, message passing, supervisors, hot-ish runtime introspection, and fault containment are not libraries bolted on later. They are the substrate. not an after thought. if you are build an app that needs the following: + many concurrent users + real-time UI + background jobs + workflows + stateful sessions + distributed events + failure isolation + “this thing should keep running for months” You're going to want the thing built on the BEAM.
- rubyn00bie 4mo agoI’m not sure how I feel about the CSS integration. Nor the collocated JS that was somewhat recently released. On one hand, yes it is convenient, but on the other it could become a huge mess. It reminds me of Rails 2.x where it became almost impossible to debug, or fix front end code that used rjs or whatever it was called. Because disparate snippets of JS were littered throughout your code base in files that were hard to find. I’m sure the Phoenix team has put a lot of effort into it, and I truly hope it slaps. I myself am just really hesitant to use it, when CSS files and non colocated JS work just fine. I’ll probably be waiting a couple years before giving it a try
- conradfr 4mo agoTo be honest that's copied from the JS frameworks. I tend to agree with you but sometimes scoped CSS is nice to have.
- GCUMstlyHarmls 4mo agoI quite like the colocated JS. I much prefer to define a components "hook" code inside the component. I think you could abuse it, I would never put colocated JS just in some template to include it "just to avoid writing a js file" but for keeping `email_validator.js` code right next to the `email_input` component, its quite nice I think. The nature of them being basically forced to inherit the module name means its pretty obvious that `MyAppWeb.Admin.Components.EmailValidator` is in the `MyAppWeb.Admin.Components` module. I also think it probably strongly depends on how much JS you actually have, most of my liveview apps have it "here and there" to enhance something or minor DOM fiddling, if you are booting react components everywhere and have some other pile of existing js code, its probably not so good.
- paradox460 4mo agoSurface, vue, and svelte have all have colocated css and js for ages. It usually results in easier to maintain code, without having to resort to unsolutions like tailwind Global styles can still be global, but component level styles stay at the component level
- orliesaurus 4mo agoI've been using Phoenix for super basic things for a very long time since I first discovered it at the Elixir meetup in ATX. I haven't touched it in a while, Since writing code these days, as most of us know, it's basically steering an LLM. So I wonder how good are LLMs at writing Phoenix or Elixir so to speak? Time for me to create another side project... and figure it out.
- johnisgood 4mo agoThey were pretty good a year ago, so I am sure it is even better than that now.
- cpursley 4mo agoI'd argue that it's one of the best, especially with Tidewave: https://dashbit.co/blog/why-elixir-best-language-for-ai https://dashbit.co/blog/why-elixir-best-language-for-ai
- avanwyk 4mo agoI've built several production quality, mid-sized apps in Phoenix/Elixir over the last year using Claude Code (CC). In my experience, it's great, I had better results with this stack than I had with Django when using purely CC. It's token efficient (because of code generator), has great static analysis, and terse (because functional). Phoenix even generates an Agents.md The apps themselves are highly scalable and look great. Checkout https://github.com/oliver-kriska/claude-elixir-phoenix https://github.com/oliver-kriska/claude-elixir-phoenix (not me).
- thibaut_barrere 4mo agoLLM use is very solid here. I have been shipping some fairly cool stuff for different clients, just like if I was managing a team of 3 or 4 people. The stable nature of the language, and the static/immutable nature of constructs, presumably really helps moving safely here.
- ricw 4mo agoIt works great for a number of reasons - it’s functional making it much easier to reason about for LLMs (eg no side effects) - it’s compiled (including the html template), so the LLM get instant feedback if something is off and can fix it quicker - it’s more concise than other frameworks (language, framework, no front/backend split) and consequently you hit the max token limit much less frequently - it has excellent tailwind support I told a business partner to just use claude for certain tasks a year ago, and it failed miserably in python where it succeeded in elixir/phoenix liveview. This was a regular occurrence. LLMs have obviously progressed since, but the principle still stands that they work much better in elixir than python. So in short: it’s great and arguably better than most other languages and frameworks
- lwouis 4mo agoI like this familly of technologies. Having an SPA-type app that's mostly backend. Recently i've redone my app website (https://alt-tab.app https://alt-tab.app), and I implemented a minimal spa.js that has a similar approach. I find the end result blazing fast, simple to maintain / reason about, few moving pieces. I used Early Hints, compressed every single thing, inlined CSS, etc. I don't know how i could even make it faster. I recommend this approach for websites that are not very complex. Of course if i made a browser-based music player with a super dynamic UI, that would have been a different story~
- sebmellen 4mo agoVery cool concept with AltTab. Have always been looking for something like it!
- Intermernet 4mo agoCan't the website be literally static HTML for 99% of it? I don't really see any user defined input that would change the output. It's really fast, and seems fine, but is it just static pages? If not, why not. That's the question most front end devs don't ask themselves enough.
- epolanski 4mo ago> I don't really see any user defined input that would change the output. I feel like the distinction between static websites and SPAs has been lost in the last decade, despite it being in the name _single page application_. The point of SPAs is not "it's more interactive than a static website is", but "I don't need to fetch the new page and wait it to load as I navigate". You can have any custom behavior just by adding JavaScript. That's something we have from 30+ years. "applications" don't interrupt the user as you navigate, and we tried to replicate that on the browser, by having history and render JavaScript controlled.
- oliwarner 4mo ago> each navigation had to reload the whole page Saving the world, 50ms at a time. Honestly there are times when using the View Transition API makes sense, but the context here is a dinky brochure site. The weight of scripting does as much damage to first load as it saves on subsequent loads. Browsers are good enough at managing this stuff themselves.
- OhSoHumble 4mo agoI'm pretty smitten with Phoenix as a framework. A lot is built into the BEAM by default and the Elixir ecosystem is quite lovely. I've been building an Etsy-lite replacement in my free time with it: https://plukio.com/ https://plukio.com/ It's pretty enjoyable. I also like using Ash for data modeling and business logic expression. It's also quite lovely.
- moritzwarhier 4mo agoI wanted to try out Erlang + Elixir since forever, do you think Phoenix LiveView would be a good starting point? For example, to create something like a simple game with modest persistence and only very limited RT-features? I was thinking about sth like a quiz app, not a web MMORPG of course :) Or is LiveView only useful to optimize partial page reloads and SEO?
- projct 4mo agoLiveView is perfect for that. one of the easiest to understand demos of it is actually something just like that. that said liveview is capable of 60fps server-rendered animation, so it's definitely not just for speeding up page loads.
- moritzwarhier 4mo agoThanks a lot! I'll give this a try next time I feel like coding for a hobby. I've tried exactly this "project idea" in a half-assed way some time ago with next.js, Postgres and Prisma before I was out of free-time-in-front-of-computer. Then abandoned it again it when I started coding for a living again. It was exactly the "modest RT capabilities" thing when I abandoned it. Because I started using Firebase (2023, Supabase was not known to me then) and then I felt like "OK, I managed to get full next.js running properly on shared hosting with limited server-side JS, but now I again need an external cloud provider for a hobby project" (Firebase). I read a bit about their pricing models and lost interest. I think next time I'm gonna try see what this stack can do. In 2024, I heard a very interesting conference presentation about Erlang and its concurrency model, that was after the hobby experiment, and made me want to revisit losely functional languages with strong pattern matching (OCaml too, but that's a different topic).
- jimmypk 4mo ago[flagged]
- robinvdvleuten 4mo ago[flagged]
- paradox460 4mo agoYears ago I used surface ui's colocated css to great effect. Super happy to have it incorporated into mainline live view