create-node-app-cli
is a powerful CLI tool that helps developers quickly scaffold a Node.js project with integrated database configuration, ORM setup, and optional TypeScript support. The tool also includes support for popular frameworks such as Express, Fastify, and Nest, as well as built-in Swagger documentation configuration for API development.
- Framework Choices: Select from popular Node.js frameworks like Express, Fastify, and Nest.
- Database Integration: Set up MongoDB, PostgreSQL, or MySQL with ease.
- ORM Support: Automatically configure ORM like Mongoose, Prisma, or DrizzleORM.
- TypeScript or JavaScript: Choose whether to set up the project with TypeScript or JavaScript.
- Swagger Documentation: Automatically includes Swagger API docs setup with customizable folder structure for your APIs endpoint and Schemas.
- Linting and Formatting: Integrated ESLint and Prettier setup for code quality.
-
Environment Configuration: Pre-configured
.env
sample file for setting up environment variables. - Robust Error Handler: Returns a structured JSON response that directly points to where the error originates.
{
"success": false,
"message": "Directly pointing to where the error is coming from"
}
Make sure you have the following installed:
- Node.js (v14 or higher)
- npm
You can install create-node-app-cli
via npx:
npx create-node-app-cli@latest new
After running the command, follow the prompts to configure your project you'll be asked to select: Framework: Express, Fastify, or Nest. Database: MongoDB, PostgreSQL, or MySQL. ORM: Mongoose, Prisma, or DrizzleORM. TypeScript or JavaScript.
The CLI generates a project with the following folder structure
my-app/
│
├── src/
│ ├── controllers/
│ ├── routes/
│ ├── mails/
│ ├── middleware/
| | └── async-error.ts/
| | └── error.ts/
│ ├── services/
│ ├── schemas/
│ ├── swagger-docs/
│ │ ├── swagger-api-docs/
| | | ├── sample-api.yaml
│ │ └── swagger-schema-docs/
| | | ├── sample-schema.yaml
│ └── utils/
| | ├── db.ts
| | ├── error-handler.ts
│ └── app.ts
| └── server.ts
├── .env.sample
├── .gitignore
├── package.json
├── tsconfig.json (if using TypeScript)
└── README.md
The project includes built-in Swagger documentation configuration to help you document and visualize your API. By default, the Swagger docs are available at:
/api-docs
You can configure your environment by copying the .env.sample file to .env and setting the appropriate values for your project.
cp .env.sample .env
Here are some useful npm scripts to help you manage the project:
-
Start the development server:
npm run dev
-
Build the project:
npm run build
-
Lint your code:
npm run lint
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (git checkout -b feature-branch).
- Commit your changes (git commit -m 'Add some feature').
- Push to the branch (git push origin feature-branch).
- Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.