crud Plugin for TSDIAPI
A TSDIAPI plugin that automatically generates CRUD (Create, Read, Update, Delete) REST API endpoints for your Prisma entities.
📌 About
This is a TSDIAPI plugin that serves as a code generator. It automatically creates fully functional CRUD REST API endpoints for your Prisma database entities. The generated code includes:
- Service layer with CRUD operations
- REST controllers with endpoints
- Type validation schemas
- Error handling
- JWT authentication integration
🔗 TSDIAPI CLI: @tsdiapi/cli
📦 Installation
You can install this plugin using npm:
tsdiapi add crud
🚀 Features
- 🛠 Automatic CRUD Generation - Generates complete CRUD API for any Prisma entity
- ⚡ REST Endpoints - Creates standard REST endpoints (GET, POST, PUT, DELETE)
- 🔒 Built-in Security - Includes JWT authentication
- 📝 Type Safety - Full TypeScript support with validation schemas
- 🔄 Pagination - Built-in support for list operations with pagination
- 🛡️ Error Handling - Comprehensive error handling and validation
🔧 Usage
To generate CRUD API for a Prisma entity, simply run:
tsdiapi generate crud <entityName>
Where <entityName>
is your Prisma model name (e.g., User, Product, Order).
The generator will create:
- Service layer with CRUD operations
- REST controllers with endpoints
- Type validation schemas
Generated Endpoints
For each entity, the following REST endpoints are created:
GET /
- List entities with paginationGET /:id
- Get entity by IDPOST /
- Create new entityPUT /:id
- Update entityDELETE /:id
- Delete entity
🔗 Related Plugins
You can find more TSDIAPI plugins here:
🔗 Available Plugins
👨💻 Contributing
Contributions are always welcome! If you have ideas for improving this plugin, feel free to open a pull request.
Author: unbywyd
GitHub Repository: https://github.com/unbywyd/tsdiapi-crud
📧 Contact: unbywyd@gmail.com
🚀 Happy coding with TSDIAPI! 🎉