A simple CLI tool to speed up your workflow when working with Next.js projects.
Generate pages, components, and routing structures automatically with a single command to speed up the scaffolding.
- 📄 Page Generator: Instantly scaffold new pages with or without the
'use client'
directive. - 🧩 Component Style Options: Choose between
function
orconst
component styles. - 🌿 App / Pages Routers Support: Both routers in Next.js are supported.
- ⚙️ Configurable: Adjust defaults via a config file to match your project’s standards.
- 🧼 Visualize Structure: Visualize your project's directory structure.
$ go install github.com/bllakcn/nextjs-routing-helper-cli@latest
- Initialize the config file in your root directory of your Nextjs project.
$ nextjs-routing-helper init
This will create a .nextjs_routing_helper.json
, where the cli will hold the necessary preferences.
- Add a Page
$ nextjs-routing-helper add [route/subroute] [flags]
This command creates a new page under the specified directory.
- In App Router projects, it generates a
page.tsx
file underapp/route/subroute/
. - In Pages Router projects, it generates a
index.tsx
file underpages/route/subroute/
.
You can optionally pass flags like --use-client
to include the 'use client';
directive in App Router components:
$ nextjs-routing-helper add dashboard/home --use-client
- Add support for dynamic routes
- Add pages interactively
- Custom templating support
- Generate API routes
- Git hook integration for consistency checks
Contributions are welcome! Feel free to open issues, request features, or submit PRs.
MIT