CRUDGen
🚀 Generate Express + MySQL CRUD controllers and routes instantly from a MySQL CREATE TABLE statement.
CRUDGen helps backend developers quickly scaffold REST APIs without writing repetitive boilerplate code.
✨ Features
- 📥 Paste a MySQL
CREATE TABLE statement
- 📂 Choose target folder (existing project supported)
- ⚡ Auto-generate:
controllers/<table>.controller.js
routes/<table>.routes.js
- 🔍 Automatically detects PRIMARY KEY
- 🧠 Smart SQL parsing (supports common MySQL syntax)
- 🛠 Works inside existing Express projects
🖥 How To Use
- Open your backend project folder in VS Code
- Press:
Ctrl + Shift + P
- Run:
CRUDGen: Generate CRUD from Pasted SQL (MySQL + Express)
- Paste your MySQL
CREATE TABLE statement
- Select the target folder
- Done 🎉 — Controllers and routes are generated automatically
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100),
email VARCHAR(100),
password VARCHAR(255),
PRIMARY KEY (id)
);
📁 Generated Output
controllers/users.controller.js
routes/users.routes.js
The generated controller includes:
create
getAll
getById
updateById
deleteById
All using mysql2/promise.
⚙ Requirements
Your project should include:
Node.js
Express
mysql2
Example db.js (ES Modules):
import mysql from 'mysql2/promise';
const db = mysql.createPool({
host: 'localhost',
user: 'root',
password: 'password',
database: 'your_database'
});
export default db;
🧠 Supported SQL Features
INT, BIGINT
VARCHAR, TEXT
DECIMAL
DATETIME / TIMESTAMP
BOOLEAN
ENUM
PRIMARY KEY
FOREIGN KEY (ignored in controller generation)
🚀 Roadmap
TypeScript output option
Service layer generation
Model generation
Multi-table generation
Input validation scaffolding
OpenAPI/Swagger generation
🛡 License
MIT License
👨💻 Author
Suraj Patidar
GitHub: https://github.com/surajpatidar1
If you find this extension helpful, consider giving it a ⭐ on GitHub.
| |