/TypeGraphql-Prisma-Typescript

A prisma-typegraphQL-typescript starter template with minimal setup

Primary LanguageTypeScript

TypeGraphql-Prisma-Typescript Starter template.

TECH INSIDE

  • TypeGraphQL
  • Apollo-express-server v3
  • Prisma v4
  • Typescript v4.7
  • TypegraphQL-prisma extension.
  • nodemon (hmr). This does not uses ts-node-dev

Why to use prisma and typeGraphQL?

It is possible to make the graphql server with only typegraphql and prisma as our ORM but, typegraphql-prisma provides things like, auto-generated models, resolvers, InputTypes and much more in reference with our prisma schema. This helps to get started with stuff much faster. Although you may have to modify the model fields generated by TypegraphQL or you can also select the resolvers you may choose to expose.

This template was made as a minimal starter template for your graphql server. you may choose to tune it according to your needs.

NOTE

Please generate types and migrations in the sample prisma schema to test locally. also make a database in your local database before initiating migrations. There's also some version sync between typegraphql and prisma and graphql to work. please check compatiblity of these before updating any.

Scripts

  1. install the deps.
yarn install
  1. Watch and run the build by using,
yarn watch
yarn start
  1. Dry or single run the dev by
yarn start-dev
  1. For general dev run with HMR
yarn dev-ts

Prisma scripts

After building your schema,

to generate migrations

npx prisma migrate dev

to generate prisma client and typegraphql resolvers and more,

npx prisma generate

Resources which you can refer

Docs