create-next-pro-cli
Version:
Advanced Next.js project scaffolder with i18n, Tailwind, App Router and more.
324 lines (262 loc) β’ 8.7 kB
Markdown

> β οΈ This project is under active development and currently in beta testing. 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
```
### 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
β β βββ user_info.json
β βββ en.ts
β βββ fr
β β βββ dashboard.json
β β βββ _global_ui.json
β β βββ _home.json
β β βββ login.json
β β βββ register.json
β β βββ settings.json
β β βββ user_info.json
β βββ fr.ts
β βββ getMergedMessages.ts
βββ middleware.ts
βββ next.config.ts
βββ next-env.d.ts
βββ package.json
βββ postcss.config.mjs
βββ public
β βββ cnp-logo.ico
β βββ cnp-logo.png
β βββ cnp-logo.svg
β βββ file.svg
β βββ globe.svg
β βββ next.svg
β βββ vercel.svg
β βββ window.svg
βββ README.md
βββ src
β βββ app
β β βββ api
β β β βββ auth
β β β β βββ [...nextauth]
β β β β β βββ route.ts
β β β β βββ [...nextauth].ts
β β β β βββ post-login
β β β β βββ route.ts
β β β βββ me
β β β βββ 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
β β β βββ user_info
β β β βββ loading.tsx
β β β βββ page.tsx
β β βββ not-found.tsx
β β βββ page.tsx
β β βββ sitemap.ts
β β βββ styles
β β βββ globals.css
β βββ auth.config.ts
β βββ config.ts
β βββ lib
β β βββ auth
β β β βββ isConnected.ts
β β βββ i18n
β β βββ navigation.ts
β β βββ request.ts
β β βββ routing.ts
β βββ ui
β βββ dashboard
β β βββ page.tsx
β β βββ StatsCard.tsx
β β βββ WelcomeCard.tsx
β βββ _global
β β βββ BackButton.tsx
β β βββ GlobalHeader.tsx
β β βββ GlobalMain.tsx
β β βββ LocaleSwitcher.tsx
β β βββ PublicNav.tsx
β β βββ UserNav.tsx
β βββ _home
βββ tailwind.config.ts
βββ tsconfig.json
```
## β
Main Features
- Interactive CLI via `bun` or `bunx`
- Supports:
- TypeScript
- ESLint
- Tailwind CSS
- App Router (with or without `src/`)
- i18n (`next-intl`)
- Turbopack / Webpack
- Custom aliases (`@/*`, `@core/*`, etc.)
- Automatic generation:
- Folders
- Base pages: `page.tsx`, `layout.tsx`, `loading.tsx`, `not-found.tsx`, `error.tsx`
- `.env`, `.env.local`, `.env.production`, etc.
- Clean i18n structure: `/messages/en/*.json`, `/lib/i18n/`
## π CLI Structure
```plaintext
create-next-pro/
.
βββ bin.ts # CLI entry point (#!/usr/bin/env bun)
βββ bun.lock
βββ create-next-pro-completion.sh # Auto completion for source
βββ FONCTIONALITY.md
βββ install.sh
βββ package.json # Binary declaration
βββ README.md
βββ src
β βββ index.ts # Interactive logic (prompts, generation)
β βββ logo.svg
β βββ scaffold-dev.ts
β βββ scaffold.ts
βββ tsconfig.json # Bun/TypeScript config
```
## π Install & Usage
### Local from git (dev)
```bash
bun install
bun dev
```
### Global (on your machine)
```bash
bun link create-next-pro-cli
create-next-pro my-next-project
```
### From another PC (via bunx or global install)
```bash
bunx create-next-pro-cli # to try without install
# or
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
> ```
## π£οΈ Roadmap
- [x] Bun config + `tsconfig.json`
- [x] `bin.ts` CLI entry point
- [x] CLI project structure `src/index.ts`
- [ ] Implementation of interactive prompts
- [x] Basic Next.js project scaffolding
- [x] CLI file/page generation
- [x] Custom alias support
- [x] Next-auth with custom cookies
- [x] Full `next-intl` support with `lib/i18n/` and `messages/`
- [ ] Generation of `.env.*`
- [ ] Multi-platform testing (`bunx`, `link`, `npm`, etc.)
- [x] Publish to npm or Bun registry
## β¨ Coming Soon
- Additional Components templates (admin panel, landing page, etc.)
- Library templates
- API templates
- Prettier / Husky / Commitlint integration
- Auto deployment to Vercel
## π¨βπ» Author
MrRise@RisingCorporation
Made with β€οΈ and Bun π