create-next-xpres
is a CLI tool that helps you quickly set up a Next.js project integrated with an Express server. It simplifies the process of creating a full-stack JavaScript application by combining Next.js for the frontend, Express for the backend and MongoDB for Database preconfigured, with optional Tailwind CSS for styling.
root
directory.You can install create-next-xpres
globally to use it as a CLI tool:
npm install -g create-next-xpres@latest
Or use it directly with npx
:
npx create-next-xpres@latest
Run the CLI: Start by running the CLI command:
npx create-next-xpres@latest
Project Name: Enter the name of your project when prompted. If you don't enter a name, it will default to next-xpres-app
. If you enter .
, the files will be created in the current directory.
Tailwind CSS: Choose whether to include Tailwind CSS during the Next.js app setup.
Project Structure: The tool will create a project with the following structure:
your-project-name/
├── nextjs_app # Next.js app
├── index.js # Express server
├── connection.js # MongoDB Connection with Mongoose
├── package.json # Root package.json with Express dependencies
├── tailwind.config.js # Tailwind configuration (if Tailwind CSS is selected)
└── postcss.config.js # PostCSS configuration (if Tailwind CSS is selected)
Start the Project: After setup, navigate to the project folder and start the development server:
cd your-project-name
npm run dev # Starts the Next.js development server with express using nodemon
npm start # Starts the Next.js production server with express
$ npx create-next-xpres
? Enter the name of your project: my-app
? Do you want to use Tailwind CSS? Yes
Running: npx create-next-app@latest client --tailwind
...
Express server setup completed.
The package.json
includes the following scripts:
npm start
: Starts the Next.js development server Express server.npm run dev
: Starts the Next.js development server with Express server.MIT License
Contributions are welcome! Please open an issue or submit a pull request on GitHub.