An open API service indexing awesome lists of open source software.

https://github.com/yousifpa98/fast-express-gen

A CLI tool that rapidly scaffolds a complete Express.js boilerplate with built-in middleware, modular routing, error handling, and hot-reloading support. Choose between JavaScript or TypeScript to kickstart your backend development with a secure and scalable setup.
https://github.com/yousifpa98/fast-express-gen

backend backend-api boilerplate express expressjs npm-package

Last synced: about 2 months ago
JSON representation

A CLI tool that rapidly scaffolds a complete Express.js boilerplate with built-in middleware, modular routing, error handling, and hot-reloading support. Choose between JavaScript or TypeScript to kickstart your backend development with a secure and scalable setup.

Awesome Lists containing this project

README

        

# 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 a `README.md` template for your generated project.

---

## 📦 Installation

You can use `npx` to run the CLI directly or install it globally.

### Using `npx`
```bash
npx fast-express-gen
```

### Global Installation
```bash
npm install -g fast-express-gen
```

---

## 🛠️ Usage

### Create a New Project
Run the following command to generate your project:
```bash
fast-express-gen
```

Example:
```bash
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**
```
/
├── nodemon.json
├── package.json
├── README.md
└── src/
├── app.js
├── controllers/
│ └── homeController.js
├── middleware/
│ └── logger.js
├── routes/
│ └── index.js
└── server.js
```

### **TypeScript Version**
```
/
├── 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

1. **Security**:
- Integrated `helmet` for secure HTTP headers.
- CORS (Cross-Origin Resource Sharing) enabled for flexible API usage.

2. **Error Handling**:
- Centralized error handling middleware.

3. **Logging**:
- Request logging with `morgan`.

4. **Hot Reload**:
- Pre-configured `nodemon` for live reloading during development.

---

## ✨ 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.

[GitHub](https://github.com/yousifpa98/fast-express-gen)

---

## 📝 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! 😊