paramour — "param" + "amour": a library that loves your params.
A fully type-safe routing companion for the Next.js App Router: validated, typed route params and search params, type-checked path building, and a predictable, human-readable URL wire format — with your choice of validation library via Standard Schema.
Documentation: paramour.dev — start with
Getting Started, or try the
wire-format explorer. The docs site defines
its own routes with paramour and runs paramour check in its build — it is
itself an integration test.
import { defineAppRoute, href, p } from "paramour";
export const productRoute = defineAppRoute("/product/[id]", {
params: { id: p.integer() },
search: { q: p.string().optional() },
});
// typed, validated, explicit: "/product/42?q=paramour"
href(productRoute, { params: { id: 42 }, search: { q: "paramour" } });
// a string into p.integer() fails to compile
href(productRoute, { params: { id: "42" } });| Package | What it is | Docs |
|---|---|---|
paramour |
Core: codecs (p.*), route objects, href, the wire format |
reference |
@paramour-js/next |
Next.js integration: withTypedRoutes, hooks, and the paramour CLI |
reference |
@paramour-js/nuqs |
Derive nuqs parsers from a route's search codecs | reference |
@paramour-js/devtools-panel |
TanStack Devtools panel: watch routes decode live | reference |
Born from lessons learned maintaining and contributing to
next-typesafe-url, which is
effectively unmaintained. Paramour aims to be a documented, tested,
community-maintained answer to typed routing in Next.js — with a
migration guide written by migrating a
real next-typesafe-url app route by route.
The examples/ directory has an index of the example
projects — from a minimal tour to an exhaustive kitchen sink — all built and
typechecked in CI.
Bugs and feature requests are welcome — open an issue.
MIT © Jason Paff