Skip to main content
A pattern tells Reintersect which URLs belong to a reference kind. Patterns use a small subset of the URLPattern syntax: an https scheme, a host and a path. The grammar is narrow on purpose. Every pasted link in a workspace is checked against every installed app’s patterns, so a pattern must be cheap to match and must not claim links that belong to someone else.

Writing a pattern

patterns maps a pattern id of your choice to a pattern string. params is typed from the string: in this example it is { workspace: string; id: string; slug?: string }, and a typo such as params.idd is a type error. Patterns must be string literals. A pattern built at runtime from a variable is rejected with Reference patterns must be string literals so Reintersect can match them statically.

The grammar

Allowed examples

Rejected examples

TypeScript checks the grammar when you write the pattern, and Reintersect checks it again when you deploy. The type error is the message in the table. The public suffix check uses the full Public Suffix List, including shared hosting suffixes such as vercel.app, github.io and pages.dev. A wildcard must sit under a domain one organization controls.

Parameters

  • :name captures one path segment as a string.
  • :name? captures the final segment when present; the field is optional in params.
  • A final * captures the rest of the path, including slashes, as params.rest.
  • Values stay percent-encoded. https://example.com/files/Q3%20plan gives { name: "Q3%20plan" } for the pattern https://example.com/files/:name. Decode with decodeURIComponent when you need the text.
  • Parameters are untrusted input. Validate their format in resolve, for example with a Zod schema, before you use them in a request.

Several URL shapes for one kind

When the same object has more than one URL shape, give each shape its own entry in patterns. resolve receives the id of the pattern that matched as patternId, and params is narrowed accordingly:
Return the same externalId from both shapes so both links show the same shared object. Pattern ids are 1 to 64 characters from A-Z, a-z, 0-9, _, . and -.

How matching works

Reintersect matches URLs on its own servers. Browsers, the editor and your app never run the patterns. When a URL matches, Reintersect stores which pattern matched and the extracted parameters, and the SDK routes the call to your resolve by pattern name. Your runtime doesn’t need URLPattern support. When more than one pattern matches a URL, from your app or from different apps, Reintersect picks the most specific one:
  1. The pattern with the most literal characters wins.
  2. On a tie, a pattern without a trailing catch-all (/*) wins over one with it, so https://example.com/:team/:project beats https://example.com/*.
  3. On a further tie, the pattern with fewer wildcards and parameters wins.
  4. On a final tie, the member’s own development installs come first, then workspace installs in the order they were installed.

Claimed domains

Every host your patterns use should fall under a domain listed in the app’s domains option. reintersect check warns about a pattern whose host isn’t claimed:
Apps installable by link match a pattern only once its host is under a verified domain. Private apps in their own workspace, and development installs, skip verification. See Domain verification.

Limits