Skip to content

Latest commit

 

History

143 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paramour

paramour — "param" + "amour": a library that loves your params.

npm CI license

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" } });

Packages

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

Why

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.

Examples

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.

Contributing

Bugs and feature requests are welcome — open an issue.

License

MIT © Jason Paff

About

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 the user's choice of validation library.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages