@franshiro/express-cli
v0.1.7
Published
cli for generate express template v2
Maintainers
Readme
@franshiro/express-cli
A powerful CLI tool for generating Express.js templates and managing modules with best practices and modern architecture.
Features
- 🚀 Quick project setup with Express.js
- 📦 Modern project structure
- 🔧 Built-in configuration templates
- 🛠️ Easy to use CLI interface
- 📝 Interactive project generation
- 📁 Module generation for existing projects
Installation
npm install -g @franshiro/express-cliUsage
After installation, run the CLI:
express-template-2You'll be presented with the following options:
- Create a new project
- Add new module to an existing project
- Cancel
Creating a New Project
When you choose "Create a new project", you'll be prompted to:
- Enter the project name (e.g., project-name)
The CLI will create a new Express.js project with the specified name.
Adding a New Module
When you choose "Add new module to an existing project", you'll be prompted to:
- Enter the module name (e.g., UserPayment)
After entering the module name, you'll have several options:
Create Custom File
- Choose whether to create a custom function file
- If yes, a custom function file will be created with example methods
Generate New Model
- Choose whether to generate a new model
- If yes, you'll be prompted to:
- Add columns in the format:
name:stringorprice:decimal(15,2) - Supported column types: string, integer, float, boolean, date, text, json, decimal
- Continue adding columns until you're done
- Add columns in the format:
- The CLI will automatically:
- Create a migration file
- Create a model file
- Add the model to the database models import
- Add API routes with CRUD operations and middleware
Just Create Files
- If you choose not to generate a model, the CLI will create:
- Service module file
- Controller module file
- Router module file
- If you choose not to generate a model, the CLI will create:
After module creation, you'll need to:
- Review and modify the generated migration and model files if needed
- Run migrations:
npm run db:migrate
Project Structure
The generated project will include:
project-name/
├── src/
│ ├── _utils/
│ ├── customFunctions/
│ ├── database/
│ ├── helpers/
│ ├── middlewares/
│ ├── validations/
│ ├── .babelrc
│ ├── index.js
├── .env.example
├── .gitignore
├── .sequelizerc
├── package.json
└── README.mdDependencies
- Node.js 14.x or higher
- npm 6.x or higher
Development
# Clone the repository
git clone https://github.com/yourusername/express-cli.git
# Install dependencies
npm install
# Run tests
npm testLicense
ISC © franshiromedia
