# npm-crud

> Crud Generator with Prisma Mysql And Express Js with validation

Latest version **2.1.1** (published 2023-09-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install npm-crud
pnpm add npm-crud
yarn add npm-crud
bun add npm-crud
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2023-09-28 |
| First published | 2023-09-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ritesh Singh |
| Maintainers | imritesh |
| Keywords | Crud, Generator |

## Links

- npm: https://www.npmjs.com/package/npm-crud
- npm.io page: https://npm.io/package/npm-crud

## Recent versions

- 2.1.1 (latest) — 2023-09-28
- 2.1.0 — 2023-09-27
- 2.0.0 — 2023-09-27
- 1.2.0 — 2023-09-27
- 1.0.0 — 2023-09-26
- 0.1.3 — 2023-09-26
- 0.1.2 — 2023-09-26
- 0.1.1 — 2023-09-26
- 0.1.0 — 2023-09-26

## README

# A Express, Prisma Crud Generator

### This package usage express-validator for validation


## Installation 

``` npm install npm-crud --save-dev ```

## Usage 

This package generates crud from a `schema.json`

### Sample `schema.json`

Please note schema.json

```
{
    "databaseType":"mysql" // "postgres",
    "relationShipMode":"prisma", // null
    "schemaFileLocation":"schema/prisma", // schema file location,
    "validationsDirectory":"src/validations",
    "controllersDirectory":"src/controllers",
    "servicesDirectory":"src/controllers",
    "dtosDirectory":"src/dtos",
    "tables":[
        {
            "name":"users", // table name
            "columns":[
                {
                    "name":"name",
                    "type":"string",
                    "validations":"required|max:255|min:200|string"
                },
                {
                    "name":"timestamps" // this will generate two fields , createdAt , updatedAt
                }
            ]
        },
        {
            "name":"userLogins",
            "columns":[
                {
                    "name":"userId",
                    "type":"Int",
                    "relationField":{
                        "type":"belongsTo",
                        "table":"users",
                        "isNull":false
                    }
                },
                {
                    "name":"token",
                    "type":"string",
                    "unique":true,
                    "validations":"required|max:255|min:200|string"
                }
            ]
        }
    ]
}
```
## Usage

> Basic Usage:

```node node_modules/npm-crud/src/index.js ```

> Alternate Usage:

#### You can add one simple script in package.json

```
{
   "scripts": {
    "generate:crud": "node node_modules/npm-crud/src/index.js"
  },
}
```

## Roadmap

[x] Handle Prisma Relations in the schema

[x] Handle Prisma Relations in the services as well

---
_Source: https://npm.io/package/npm-crud · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
