fast-express-gen v1.1.3
Fast Express Gen
š Fast Express Gen is a CLI tool designed to generate a complete Express.js boilerplate in seconds. It provides a robust starting point for backend development with pre-configured features like middleware, routing, and error handling. Now supports both JavaScript and TypeScript!
š Features
- Express.js Setup: Fully configured Express server with modular architecture.
- Middlewares: Pre-installed and configured middlewares for security, logging, and compression.
- Customization: Choose your project name and whether to use JavaScript or TypeScript.
- Developer-Friendly: Includes
nodemon
for hot-reloading and aREADME.md
template for your generated project.
š¦ Installation
You can use npx
to run the CLI directly or install it globally.
Using npx
npx fast-express-gen
Global Installation
npm install -g fast-express-gen
š ļø Usage
Create a New Project
Run the following command to generate your project:
fast-express-gen <project-name>
Example:
fast-express-gen my-awesome-api
You will then be prompted to select JavaScript or TypeScript for your project.
This will create a new directory my-awesome-api
with a ready-to-use Express.js boilerplate.
šļø Project Structure
Below is the structure of the generated project:
JavaScript Version
<project-name>/
āāā nodemon.json
āāā package.json
āāā README.md
āāā src/
āāā app.js
āāā controllers/
ā āāā homeController.js
āāā middleware/
ā āāā logger.js
āāā routes/
ā āāā index.js
āāā server.js
TypeScript Version
<project-name>/
āāā nodemon.json
āāā package.json
āāā tsconfig.json
āāā README.md
āāā src/
āāā app.ts
āāā controllers/
ā āāā homeController.ts
āāā middleware/
ā āāā logger.ts
āāā routes/
ā āāā index.ts
āāā server.ts
āļø Features in Detail
Security:
- Integrated
helmet
for secure HTTP headers. - CORS (Cross-Origin Resource Sharing) enabled for flexible API usage.
- Integrated
Error Handling:
- Centralized error handling middleware.
Logging:
- Request logging with
morgan
.
- Request logging with
Hot Reload:
- Pre-configured
nodemon
for live reloading during development.
- Pre-configured
⨠Example Output
Console
Welcome to fast-express-gen!
ā Project name: my-awesome-api
ā Choose your project language: TypeScript
Creating TypeScript project in /path/to/my-awesome-api...
Installing dependencies...
Your Express project is ready! š
Run the following commands to get started:
cd my-awesome-api
npm run dev
š¤ Contributing
Contributions are welcome! If you'd like to improve this tool, feel free to fork the repository and open a pull request.
š License
This project is licensed under the MIT License.
š¬ Questions or Feedback?
If you have any questions, suggestions, or feedback, please reach out to the repository owner. Happy coding! š