Type-Safe URL Query State Manager for Next.js

Zero typing lag, automated Clean URL parameter purging, and atomic batch transitions engineered specifically for modern Next.js App Router applications.

v1.0.6
$npm install paramsync

Engineered for Production Velocity

Eliminates typing stutter, hydration desynchronization, and cluttered URLs with three core architectural pillars.

0ms Input Latency

Controlled inputs update local React state instantaneously with zero typing lag, while browser URL synchronization is debounced asynchronously in the background.

•debounceMs: 300 by default

Clean URL Policy

Default values, empty strings "", and empty arrays [] are automatically purged from the query string, preserving canonical SEO links.

•Zero query string pollution

Atomic Batch Transitions

Filter drawers and slide-overs commit updates across 10+ query parameters in a single, unified Next.js navigation transition without history bloat.

•1 history entry per commit

Developer-First API

Works like useState, but seamlessly bound to URL query state.

TypeScript 5+ • Zero boilerplate
TSCatalogFilters.tsx
'use client';
 
import { useQueryState, parseAsString, parseAsArray, parseAsInteger } from 'paramsync';
 
export function CatalogFilters() {
// 1. Debounced live search with 0ms input feedback
const [search, setSearch] = useQueryState('q', parseAsString.withDefault(''), {
debounceMs: 300,
});
 
// 2. Type-safe array of categories (omitted from URL when empty)
const [categories, setCategories] = useQueryState(
'categories',
parseAsArray(parseAsString)
);
 
// 3. Auto-cleans from URL when equal to default 1
const [page, setPage] = useQueryState('page', parseAsInteger.withDefault(1));
 
return (
<div className="space-y-4">
<input
type="text"
value={search}
onChange={(e) => {
setPage(1); // Auto-reset page on search
setSearch(e.target.value);
}}
placeholder="Filter catalog..."
/>
</div>
);
}
main|paramsync
TypeScript JSXLn 33, Col 1

Why paramsync vs Vanilla Next.js?

Standard Next.js useSearchParams() is low-level and read-only. paramsync solves all modern URL state challenges out-of-the-box.

Typing Performance0ms Feedback
Vanilla Next.js: Stutters typing keystrokes by re-rendering on every router push.
paramsync: Local React state updates in 0ms while URL push is debounced.
Type SystemStrict Runtime
Vanilla Next.js: Returns raw string | null requiring manual parsing.
paramsync: Automatic type casting for numbers, booleans, arrays, ranges, and sort.
URL CleanlinessCanonical SEO
Vanilla Next.js: Pollutes URLs with ?q=&page=1&filter=.
paramsync: Default and empty parameters are automatically removed from query string.
Batch OperationsSingle Navigation
Vanilla Next.js: Updating 5 inputs generates 5 router transitions and history bloat.
paramsync: Stage 10+ changes in a filter drawer and commit atomically in one step.