paoloricciuti/sveltekit-search-params
The easiest way to read and WRITE from query parameters in sveltekit.
🚀 SvelteKit Query Params Made Simple
Treat URL query parameters like any other Svelte store.
sveltekit-search-params is a lightweight TypeScript library by paoloricciuti that lets you read and write query parameters in SvelteKit apps without manual URL parsing. It wraps the page's query string into a reactive store, so changes to the store automatically update the URL and vice versa.
✨ Highlights
- Read all parameters: call
queryParameters()to get an object of current query params. - Write to store: assign values like
params.username = 'foo'and the URL updates automatically. - Declare expected parameters: pass an object to
queryParametersto predefine keys, missing ones default tonull. - Encode/decode types: specify
encodeanddecodefunctions to convert between strings and booleans, numbers, arrays, etc. - Default values: use
defaultValueto set a fallback when the param is absent. - Helper encodings: built‑in helpers for common conversions reduce boilerplate.
💡 Why it matters
Unlike manual window.location.search parsing, this library provides a two‑way binding that respects Svelte's reactivity and works seamlessly with server‑side rendering. The ability to define expected parameters and custom encoders makes it easy to keep type safety and avoid URL injection issues. It's perfect for search filters, pagination, or any UI state that should be shareable via URL.
#SvelteKit #QueryParams #OpenSource #TiniX
Similar Projects
Discover other similar projects and AI models.
The next-generation file converter. Open source, fully local* and free forever.
Type-safe search params state manager for React frameworks - Like useState, but stored in the URL query string.
🧩 A beautiful library with SVG logos. Built with Sveltekit & Tailwind CSS.
Skeleton is an adaptive design system powered by Tailwind CSS.
A web interface for chatting with Alpaca through llama.cpp. Fully dockerized, with an easy to use API.