{"id":13561400,"url":"https://github.com/DiiiaZoTe/next-route-visualizer","last_synced_at":"2025-04-03T17:30:41.988Z","repository":{"id":113547360,"uuid":"609641556","full_name":"DiiiaZoTe/next-route-visualizer","owner":"DiiiaZoTe","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-06T18:11:10.000Z","size":265,"stargazers_count":497,"open_issues_count":2,"forks_count":16,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T04:20:10.349Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://next-route-visualizer.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DiiiaZoTe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2023-03-04T19:45:01.000Z","updated_at":"2025-03-03T07:52:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"f0914806-eb8c-485c-8408-7a8437509e88","html_url":"https://github.com/DiiiaZoTe/next-route-visualizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiiiaZoTe%2Fnext-route-visualizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiiiaZoTe%2Fnext-route-visualizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiiiaZoTe%2Fnext-route-visualizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiiiaZoTe%2Fnext-route-visualizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiiiaZoTe","download_url":"https://codeload.github.com/DiiiaZoTe/next-route-visualizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247046781,"owners_count":20874720,"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":[],"created_at":"2024-08-01T13:00:56.010Z","updated_at":"2025-04-03T17:30:41.232Z","avatar_url":"https://github.com/DiiiaZoTe.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/alexvencel"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003enext-route-visualizer\u003c/h1\u003e\n  \u003cb\u003ev1.1.3\u003c/b\u003e\n  \u003cp\u003eA package for visualizing Next.js app directory routes.\u003c/p\u003e\n  \u003ca href=\"https://next-route-visualizer.vercel.app\"\u003e\n    \u003cb\u003eDemo website\u003c/b\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n---\n**Next Route Visualizer** is designed to display the routes for the app directory of Next.js (starting at version 13) in a visual tree-like fashion.\nThis package aims to help developers better understand the routes in their Next.js app directory by providing a clear visual representation of the routes and their relationships.\n\nThis package can be useful if you are new to the app directory and need to visualize it.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/DiiiaZoTe/next-route-visualizer/blob/main/public/next-route-visualizer-preview.png?raw=true\" alt=\"Preview Next Route Visualizer\" width=\"600\"/\u003e\n\u003c/div\u003e\n\n---\n## Usage\n\n### Installation\n\nYou can install **`next-route-visualizer`** using npm:\n\n```\nnpm install next-route-visualizer\n```\n\n### Importing\n\nOnce you've installed the package, you can import the **`Visualizer`** component into any page of your Next.js version 13 app directory.\nFor ease of use just import it in the root page for instance:\n\n\n```jsx\nimport Visualizer from 'next-route-visualizer';\n\nexport default function Home() {\n  return (\n    \u003cVisualizer /\u003e\n  )\n}\n```\n\nThat's it! The **`Visualizer`** component will render a tree chart that displays the routes of your Next.js app directory.\n\n### Visualizer props\n\n| Prop name         | Type                 | Description\n| ----------------- | -------------------- | ------------\n| path              | String or undefined  |  \u003cp\u003ePath to the starting route (relative to the app directory).\u003cbr/\u003eIf not provided, the component will search for the app directory within the root folder or .src/ folder.\u003c/p\u003e\n| baseURL           | String or undefined  | \u003cp\u003eBase URL of your project.\u003cbr/\u003eDefault: http://localhost:3000\u003c/p\u003e\n| displayColocating | Boolean or undefined | \u003cp\u003eDisplay colocating folders\u003cbr/\u003eDefault: false\u003c/p\u003e\n\n---\n## Example\n\nThe below example shows how to use the `path`, `baseURL` and `displayColocating` parameters.\n\n```jsx\nimport Visualizer from 'next-route-visualizer';\n\nexport default function Home() {\n  return (\n    \u003cVisualizer path=\"blog\" baseURL=\"https://example.com\" displayColocating/\u003e\n  )\n}\n```\nOnly the sub-routes of `blog` (blog included) will be displayed on the chart. This assumes that `blog` is a direct sub-route of the app root (i.e ./app/blog in your file system).\n\nSince `displayColocating` was also provided, all the colocating folders will also be included on the chart.\n\n---\n## Features\nUnder the hood, **next-route-visualizer** utilizes **[ReactFlow](https://reactflow.dev/)** to build the chart.\n\n- Starting route: You can start displaying at any route of your project.\n- Side dashboard: Display information about a route\n  - Name\n  - Link\n  - Path\n  - Type\n  - Next.js files\n  - Other files (non Next files)\n- Display if RSC or Client according to the file having the `'use client'` statement.\n  This may not be 100% exact...\n- Route selection: Select a Route from the chart to see its information\n- Node type colors: The nodes in the chart have different colors based on the type of route:\n  - Root: Entry point\n  - Route: A normal route\n  - Route group: folder that are marked in parenthesis e.g. (routeGroup)\n  - Route segment: all the various slug options e.g\n    - [slug]\n    - [...slug]\n    - [[...slug]]\n- Preview the Next.js files included in the route with the following icons (files extensions: [.js, .jsx, .ts, .tsx])\n  - \u003csvg width=\"24\" height=\"24\" fill=\"grey\" viewBox=\"0 0 16 16\"\u003e\n      \u003cpath d=\"M8.188 10H7V6.5h1.188a1.75 1.75 0 1 1 0 3.5z\" /\u003e\n      \u003cpath d=\"M4 0h5.293A1 1 0 0 1 10 .293L13.707 4a1 1 0 0 1 .293.707V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm5.5 1.5v2a1 1 0 0 0 1 1h2l-3-3zM7 5.5a1 1 0 0 0-1 1V13a.5.5 0 0 0 1 0v-2h1.188a2.75 2.75 0 0 0 0-5.5H7z\" /\u003e\n    \u003c/svg\u003e for \u003cb\u003epage\u003c/b\u003e\n  - \u003csvg width=\"24\" height=\"24\" fill=\"grey\" viewBox=\"0 0 16 16\"\u003e\n      \u003cpath d=\"M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0zM9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1zM5.884 6.68 8 9.219l2.116-2.54a.5.5 0 1 1 .768.641L8.651 10l2.233 2.68a.5.5 0 0 1-.768.64L8 10.781l-2.116 2.54a.5.5 0 0 1-.768-.641L7.349 10 5.116 7.32a.5.5 0 1 1 .768-.64z\" /\u003e\n    \u003c/svg\u003e for \u003cb\u003eerror\u003c/b\u003e or \u003cb\u003enot-found\u003c/b\u003e\n  - \u003csvg width=\"24\" height=\"24\" fill=\"grey\" viewBox=\"0 0 16 16\"\u003e\n      \u003cpath d=\"M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0zM9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1zM5.057 6h5.886L11 8h-.5c-.18-1.096-.356-1.192-1.694-1.235l-.298-.01v5.09c0 .47.1.582.903.655v.5H6.59v-.5c.799-.073.898-.184.898-.654V6.755l-.293.01C5.856 6.808 5.68 6.905 5.5 8H5l.057-2z\" /\u003e\n    \u003c/svg\u003e for \u003cb\u003elayout\u003c/b\u003e or \u003cb\u003etemplate\u003c/b\u003e\n  - \u003csvg width=\"24\" height=\"24\" fill=\"grey\" viewBox=\"0 0 16 16\"\u003e\n      \u003cpath d=\"M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0zM9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1zm-3 2v.634l.549-.317a.5.5 0 1 1 .5.866L7 7l.549.317a.5.5 0 1 1-.5.866L6.5 7.866V8.5a.5.5 0 0 1-1 0v-.634l-.549.317a.5.5 0 1 1-.5-.866L5 7l-.549-.317a.5.5 0 0 1 .5-.866l.549.317V5.5a.5.5 0 1 1 1 0zm-2 4.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm0 2h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1z\" /\u003e\n    \u003c/svg\u003e for \u003cb\u003eroute\u003c/b\u003e\n  - \u003csvg width=\"24\" height=\"24\" fill=\"grey\" viewBox=\"0 0 16 16\"\u003e\n      \u003cpath d=\"M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0zM9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1zm-1 4v3.793l1.146-1.147a.5.5 0 0 1 .708.708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 0 1 .708-.708L7.5 11.293V7.5a.5.5 0 0 1 1 0z\" /\u003e\n    \u003c/svg\u003e for \u003cb\u003eloading\u003c/b\u003e\n- Display the colocating files and folders\n- Display if the page is SERVER or CLIENT on the chart node\n\n**Colors of the nodes are as followed:**\n\n| Type          | Color     |\n| ------------- | --------- |\n| Root          | Blue      |\n| Route         | Purple    |\n| Group         | Red       |\n| Segment       | Green     |\n| Colocating    | Orange    |\n\n---\n## Limitations\nIn order for the component to work properly, the routes need to be retrievef server side, and rendered on the client using ReactFlow.\n\nFor that reason, **you must refresh the page** to see any changes that you applied to your routes, for them to take effect on the chart.\n\n---\n## Future work\nThis is only a side project. The code is definitely a mess and I was too lazy to provide testing for it. I may be open to make a few changes on my free time if I feel like it.\n\nOn that note, please feel free to use and make any changes that you wish to include.\n\nNOTE: April 25th 2023\nIf I ever get some free time, I may try to add support for NextJS ^13.3.0 which added Parallel Routes and Interceptions.\n\n---\n## Dependencies\n- Next \u003e= 13.2.3\n- ReactFlow \u003e= 11.5.6\n\nNote: I didn't use tailwind or any other packages for the styles.\n\n## License\n\nNext Router Visualizer is ISC licensed.\n\n\u003ca href=\"https://www.buymeacoffee.com/alexvencel\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"60\" /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDiiiaZoTe%2Fnext-route-visualizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDiiiaZoTe%2Fnext-route-visualizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDiiiaZoTe%2Fnext-route-visualizer/lists"}