HACKER Q&A
📣 3000

Data store recommendation when using Htmx


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!


  👤 xvello Accepted Answer ✓
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.


👤 recursivedoubts
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.

👤 leke
How about the web native store?