Ask HN: Data store recommendation when using Htmx

5 points by 3000 ↗ HN
Saw a thread discussing htmx[1], and thought it was time to give it a go.

anyone have a recommendation for a simple cookie, localstorage, session etc library that works well with it?

[1] htmx.org

grateful for any replies!

6 comments

[ 2.1 ms ] story [ 26.5 ms ] thread
what language? htmx should work fine w/ whatever backend library you are comfortable with. a lot of django folks have picked it up, but there are a million different language/framework combos.
sorry, i meant a js client side library.

(on the backend im using php and arangodb.)

oh, you probably don't need much of one: when htmx makes requests it'll act like a normal web request and include cookies, etc.

if you do want to do some client side stuff, Alpine.js is a popular and lightweight option

yeah i had a look at alpine. will give them a go along side each other.
How about the web native store?
One of the points of HTMX is to merge back all of the state to the backend, instead of spreading it between backend and frontend.

For authenticated users, just store a user pref record on your database. For state that is not linked to a user account, use the standard session mechanism of your backend. Alternatively, just use good-old functional cookies, with the Set-Cookie HTTP header. Set them to be available to javascript if needed.