When building out apps with #HTMX, I end up with views and templates for both "pages" and (lots of) “partials”. Does anyone have any tips for organizing those two things?

It feels kind of messy in a way that having the strict boundary of a separate API doesn’t. (Although having a separate frontend framework just to client-side render HTML is messy in a whole other way)

Maybe just being more disciplined about routing and naming the partial templates would solve some of this…

@adamghill

This proliferation of endpoints is one of the reason #Datastar has been created, initially as a port of #HTMX ro Typescript + SSE, now it's the most hypermedia-oriented framework:

https://data-star.dev/

With SSE you can update portions of the web page from the server and with signals you can propagate changes client-side. With the former you can manage the state totally server-side, with the latter you can avoid involving the server when there aren't state changes.

Datastar

The hypermedia framework.

Datastar
@alxlg datastar looks super cool. I’m hopeful to try it out at some point!

@adamghill @alxlg I highly recommend it!

I'm planning on posting a blog post in the next couple of days showing why I have switched from HTMX to Datastar.

When I use Datastar, I think about rendering the whole component instead of trying to render partials, since they use an algorithm (I think ideomorph) to change what needs updating.