Skip to main content

Intro

nestjs-prisma-crud is a minimal CRUD tool for NestJS projects that use Prisma for their database operations. It is inspired by the great work at @nestjsx/crud.

โœ” Features#

An overview of the provided functionality:

  1. Advanced client side joining, sorting, filtering and pagination via query parameters
    • Any valid prisma .where can be sent by the frontend.
    • Server side validation to safeguard against arbitrarily deep .join or .where clauses by clients.
    • Support for including only specific properties in the response.
  2. Access control
    • @AccessPolicy decorator with default utilities that support functionalities similar to RBAC/ABAC.
    • Custom policy support.
  3. Atomic operations
    • Supports POST/PATCH with nested objects.
    • Transaction support when extending controller functionality.
  4. Schematics
    • crud-resource: a modified NestJS resource schematic that scaffolds the entire CRUD module for you.
      One-line scaffolding with: nest g -c nestjs-prisma-crud-schematics crud-resource <YOUR-TABLE-NAME-HERE>
  5. Plug and play
    • Can be used alongside your other non nestjs-prisma-crud controllers.
    • You can still use PrismaCrudService and @AccessPolicy in your custom controllers if you want to retain some of nestjs-prisma-crud's functionalities.