Skip to content

amnesia2k/create-xpress-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-xpress-server: Your Express.js Project Scaffolding CLI

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.

Features ✨

  • 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 src directory with dedicated folders for config, models, utils, controllers, middlewares, and routes.
  • 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.

Getting Started 🚀

Follow these steps to get create-xpress-server up and running on your local machine.

Installation

  1. Clone the Repository:

    git clone https://github.com/amnesia2k/create-xpress-server.git
    cd create-xpress-server
  2. Install Dependencies:

    npm install # or pnpm install or bun install
  3. Link the CLI (for local development/testing):

    npm link # or pnpm link or bun link

Using the Published CLI

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@latest

One-Time Usage:

npx create-xpress-server@latest
# or
pnpm dlx create-xpress-server@latest
# or
bunx create-xpress-server@latest

Usage 💡

Once 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-server

The CLI will then guide you through a series of interactive prompts:

  1. Project Name: Enter the desired name for your new Express.js application. This will be the name of the directory created.
  2. Language Selection: Choose between JavaScript or TypeScript. All generated files will use the appropriate extension.
  3. Database Choice: Select your preferred database: PostgreSQL (with Drizzle ORM), MongoDB (with Mongoose ODM), or None if your project doesn't require a database.
  4. Services: Multi-select additional services to include:
    • Email: Integrates Nodemailer with basic configuration.
    • Redis: Sets up a Redis client for caching and rate-limiting.
  5. 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.

Technologies Used 🛠️

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.

Contributing 🤝

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 main branch of this repository, describing your changes in detail.

License 📄

This project is licensed under the MIT License.

Author Information 🧑‍💻

Olatilewa Olatoye


NPM Version License: MIT Node.js Version Built With Node.js

Readme was generated by Dokugen

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published