create-next-pro-cli
Version:
Advanced Next.js project scaffolder with i18n, Tailwind, App Router and more.
374 lines (301 loc) β’ 10.7 kB
Markdown
<img src="./public/cnp-banner.svg" alt="create-next-pro logo" style="width:100%;" />
## Runtime Support
[](https://bun.sh)
[](https://nodejs.org)
<!-- [](https://deno.land) -->









[](https://www.conventionalcommits.org/en/v1.0.0/)
> β οΈ This project is under active development and currently in beta testing. You may encounter bugs or crashes until the first release. Not all features are implemented yet, and contributions are welcome!
Initially, changes will be accepted or rejected by the creator, but in a few weeks, contributions will be submitted to a community vote.
# create-next-pro-cli
> π An advanced CLI scaffolder to create professional Next.js projects instantly.
> π€© Can't wait and too excited to read more? Just want to try it now?
>
> βΉοΈ To enable autocompletion automatically, add the `--trust` option when installing globally with Bun:
>
> ```bash
> bun install -g create-next-pro-cli --trust
> ```
## π― Purpose
Create an enhanced alternative to `bun create next-app` with an interactive interface to generate Next.js projects tailored to real-world professional needs.
This open-source, community-driven project aims to gather and share best practices to help standardize Next.js project structures. It includes many other features to facilitate modern development workflows and encourage collaboration.
The CLI also enables you to instantly create pages and components, automatically placing them in the correct location within your projectβs architecture for seamless organization and scalability.
You can also customize the templates used for pages and components to fit your own needs.
## π οΈ Commands & Examples
### Create a new project
```bash
create-next-pro MyProjectName
```
> β οΈ The interactive prompt for features and customization is not yet implemented, but will be available very soon!
### Create a page
```bash
create-next-pro addpage MyPage
```
### Create a nested page
```bash
create-next-pro addpage ParentPage.ChildPage
```
### Create a component (global)
```bash
create-next-pro addcomponent MyComponent
```
### Create a component in a page
```bash
create-next-pro addcomponent MyComponent -P MyPage
```
### Create a component in a nested page
```bash
create-next-pro addcomponent MyComponent -P ParentPage.ChildPage
```
### Create a library
```bash
create-next-pro addlib mylib
```
### Add a file to a library
```bash
create-next-pro addlib mylib.foo
```
### Create an API route
```bash
create-next-pro addapi hello
```
### Remove a page
```bash
create-next-pro rmpage MyPage
```
### Remove a nested page
```bash
create-next-pro rmpage ParentPage.ChildPage
```
## π Expected Structure of a Generated Project
```plaintext
my-next-app/
.
βββ eslint.config.mjs
βββ messages
β βββ en
β β βββ Dashboard.json
β β βββ _global_ui.json
β β βββ _home.json
β β βββ Login.json
β β βββ Register.json
β β βββ Settings.json
β β βββ UserInfo.json
β βββ en.ts
β βββ fr
β β βββ Dashboard.json
β β βββ _global_ui.json
β β βββ _home.json
β β βββ Login.json
β β βββ Register.json
β β βββ Settings.json
β β βββ UserInfo.json
β βββ fr.ts
β βββ getMergedMessages.ts
βββ middleware.ts
βββ next.config.ts
βββ next-env.d.ts
βββ package.json
βββ postcss.config.mjs
βββ public
β βββ cnp-logo.png
β βββ cnp-logo.svg
βββ README.md
βββ src
β βββ app
β β βββ api
β β β βββ auth
β β β βββ [...nextauth]
β β β β βββ route.ts
β β β βββ post-login
β β β βββ route.ts
β β βββ favicon.ico
β β βββ layout.tsx
β β βββ [locale]
β β β βββ layout.tsx
β β β βββ loading.tsx
β β β βββ not-found.tsx
β β β βββ page.tsx
β β β βββ (public)
β β β β βββ _home
β β β β β βββ loading.tsx
β β β β β βββ page.tsx
β β β β βββ layout.tsx
β β β β βββ Login
β β β β β βββ page.tsx
β β β β βββ Register
β β β β βββ page.tsx
β β β βββ (user)
β β β βββ Dashboard
β β β β βββ error.tsx
β β β β βββ loading.tsx
β β β β βββ page.tsx
β β β βββ layout.tsx
β β β βββ Settings
β β β β βββ loading.tsx
β β β β βββ page.tsx
β β β βββ UserInfo
β β β βββ loading.tsx
β β β βββ page.tsx
β β βββ not-found.tsx
β β βββ page.tsx
β β βββ sitemap.ts
β β βββ styles
β β βββ globals.css
β βββ auth.config.ts
β βββ config.ts
β βββ lib
β β βββ auth
β β β βββ disconnect.ts
β β β βββ isConnected.ts
β β βββ i18n
β β β βββ navigation.ts
β β β βββ request.ts
β β β βββ routing.ts
β β βββ utils.ts
β βββ ui
β βββ Dashboard
β β βββ LogoutButton.tsx
β β βββ page-ui.tsx
β β βββ StatsCard.tsx
β β βββ WelcomeCard.tsx
β βββ _global
β β βββ BackButton.tsx
β β βββ Button.tsx
β β βββ GlobalHeader.tsx
β β βββ GlobalMain.tsx
β β βββ Loading.tsx
β β βββ LocaleSwitcher.tsx
β β βββ PublicNav.tsx
β β βββ ThemeToggle.tsx
β β βββ UserNav.tsx
β βββ _home
β β βββ page-ui.tsx
β βββ Login
β β βββ page-ui.tsx
β βββ Register
β β βββ page-ui.tsx
β βββ Settings
β β βββ page-ui.tsx
β βββ UserInfo
β βββ page-ui.tsx
βββ tailwind.config.ts
βββ tsconfig.json
```
## β
Main Features
- Interactive CLI available for Bun, Node.js, or Deno
- Multi-runtime support: Bun, Node.js, Deno
- Features:
- TypeScript integration
- ESLint configuration
- Tailwind CSS setup
- App Router support (with or without `src/` directory)
- Internationalization using `next-intl`
- Turbopack or Webpack support
- Custom path aliases (e.g., `@/*`, `@core/*`)
- Next-auth with custom cookies
- Automatic generation of pages and components
- Clean i18n structure: `/messages/en/*.json`, `/lib/i18n/`
- Add or remove pages and components via CLI
- Bash and Zsh autocompletion
- Interactive installation and runtime detection
## π CLI Structure
```plaintext
create-next-pro/
.
βββ bin.ts
βββ create-next-pro-completion.sh
βββ install.sh
βββ package.json
βββ public
β βββ cnp-banner.svg
β βββ logo.svg
βββ src
β βββ index.ts
β βββ lib
β β βββ addComponent.ts
β β βββ addPage.ts
β β βββ createProject.ts
β β βββ createProjectWithPrompt.ts
β β βββ rmPage.ts
β β βββ utils.test.ts
β β βββ utils.ts
β βββ scaffold-dev.ts
β βββ scaffold.ts
βββ tsconfig.json
```
## π Install & Usage
### Local from git ( dev & bun only )
```bash
git clone https://github.com/Rising-Corporation/create-next-pro-cli.git
bun install
bun dev
```
- then Global ( on your machine )
```bash
bun link create-next-pro-cli
create-next-pro my-next-project
```
### From npm (via bunx , npx ... or global install)
```bash
bunx create-next-pro-cli # to try without install
```
- or
```bash
bun install -g create-next-pro-cli #βΉοΈ
```
> βΉοΈ To enable autocompletion automatically, add the `--trust` option when installing globally with Bun:
>
> ```bash
> bun install -g create-next-pro-cli --trust
> ```
> Otherwise, run the autocompletion install script from binary manually:
>
> ```bash
> bash install.sh
> ```
> Or add the autocompletion line to your `.bashrc`/`.zshrc` :
>
> ```bash
> source ~/.bun/install/global/node_modules/create-next-pro-cli/create-next-pro-completion.sh
> ```
>
> Then restart your terminal or run
>
> ```bash
> source ~/.bashrc
> ```
>
> ||
>
> ```bash
> source ~/.zshrc
> ```
## π£οΈ Roadmap in coming for beta v0.2.0
- [ ] Implementation of interactive prompts
- [ ] Create library features
- [ ] Create API features
- [ ] Generation of `.env.*`
- [ ] Multi-platform testing (`bunx`, `link`, `npm`, etc.)
- [ ] Additional Components templates (admin panel, landing page, etc.)
- [Β ] Auto deployment to Vercel
## π¨βπ» Author
MrRise@RisingCorporation
Made with β€οΈ and Bun π