1.0.0 • Published 8 months ago

lutfiwd-backend-cli v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

Express Vue Boilerplate CLI

A CLI tool to generate Express.js backend boilerplate with MongoDB, JWT authentication, and Vue.js integration capabilities.

Features

  • Express.js backend setup
  • MongoDB integration with Mongoose
  • JWT Authentication
  • Role-based Authorization
  • Module generation system
  • Vue.js frontend integration ready
  • Environment configuration
  • Secure password hashing
  • Error handling middleware
  • CORS enabled

Installation

npm install -g lutfiwd-backend-cli

Usage

Create a New Project

npx lutfiwd-backend

Select "Start a new project" when prompted. This will create a new project with:

  • Basic Express.js setup
  • MongoDB connection
  • User authentication (register/login)
  • JWT middleware
  • Role-based authorization
  • Basic project structure

Create a New Module

npx lutfiwd-backend

Select "Create a new module" when prompted and provide the module name. This will generate:

  • Model
  • Controller
  • Service
  • Routes

Project Structure

├── config/
├── controllers/
│   └── auth.js
├── middleware/
│   └── auth.js
├── models/
│   └── User.js
├── routes/
│   └── auth.js
├── services/
├── .env
├── .env.example
└── server.js

Environment Variables

Copy .env.example to .env and update the values:

NODE_ENV=development
PORT=3000
MONGODB_URI=mongodb://localhost:27017/your_database
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRE=30d

API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login user

Protected Routes

All generated module routes are protected by default:

  • GET /api/{module} - Get all items
  • POST /api/{module} - Create new item
  • GET /api/{module}/:id - Get single item
  • PUT /api/{module}/:id - Update item
  • DELETE /api/{module}/:id - Delete item (admin only)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the ISC License.