{"id":13809790,"url":"https://github.com/seamapi/next-route-matcher","last_synced_at":"2025-10-11T14:30:40.551Z","repository":{"id":65396746,"uuid":"515787148","full_name":"seamapi/next-route-matcher","owner":"seamapi","description":"A route matching utility decides how to match a pathname based on filesystem route strings in NextJS style","archived":false,"fork":false,"pushed_at":"2025-02-10T20:52:20.000Z","size":210,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-01T09:53:53.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seamapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-20T00:56:58.000Z","updated_at":"2024-12-17T04:44:34.000Z","dependencies_parsed_at":"2024-08-04T02:01:58.801Z","dependency_job_id":null,"html_url":"https://github.com/seamapi/next-route-matcher","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"c99d63fb04a4105279c5c56fb2ac4c7ff91e2cd7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seamapi/next-route-matcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnext-route-matcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnext-route-matcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnext-route-matcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnext-route-matcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seamapi","download_url":"https://codeload.github.com/seamapi/next-route-matcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnext-route-matcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007457,"owners_count":26084313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T02:00:36.122Z","updated_at":"2025-10-11T14:30:40.190Z","avatar_url":"https://github.com/seamapi.png","language":"TypeScript","readme":"# NextJS Router Matcher\n\nWant to use [nextjs-style routes](https://nextjs.org/docs/routing/dynamic-routes)\nwithout the [next module](https://github.com/vercel/next.js/)? This module lets\nyou easily match routes. This code was adapted directly from the NextJS\nimplementation.\n\n## Installation\n\n```bash\nyarn add next-route-matcher\n```\n\n## Usage\n\n```ts\nimport nextRouteMatcher from \"next-route-matcher\"\n\nconst routeMatcher = nextRouteMatcher([\n  \"/health\",\n  \"/api/nested\",\n  \"/api/items/[item_name]\",\n  \"/api/[someslug]/list\",\n  \"/api/[slug1]/deepnest/[slug2]/image.png\",\n  \"/api/[someslug]/greetings/[...anything]\",\n])\n\nrouteMatcher(\"/health\")\n// {\n//   matchedRoute: \"/health\",\n//   routeParams: {},\n// }\n\nrouteMatcher(\"/api/nested\")\n// {\n//   matchedRoute: \"/api/nested\",\n//   routeParams: {},\n// }\n\nrouteMatcher(\"/api/items/someitem\")\n// {\n//   matchedRoute: \"/api/items/[item_name]\",\n//   routeParams: { item_name: \"someitem\" },\n// }\n\nrouteMatcher(\"/api/someslug/list\")\n// {\n//   matchedRoute: \"/api/[someslug]/list\",\n//   routeParams: { someslug: \"someslug\" },\n// }\n\nrouteMatcher(\"/api/slug1/deepnest/slug2/image.png\")\n// {\n//   matchedRoute: \"/api/[slug1]/deepnest/[slug2]/image.png\",\n//   routeParams: {\n//     slug1: \"slug1\"\n//     slug2: \"slug2\",\n//   }\n// },\nrouteMatcher(\"/api/someslug/greetings/something/somethingelse.txt\")\n// {\n//   matchedRoute: \"/api/[someslug]/greetings/[...anything]\"\n//   routeParams: {\n//     someslug: \"someslug\",\n//     anything: [\"something\", \"somethingelse.txt\"],\n//   },\n// }\n```\n","funding_links":[],"categories":["Official Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fnext-route-matcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseamapi%2Fnext-route-matcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fnext-route-matcher/lists"}