Live data from Hacker News

Htmx in a Nutshell

htmx.org

151–160 of 414 posts

Re: Htmx in a Nutshell

#151
post #45

howdy, I'm the creator of htmx, happy to talk about it

Quick question, as it made me curious. Can I send the content that I want to swap to the server itself? Say I want to submit a form to the backend, will it only send form fields or is there a way to send the form html itself?

Why would you do that? Curious about use case.

Re: Htmx in a Nutshell

#152
post #9

how would htmx handle application like pages? for example, something along the lines of google spreadsheets? Where each cell is interactive.

I'm building a SaaS that looks a lot like spreadsheets, but more specialized for PPC managers (my customers).

Doing it in htmx. Works great.

Re: Htmx in a Nutshell

#154
while I like htmx it's really for SSR frameworks specifically for django as rails has hotwire and laravel has livewire all do similar things.

then you have alpine.js that is more a simple jquery for frontend js work.

if you do django, use htmx, I'm not sure how it works for other scenarios. For rich desktop like apps, SPA is still probably the only option.

Re: Htmx in a Nutshell

#155

1. One of the most painful thing with SSR forms is passing the data back-and-forth between the server and client when there are validation errors. Sometimes the data is very sensitive and you have to return the form with some values (like SSN) empty and make the user retype that along with with whatever field(s) were the actual issue. I'm also curious about how file uploads would work. 2. REST/GraphQL/gRPC API. Often…

Why can’t you hydrate the form with the SSN? If you’re serving it via TLS, there shouldn’t be any problem. It’s no different sending it up to the client than it is for the client to send it down to you. Unless you’re logging every rendered page for some reason, I guess.

Re: Htmx in a Nutshell

#157

Earlier quoted context omitted.

Sure, if you ignore Dropwizard and tons of other less popular java frameworks out there.

Maybe I am missing something but Dropwizard is not a framework on its own but instead of collection of external and independently developed libraries

Maybe you are? Yes, it integrates existing frameworks and libraries. In fact, the home page says "Dropwizard is a Java framework for developing ops-friendly, high-performance, RESTful web services."

Re: Htmx in a Nutshell

#158
post #3

I am burnt out (but recovering!) with web dev and htmx is what I am using for my project. Django, DRF, Postgres, tailwind and HTMX. I am so tired of all the front end frameworks and all the complexity that gets added. At some point I think you need it and you get returns from it but hearing more people in the industry recognize and talk about how JS everything isn't always the answer gives me hope. I like what HTMX h…

Can I ask you how long you have been using this stack for and what are your findings ? Do you have a complex UI heavy application and can you deterministically say that this stack can replace frameworks like React/Vue for JS heavy frontend ?

Is HTMX really mature and stable for production and massive UI heavy apps ?

I am asking because we are starting a big project in Django, Postgres, Tailwind and for frontend, still trying to use VueJS and we hate SPAs so curious what our options are.

Re: Htmx in a Nutshell

#159

I work on a collection of React applications at work and it is OK but at night I am building a workflow engine that trains a text classification model and automates its activities based on that model. It is almost the kind of web application that I built in 2001 but I find it a lot easier to write today than I did back then thanks to my own maturity and numerous refinements to the web platform. The backend is written…

I did something similar with Bun recently. I built a little finance / budgeting app (and some bookmarklets) to track, categorize, and visualize my spending. There’s almost no client-side JS. But when I need to sprinkle it in, I just write a function and it’s serialized and sent to the browser automatically by my JSX template layer (built into Bun). It’s quite nice.

Re: Htmx in a Nutshell

#160
post #101
post #86

Earlier quoted context omitted.

Consider the case of calling your backend with a POST call and then updating your app in response. Typically, for a SPA: your backend would return some data, and your frontend would then figure out how to update your html in response to it. For a multi-page-app: your backend will redirect the user to a whole new page with new HTML. This is somewhere in between: Your backend will send just a little bit of HTML and you…

Yeah, that I understand. I am not a huge fan of sending JSON that's not backwards compatible. Sending HTML is probably a good choice for some applications, but that was already well supported 20 years ago. Why is htmx better than one line of javascript saying `onload = function() { e.innerHTML = response.body` } ?

In practice you don't want to just swap the content 100% of the time. Appending to the current content is quite common too, as is deleting from it. You sometimes need to touch other elements too, or maybe show a progress spinner. Or perhaps push a URL to the navigation history.

Htmx provides a batteries-included data-driven experience. It is a means to avoid having to write dozens of slightly different variants of the same 5-10 lines of Javascript.

Post reply on HN