Profile Picture9535347011412

useGenerated

$249
5 ratings

CLI that lets you build a fully customizable CRUD GraphQL API in minutes not weeks.

  1. Define your data models
  2. Describe your API in a config file
  3. Run a command that auto-generates all the code

Tech stack : Prisma ORM + NestJS


Extract from README.md

Getting started - Initial setup

1. Create a NestJs App npm i -g @nestjs/cli and nest new project-name,

2. replace the package.json with the one received with this module

3. Add the use-generated-cli folder at the same level as the NestJs app and run yarn or npm install

4. Run yarn use-generated init


Developing workflow

1. Define your models in prisma/schema.prisma.

Please make sure you have a postgres database created and it matches .env config for more info please consult Prisma docs[https://pris.ly/d/prisma-schemaaccessing-environment-variables-from-the-schema]).

2. Create and apply prisma migrations yarn prisma migrate dev.

This will also regenerate prisma client and the NestJs GraphQL types in the src/@generated folder based on the generator.

3. Define your api in use-generated-config/appconfig.json.

You could use the config from use-generated-config/appconfig_example.json along with copying the contents of use-generated-config/schema.prisma__example to prisma/schema.prisma as a working starting point. Also if auth module is used make sure you have SALT and JWT_SECRET in .env defined as per .env__example


4. Run yarn use-generated api to generate the api

5. Run yarn start:dev to start the development server


GraphQL API and props

With this CLI you will be able to create a fully customizable and extendable Graphql CRUD API just by defining the database or data models and a configuration file

Resolvers

1. allUsers- accepts properties:

- perPage- used for pagination

- skip- used for pagination

- orderBy sorting / ordering, matches the Prisma ORM orderBy API

- where filtering matches the Prisma ORM where

- nestedArgs defines the perPage, skip,`orderBy` and where for the nested relations


Config example



Add to cart

CLI that lets you build a fully customizable CRUD GraphQL API in minutes not weeks.

Copy product URL

Ratings

5.0
(5 ratings)
5 stars
100%
4 stars
0%
3 stars
0%
2 stars
0%
1 star
0%
$249

useGenerated

5 ratings
Add to cart