Installation
Install the core package along with its required peer dependencies:Required Dependencies
Peer Dependencies
The package requires the following peer dependencies:- class-transformer - Used for transforming plain objects to class instances and vice versa
- class-validator - Used for validation decorators and validation logic
Automatic Dependencies
The following packages are automatically installed as dependencies:@nestjsx/crud-request- Request parsing and query builder functionality@nestjsx/util- Shared utility functionsdeepmerge- Deep merging configuration objectspluralize- Pluralization of resource names
Quick Setup
After installation, you can start using the@Crud() decorator in your controllers:
While you can use
@nestjsx/crud on its own, you’ll typically want to install a database integration package like @nestjsx/crud-typeorm to handle actual CRUD operations.Global Configuration (Optional)
You can configure CRUD behavior globally in your application:Verification
To verify the installation, check that you can import from the package:Next Steps
TypeORM Integration
Install TypeORM integration for database operations
Build Your First API
Follow the quickstart guide
Troubleshooting
Missing Peer Dependencies
If you see warnings about missing peer dependencies, make sure you’ve installed bothclass-transformer and class-validator:
TypeScript Errors
Ensure yourtsconfig.json has the following settings: