Tuesday | 15 OCT 2024
[ previous ]
[ next ]

Sveltekit Sessions

Title:
Date: 2024-10-05
Tags:  sveltekit

Sessions are one of those things that I could probably wire up myself but I'd rather farm it out to a library. Unfortunately there doesn't seem to be one blessed library and so I have tried a few now.

svelte-kit-cookie-session works well but if you want to hold more data than allowed in a cookie, you will need to do some server side session logic. If everything fits in a cookie, then this is a great library.

sveltekit-server-session is a server side solution so you can store as much data as you want. There is an in memory store by default or extend it to a persisent database.

There are few others I've tried that had issues with set up. These two worked out of the box and I could easily switch between them.