{"id":13880696,"url":"https://github.com/swan-io/chicane","last_synced_at":"2026-03-11T14:06:03.157Z","repository":{"id":40247048,"uuid":"420411399","full_name":"swan-io/chicane","owner":"swan-io","description":"A simple and safe router for React and TypeScript.","archived":false,"fork":false,"pushed_at":"2025-03-25T13:20:21.000Z","size":2268,"stargazers_count":427,"open_issues_count":0,"forks_count":12,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-06-20T12:11:58.937Z","etag":null,"topics":["react","router","typescript"],"latest_commit_sha":null,"homepage":"https://swan-io.github.io/chicane/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swan-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2021-10-23T12:51:04.000Z","updated_at":"2025-06-01T22:40:44.000Z","dependencies_parsed_at":"2023-12-29T16:31:20.302Z","dependency_job_id":"877d2f8f-25e4-4179-9902-3be4d48ca876","html_url":"https://github.com/swan-io/chicane","commit_stats":{"total_commits":130,"total_committers":2,"mean_commits":65.0,"dds":"0.038461538461538436","last_synced_commit":"7b05dfb56e4900bb0664aedafbf4b842a90dd95f"},"previous_names":["zoontek/react-chicane"],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/swan-io/chicane","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swan-io%2Fchicane","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swan-io%2Fchicane/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swan-io%2Fchicane/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swan-io%2Fchicane/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swan-io","download_url":"https://codeload.github.com/swan-io/chicane/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swan-io%2Fchicane/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265527543,"owners_count":23782480,"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","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":["react","router","typescript"],"created_at":"2024-08-06T08:03:24.333Z","updated_at":"2025-11-10T16:30:53.785Z","avatar_url":"https://github.com/swan-io.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","**1. Libraries**"],"sub_categories":["Web"],"readme":"\u003cimg width=\"108\" alt=\"@swan-io/chicane logo\" src=\"https://github.com/swan-io/chicane/blob/main/docs/static/img/logo.svg?raw=true\"\u003e\n\n# @swan-io/chicane\n\n[![mit licence](https://img.shields.io/dub/l/vibe-d.svg?style=for-the-badge)](https://github.com/swan-io/chicane/blob/main/LICENSE)\n[![npm version](https://img.shields.io/npm/v/@swan-io/chicane?style=for-the-badge)](https://www.npmjs.org/package/@swan-io/chicane)\n[![bundlephobia](https://img.shields.io/bundlephobia/minzip/@swan-io/chicane?label=size\u0026style=for-the-badge)](https://bundlephobia.com/result?p=@swan-io/chicane)\n\nA simple and safe router for React and TypeScript.\n\n## Design principles\n\n- **Typed routes**: improving the DX, and making sure all your params are here!\n- **Component-friendly**: the router nicely fits in your React app.\n- **Easy-to-use**: naming routes instead of moving around unsafe URLs.\n- **Performant**: avoids any unnecessary render.\n\n## Installation\n\n```bash\n$ yarn add @swan-io/chicane\n# --- or ---\n$ npm install --save @swan-io/chicane\n```\n\n## Links\n\n- 📘 [**Documentation**](https://swan-io.github.io/chicane)\n- 📗 [**Usage with other routers**](./ADOPTION.md)\n- ⚖️ [**License**](./LICENSE)\n\n## Quickstart\n\n```tsx\nimport { createRouter } from \"@swan-io/chicane\";\nimport { match } from \"ts-pattern\";\n\nconst Router = createRouter({\n  Home: \"/\",\n  Users: \"/users\",\n  User: \"/users/:userId\",\n});\n\nconst App = () =\u003e {\n  const route = Router.useRoute([\"Home\", \"Users\", \"User\"]);\n\n  // route object is a discriminated union\n  return match(route)\n    .with({ name: \"Home\" }, () =\u003e \u003ch1\u003eHome\u003c/h1\u003e)\n    .with({ name: \"Users\" }, () =\u003e \u003ch1\u003eUsers\u003c/h1\u003e)\n    .with({ name: \"User\" }, ({ params }) =\u003e \u003ch1\u003eUser {params.userId}\u003c/h1\u003e) // params are strongly typed\n    .otherwise(() =\u003e \u003ch1\u003e404\u003c/h1\u003e);\n};\n```\n\n## Run the example app\n\n```bash\n$ git clone git@github.com:swan-io/chicane.git\n$ cd chicane/example\n\n$ yarn install \u0026\u0026 yarn dev\n# --- or ---\n$ npm install \u0026\u0026 npm run dev\n```\n\n## 🙌 Acknowledgements\n\n- [react-router](https://github.com/remix-run/react-router) for the `history` and the `Link` creation code.\n- [reach-router](https://github.com/reach/router) for the path ranking algorithm.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswan-io%2Fchicane","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswan-io%2Fchicane","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswan-io%2Fchicane/lists"}