nest-starter-crud
v1.0.3
Published
**`nest-starter-crud`** package:
Downloads
27
Readme
nest-starter-crud package:
🌟 Nest Starter CRUD 🚀
A CLI tool to automate CRUD operations in NestJS. Easily generate a module, service, controller, DTOs, and entity files with just one command!
📌 Features
✅ Auto-generates CRUD structure (Module, Service, Controller, DTOs)
✅ Uses NestJS built-in generator for proper file structuring
✅ Automatically updates app.module.ts
✅ Supports custom entity names
✅ Saves development time
📦 Installation
Install the package globally:
npm install -g nest-starter-crud🚀 Usage
To generate a new CRUD module, simply run:
nest-starter-crud --name usersThis will create:
📂 src/users
┣ 📜 users.module.ts
┣ 📜 users.service.ts
┣ 📜 users.controller.ts
┣ 📜 dto/create-users.dto.ts
┣ 📜 dto/update-users.dto.ts
┗ 📜 entities/users.entity.ts🔹 The users module will also be automatically registered in app.module.ts!
📖 Example
After running nest-starter-crud --name users, your users.service.ts will include basic CRUD methods like:
@Injectable()
export class UsersService {
private users = [];
findAll() {
return this.users;
}
findOne(id: string) {
return this.users.find((user) => user.id === id);
}
create(userDto: CreateUsersDto) {
this.users.push(userDto);
return userDto;
}
update(id: string, updateUserDto: UpdateUsersDto) {
return `User ${id} updated!`;
}
remove(id: string) {
return `User ${id} deleted!`;
}
}🔧 Options
| Command | Description |
| ----------------------------------- | ---------------------------------------- |
| nest-starter-crud --name users | Creates a users module with CRUD setup |
| nest-starter-crud --name products | Creates a products module with CRUD |
🤝 Contributing
Feel free to open an issue or submit a pull request. Contributions are welcome! 🎉
📜 License
This project is MIT Licensed.
Now your package has a beautiful and detailed README! 🚀 Let me know if you need any modifications. 😊
