@devalade/route-list
v0.1.2
Published
A command-line tool to scan and list all routes in your Next.js application, supporting both the App Router and Pages Router patterns.
Readme
Next.js Route List
A command-line tool to scan and list all routes in your Next.js application, supporting both the App Router and Pages Router patterns.
Features
- ✅ Supports Next.js App Router (
appdirectory) - ✅ Supports Next.js Pages Router (
pagesdirectory) - ✅ Handles projects with
srcdirectory structure - ✅ Supports TypeScript (
.tsx) and JavaScript (.js) files - ✅ Handles route groups
(...)in App Router - ✅ Clean and formatted output
Installation
Install globally using your preferred package manager:
npm install -g @devalade/route-list
# or
yarn global add @devalade/route-list
# or
pnpm add -g @devalade/route-listUsage
Navigate to your Next.js project directory and run:
route-listThat's it! The tool will automatically scan your project and list all available routes.
Example Output
Scanning Next.js routes...
Found App Router directory...
Found Pages Router directory...
Found routes:
- /
- /about
- /blog
- /blog/[slug]
- /contact
- /products/[category]/[id]
Total routes found: 6Supported Project Structures
The tool works with various Next.js project structures:
Standard Structure
my-next-app/
├── app/ # App Router
│ ├── page.tsx
│ └── about/
│ └── page.tsx
└── pages/ # Pages Router
├── index.tsx
└── blog/
└── index.tsxSrc Directory Structure
my-next-app/
└── src/
├── app/ # App Router
│ ├── page.tsx
│ └── about/
│ └── page.tsx
└── pages/ # Pages Router
├── index.tsx
└── blog/
└── index.tsxRoute Detection Rules
App Router (app directory)
- Detects routes from files named
page.jsorpage.tsx - Handles route groups (folders starting with parentheses)
- Ignores files that aren't pages (like layout.tsx, loading.tsx)
Pages Router (pages directory)
- Detects routes from
.jsand.tsxfiles - Converts
indexfiles to root routes - Maintains folder structure in route paths
Troubleshooting
If you encounter any issues:
- Ensure you're in a Next.js project directory
- Verify that you have either an
apporpagesdirectory (or both) - Check if your project uses a
srcdirectory structure - Make sure you have read permissions for the project directory
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Notes
- The tool ignores
node_modulesand hidden folders (starting with '.') - Route paths are normalized to ensure consistent formatting
- Both App Router and Pages Router can coexist in the same project
