create-smart-api
v4.2.0
Published
CLI to generate production-ready Node.js APIs with CRUD, auth, validation, testing and microservices
Downloads
820
Maintainers
Readme
📦 create-smart-api — Smart Node.js Backend Generator
A powerful CLI toolkit to generate production-ready Node.js REST APIs with advanced scaffolding, interactive schema builder, and database integration.
🚀 What’s New 🔥
- 🧠 Interactive Schema Builder
- 📊 Table Preview before model creation
- ✏️ Edit / Add / Delete fields dynamically
- ⚡ Bulk field input support
- 🔍 Auto typo correction (string, boolean, etc.)
- 🧩 Supports Sequelize & Mongoose models
- 📁 Auto
.env+ DB config generation - 🔄 Real DB-connected CRUD APIs (not dummy)
🚀 Features
- Express.js or Fastify support
- CommonJS & ES Modules
- Clean architecture (Controller / Service / Model / Route)
- Smart CRUD generator
- JWT authentication
- Validation (Zod/Joi)
- Jest testing setup
- Swagger/OpenAPI docs
- Plugin system
📦 Installation
Run with npx (recommended)
npx create-smart-api create my-apiOr install globally
npm install -g create-smart-api⚡ Quick Start
create-smart-api create my-apiFollow CLI prompts:
Project name
Framework (Express / Fastify)
Module system (CommonJS / ESM)
Database:
- MongoDB (Mongoose)
- MySQL (Sequelize)
- MSSQL (Sequelize)
Generate CRUD module
Port
🧠 Smart CRUD Generator (🔥 Highlight Feature)
create-smart-api generate:crud user✨ Step 1: Bulk Field Input
name:string,email:string,age:number,status:enum✨ Step 2: Field Enhancements
- Required
- Unique
- Default values
- Enum values
📊 Step 3: Table Preview
📊 Schema Preview
┌───┬─────────┬────────┬─────┬─────┬─────────┬────────────────────┐
│ # │ Field │ Type │ Req │Uniq │ Default │ Extra │
├───┼─────────┼────────┼─────┼─────┼─────────┼────────────────────┤
│ 1 │ name │ string │ ✔ │ ✖ │ - │ - │
│ 2 │ email │ string │ ✔ │ ✔ │ - │ - │
│ 3 │ status │ string │ ✖ │ ✖ │ active │ enum(active,inact) │
└───┴─────────┴────────┴─────┴─────┴─────────┴────────────────────┘✏️ Step 4: Edit Before Confirm
Options:
- Edit field
- Add new field
- Delete field
- Continue
🧩 Database Support
🟢 Sequelize (MySQL / MSSQL)
- Auto model generation
- Proper type mapping
- Validation & constraints
🟢 Mongoose (MongoDB)
- Schema-based model
- Enum support
- Default values
- Ready-to-use models
📁 Generated Structure
my-api/
├── src/
│ ├── controllers/
│ ├── services/
│ ├── models/
│ ├── routes/
│ ├── middleware/
│ ├── config/
│ ├── server.js
├── .env
└── package.json⚙️ CLI Commands
Create project
create-smart-api create my-apiGenerate CRUD
create-smart-api generate:crud userGenerate Auth
create-smart-api generate:authGenerate Service
create-smart-api generate:serviceGenerate Validation
create-smart-api generate:validation userGenerate Tests
create-smart-api generate:test userGenerate Swagger Docs
create-smart-api generate:swagger🧪 Testing
npm test⚠️ Important Note
If no models are created:
⚠️ Project created successfully, but no models were generated.
Database operations and related features may not work.
👉 Run:
create-smart-api generate:crud <module-name>🔌 Plugin System
create-smart-api plugin install redis🗺️ Roadmap
- Relations (1:1, 1:N, N:N)
- GraphQL generator
- Redis cache support
- Microservices support
- AI-based API generation
🤝 Contributing
- Fork repo
- Create feature branch
- Add tests
- Submit PR
📄 License
MIT
👨💻 Author
Created by Chirag Chauhan
⭐ Star the repo if you like it!
