CLI took for creating easy routes for Next.js
npm install next-cli-toolkit.tsx, .jsx and .css files in one command — (inspired from nest-cli)
user/[id]
page.tsx, page.jsx and page.css files
bash
npm i -D next-cli-toolkit
`
$3
`json
"scripts": {
"nextcli": "nextcli"
}
`
$3
`bash
npm run nextcli home/[id]
`
$3
`bash
/src/app/home/[id]/page.tsx
/src/app/home/[id]/page.css
`
---
The generated
page.tsx will look like this:
`tsx
"use client";
import "./page.css"
const Page = () => {
return (
<>
this is home/[id]
>
);
};
export default Page;
`
Available commands:
| Command | Output |
| ------------------------------------ | -------------------------------------------------------------- |
| nextcli your/route | Generates page.tsx and page.css |
| nextcli your/route-no-css | Generates page.tsx only |
| nextcli your/route-interface | Generates page.tsx with interface boilerplate and page.css |
| nextcli your/route-interface-no-css | Generates page.tsx with interface only |
| nextcli your/route-jsx | Generates page.jsx and page.css |
| nextcli your/route-jsx-no-css | Generates page.jsx only |
| new | |
| nextcli componentName-comp | Generates Component.jsx and Component.css at src/components |
---
Additionally you can download it globally:
`bash
npm install -g next-cli-toolkit
`
and you can use nextcli in any directory. Just use the command:
`bash
nextcli your/route
`
---
👨💻 Author
Built with 💙 by Saumya Sarma
* Instagram
* LinkedIn
* X
* GitHub
* NPM Package
* Project Repository
---
MIT License — Free for personal and commercial use.
``