express-generator-esm-cli
v1.0.5
Published
A modern, lightweight CLI tool to generate Express.js projects configured with native ES Modules (ESM), EJS view engine, and modern tooling.
Maintainers
Readme
Express ESM Generator CLI 🚀
A modern, lightweight, and developer-friendly CLI tool to generate Express.js web applications configured out-of-the-box with Native ES Modules (ESM), EJS Layouts, Bootstrap 5, and high-performance tooling (Oxlint & Oxfmt).
✨ Features
- ⚡ Native ES Modules: Fully configured with
"type": "module"for modern JavaScript syntax. - 🎨 EJS & EJS Layouts: Pre-configured view engine with reusable layout support.
- 💄 Bootstrap 5 UI: Styled homepage and built-in modern 404 error page.
- 🛠️ Oxidation Tooling: Blazing-fast code linting (
oxlint) and formatting (oxfmt). - 📁 Clean & Scalable Architecture: Organized directory structure (
routes,controllers,config,views,public). - 🔑 Automatic Env Setup: Automatically creates
.envfrom.env.example. - 🛡️ Custom 404 Handling: Built-in 404 route handling for web views and API endpoints.
🚀 Quick Start
Generate a new Express ESM project instantly using npx:
npx express-generator-esm-cli my-appInstallation & Execution
# Navigate to the generated directory
cd my-app
# Install dependencies
npm install
# Start development server with live reload
npm run devYour app will be running at http://localhost:3000.
💻 CLI Options & Usage
npx express-generator-esm-cli <project-name> [options]| Option | Shortcut | Description |
| :--- | :--- | :--- |
| --help | -h | Display CLI usage and help information |
| --force | -f | Overwrite target directory if it already exists |
Examples
# Generate app in a specific folder
npx express-generator-esm-cli my-api-service
# Generate app in current working directory
npx express-generator-esm-cli .
# Force overwrite an existing directory
npx express-generator-esm-cli my-app --force📁 Generated Project Architecture
my-app/
├── public/ # Static assets (CSS, JS, images)
│ └── css/
│ └── app.css
├── src/
│ ├── config/ # View & app configurations
│ │ └── view.js
│ ├── controllers/ # Application logic & request handlers
│ │ └── welcome.controller.js
│ ├── routes/ # Route declarations
│ │ ├── api.routes.js
│ │ └── web.routes.js
│ ├── utils/ # Helper utilities & standard API responses
│ │ └── response.js
│ ├── views/ # EJS templates
│ │ ├── layouts/
│ │ │ └── main.ejs # Base HTML layout
│ │ └── pages/
│ │ ├── home.ejs # Homepage view
│ │ └── 404.ejs # 404 Error page view
│ ├── app.js # Express application setup & middleware
│ └── server.js # HTTP Server entry point
├── .env # Environment variables (Auto-copied)
├── .env.example # Example environment template
├── .oxfmtrc.json # Oxfmt formatting rules
├── .oxlintrc.json # Oxlint linting rules
└── package.json # Node.js project manifest & scripts📜 Available NPM Scripts
In your generated project directory, you can run:
| Command | Description |
| :--- | :--- |
| npm run dev | Starts the server with nodemon for auto-reloading |
| npm run lint | Runs oxlint to check for code quality issues |
| npm run lint:fix | Automatically fixes linting errors with oxlint |
| npm run fmt | Formats all code files using oxfmt |
| npm run fmt:check | Verifies code formatting status |
📄 License
This project is licensed under the MIT License.
