{"id":14978657,"url":"https://github.com/kepelrs/nestjs-prisma-crud","last_synced_at":"2025-05-16T11:06:17.426Z","repository":{"id":36992332,"uuid":"371470424","full_name":"kepelrs/nestjs-prisma-crud","owner":"kepelrs","description":"CRUD package for NestJS and Prisma ORM","archived":false,"fork":false,"pushed_at":"2025-05-12T19:12:41.000Z","size":8443,"stargazers_count":153,"open_issues_count":23,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-12T20:31:32.531Z","etag":null,"topics":["crud","nest","nestjs","prisma","prisma2","rest-api","scaffold","scaffolding","typescript"],"latest_commit_sha":null,"homepage":"https://kepelrs.github.io/nestjs-prisma-crud","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kepelrs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-05-27T18:36:47.000Z","updated_at":"2025-04-22T03:16:29.000Z","dependencies_parsed_at":"2023-09-24T08:14:39.884Z","dependency_job_id":"cb8f6509-dfe2-4a4a-b233-99cd84e49315","html_url":"https://github.com/kepelrs/nestjs-prisma-crud","commit_stats":{"total_commits":933,"total_committers":3,"mean_commits":311.0,"dds":0.3311897106109325,"last_synced_commit":"0b5aca8d974c829018c2260e4ed5cb0c985ba7c6"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kepelrs%2Fnestjs-prisma-crud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kepelrs%2Fnestjs-prisma-crud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kepelrs%2Fnestjs-prisma-crud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kepelrs%2Fnestjs-prisma-crud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kepelrs","download_url":"https://codeload.github.com/kepelrs/nestjs-prisma-crud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253818072,"owners_count":21969105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crud","nest","nestjs","prisma","prisma2","rest-api","scaffold","scaffolding","typescript"],"created_at":"2024-09-24T13:58:08.909Z","updated_at":"2025-05-16T11:06:12.405Z","avatar_url":"https://github.com/kepelrs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv\u003e\n\u003ca href=\"https://github.com/kepelrs/nestjs-prisma-crud/actions/workflows/tests.yml\"\u003e\n\u003cimg src=\"https://github.com/kepelrs/nestjs-prisma-crud/actions/workflows/tests.yml/badge.svg\" alt=\"build\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://codeclimate.com/github/kepelrs/nestjs-prisma-crud/maintainability\"\u003e\n\u003cimg src=\"https://api.codeclimate.com/v1/badges/d5807bc933d427ef4c61/maintainability\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://codecov.io/gh/kepelrs/nestjs-prisma-crud\"\u003e\n\u003cimg src=\"https://codecov.io/gh/kepelrs/nestjs-prisma-crud/branch/master/graph/badge.svg?token=X2KQ8AMFA7\" alt=\"codecov\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://www.npmjs.com/package/nestjs-prisma-crud\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/dm/nestjs-prisma-crud.svg\" alt=\"npm downloads\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/kepelrs/nestjs-prisma-crud/blob/master/package.json\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/dependencies-2-brightgreen\" alt=\"Dependencies\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/kepelrs/nestjs-prisma-crud/blob/master/LICENSE\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/kepelrs/nestjs-prisma-crud.svg\" alt=\"License\" /\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n\n# nestjs-prisma-crud\n\nCRUD utility for simple REST use cases. Builds on top of [NestJS](https://github.com/nestjs/nest) and [Prisma](https://github.com/prisma/prisma). Inspired by [@nestjsx/crud](https://github.com/nestjsx).\n\n## Installation\n\n    npm i nestjs-prisma-crud --save\n    npm i nestjs-prisma-crud-schematics --save-dev\n\n## Why\n\nWhen building REST API's there is common functionality that we would prefer not to implement again and again. This package offers minimal and opinionated out of the box solutions for some of those (see [features](#features) below).\n\n## ✔ Features\n\nAn overview of the provided functionality:\n\n1. Advanced client side **joining**, **sorting**, **filtering** and **pagination** via query parameters\n    - Any valid prisma `.where` can be sent by the frontend.\n    - Server side validation to safeguard against arbitrarily deep `.join` or `.where` clauses by clients.\n    - Support for including only specific properties in the response.\n2. Access control\n    - `@AccessPolicy` decorator with default utilities that support functionalities similar to [RBAC](https://en.wikipedia.org/wiki/Role-based_access_control)/[ABAC](https://en.wikipedia.org/wiki/Attribute-based_access_control).\n    - Custom policy support.\n3. Atomic operations\n    - Supports POST/PATCH with nested objects.\n    - Transaction support when extending controller functionality.\n4. Schematics\n    - `crud-resource`: a modified NestJS `resource` schematic that scaffolds the entire CRUD module for you.\u003cbr/\u003e One-line scaffolding with: _`nest g -c nestjs-prisma-crud-schematics crud-resource \u003cYOUR-TABLE-NAME-HERE\u003e`_\n5. Plug and play\n    - Can be used alongside your other non `nestjs-prisma-crud` controllers.\n    - You can still use `PrismaCrudService` and `@AccessPolicy` in your custom controllers if you want to retain some of `nestjs-prisma-crud`'s functionalities.\n\n## Quickstart\n\n\u003e Assumes both NestJS and Prisma2 are already setup. See [Getting Started](https://kepelrs.github.io/nestjs-prisma-crud/getting-started).\n\n1. Install `nestjs-prisma-crud` and `nestjs-prisma-crud-schematics`:\n\n    ```\n    npm i nestjs-prisma-crud\n    npm i nestjs-prisma-crud-schematics --save-dev\n    ```\n\n2. Generate the entire crud module with a single command (replace **post** with your model's name):\n\n    ```\n    nest g -c nestjs-prisma-crud-schematics crud-resource post\n    ```\n\n3. Setup your service and controller\n\n    ```ts\n    // post.service.ts\n    import { Injectable } from '@nestjs/common';\n    import { PrismaCrudService } from 'nestjs-prisma-crud';\n\n    @Injectable()\n    export class PostService extends PrismaCrudService {\n        constructor() {\n            super({\n                model: 'post',\n                allowedJoins: ['comments.author'],\n            });\n        }\n    }\n\n    // post.controller.ts\n    import { PostService } from './post.service';\n\n    @Controller('post')\n    export class PostController {\n        constructor(private readonly postService: PostService) {}\n\n        @Get()\n        async findMany(@Query('crudQuery') crudQuery: string) {\n            const matches = await this.postService.findMany(crudQuery);\n            return matches;\n        }\n    }\n    ```\n\n## Documentation\n\nGo [here](https://kepelrs.github.io/nestjs-prisma-crud/) for full documentation.\n\n## License\n\n[MIT licensed](LICENSE)\n\n## Built with\n\n[TSDX](https://github.com/formium/tsdx)\u003cbr\u003e\n[np](https://github.com/sindresorhus/np)\u003cbr\u003e\n[yarn 1.22.10](https://yarnpkg.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkepelrs%2Fnestjs-prisma-crud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkepelrs%2Fnestjs-prisma-crud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkepelrs%2Fnestjs-prisma-crud/lists"}