A powerful CLI tool designed to rapidly scaffold production-ready Node.js Express.js applications. 🚀 It streamlines project setup with customizable options for language (JavaScript/TypeScript), database (PostgreSQL/MongoDB), and essential services like email and Redis, ensuring best practices and a standardized structure from day one.
- Interactive Project Generation: Guided prompts for project name, language, database, and additional services.
- Language Support: Choose between JavaScript (
.js) or TypeScript (.ts) for all generated source files. - Database Integration: Seamless setup for PostgreSQL (with Drizzle ORM) or MongoDB (with Mongoose ODM), or no database option.
- Service Inclusion: Optionally integrate Nodemailer for email services and Redis for caching/rate-limiting.
- Standardized Structure: Generates a well-organized
srcdirectory with dedicated folders forconfig,models,utils,controllers,middlewares, androutes. - Core Dependencies: Automatically includes essential packages like
express,cors,morgan,jsonwebtoken,bcryptjs,helmet,dotenv, and more. - Configuration Best Practices: Sets up environment variables, JWT for authentication, a robust logging system, and a production-ready server boilerplate.
- ES Modules First: All generated code adheres to ES module syntax, avoiding CommonJS
require()statements. - Package Manager Auto-Detection: Intelligently suggests the package manager used to initiate the CLI.
Follow these steps to get create-xpress-server up and running on your local machine.
-
Clone the Repository:
git clone https://github.com/amnesia2k/create-xpress-server.git cd create-xpress-server -
Install Dependencies:
npm install # or pnpm install or bun install -
Link the CLI (for local development/testing):
npm link # or pnpm link or bun link
For users looking to scaffold a new project, create-xpress-server can be used globally or via npx without prior installation:
Global Installation (Recommended for frequent use):
npm install -g create-xpress-server@latest
# or
pnpm install -g create-xpress-server@latest
# or
bun install -g create-xpress-server@latestOne-Time Usage:
npx create-xpress-server@latest
# or
pnpm dlx create-xpress-server@latest
# or
bunx create-xpress-server@latestOnce installed globally, simply run the create-xpress-server command in your terminal from the directory where you want to create your new Express.js project.
create-xpress-serverThe CLI will then guide you through a series of interactive prompts:
- Project Name: Enter the desired name for your new Express.js application. This will be the name of the directory created.
- Language Selection: Choose between
JavaScriptorTypeScript. All generated files will use the appropriate extension. - Database Choice: Select your preferred database:
PostgreSQL(with Drizzle ORM),MongoDB(with Mongoose ODM), orNoneif your project doesn't require a database. - Services: Multi-select additional services to include:
Email: Integrates Nodemailer with basic configuration.Redis: Sets up a Redis client for caching and rate-limiting.
- Package Manager: The CLI will auto-detect your current package manager (npm, pnpm, or bun) and suggest it, allowing you to confirm or choose another. This will be used for installing dependencies in your new project.
After your selections, the CLI will scaffold your new Express.js project with the chosen configurations and install all necessary dependencies.
| Category | Technology | Description |
|---|---|---|
| Core CLI | Node.js | JavaScript runtime for the CLI tool. |
| Commander.js | Node.js command-line interfaces. | |
| Inquirer.js | Interactive command-line user interfaces. | |
| Ora | Elegant terminal spinner. | |
| Chalk | Terminal string styling. | |
| Figlet.js | Creates ASCII art from text. | |
| Gradient String | Colors strings with gradients. | |
| Generated Project | Express.js | Fast, unopinionated, minimalist web framework. |
| (Core) | CORS | Middleware for enabling Cross-Origin Resource Sharing. |
| Morgan | HTTP request logger middleware. | |
| JSON Web Token (JWT) | For secure authentication and authorization. | |
| Cookie Parser | Parse Cookie header and populate req.cookies. |
|
| bcryptjs | Optimized bcrypt library for Node.js. | |
| node-cron | A simple cron job scheduler. | |
| Helmet | Security middleware for HTTP headers. | |
| dotenv | Loads environment variables from a .env file. |
|
| Generated Project | TypeScript | Strongly typed JavaScript (if selected). |
| (Optional) | PostgreSQL | Powerful open-source relational database. |
| Drizzle ORM | TypeScript ORM for SQL databases. | |
| Postgres.js | Fast, full-featured PostgreSQL client. | |
| Drizzle Kit | Migrations and schema management for Drizzle. | |
| MongoDB | NoSQL, document-oriented database. | |
| Mongoose | MongoDB object data modeling (ODM). | |
| Nodemailer | Send e-mails with Node.js. | |
| Redis | Open source, in-memory data structure store. |
We welcome contributions to create-xpress-server! If you have suggestions for improvements, new features, or bug fixes, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name. - Make your changes, ensuring they adhere to the project's code style.
- Test your changes thoroughly to prevent regressions.
- Commit your changes with clear and concise messages.
- Push your branch to your forked repository.
- Open a Pull Request against the
mainbranch of this repository, describing your changes in detail.
This project is licensed under the MIT License.
Olatilewa Olatoye
- GitHub: amnesia2k
- X: @olathedev_
- LinkedIn: Olatilewa Olatoye