notiz-dev / nestjs-prisma-starter

Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker
MIT License
2.36k stars 337 forks source link

Feature Request: replace type-graphql with nexus-graphql, CODE-FIRST #329

Closed ZiNai closed 4 years ago

ZiNai commented 4 years ago

I feel this Prisma + nexus is better, can there be a CODE-FIRST second method, or integration?

marcjulian commented 4 years ago

@ZiNai i tried nexus with nestjs and here is the repo https://github.com/marcjulian/nestjs-prisma-nexus

At the moment, I think code first approach from Nest is better integrated with Nest ecosystem than nexus.

ZiNai commented 4 years ago

@ZiNai i tried nexus with nestjs and here is the repo https://github.com/marcjulian/nestjs-prisma-nexus

At the moment, I think code first approach from Nest is better integrated with Nest ecosystem than nexus.

@marcjulian Thank you very much. I read the repo you provided, and studied the documentation of nexus, and found that it is more like a 'toy' at present, and it can not be combined with the characteristics of typescript. And it is very difficult for the application specific to the business to do field verification and deal with more business-specific details.

My ideal state is to be able to directly generate dto and model with type-graphql decorator partial business from prisma's schema. There is similar code in @prisma/client. You may need to customize his schema generator. Even basic CURD can be generated templated. Similar to prisma schema =>type-graphql

This should make better use of the features of prisma and nestjs, combining CODE-FIRST and SCHEMA-FIRST

Finally, thank you again for your efforts. I have applied nestjs-prisma-starter to my work, although this is a bit technically aggressive, I look forward to more new features

marcjulian commented 4 years ago

Maybe the upcoming integration if prisma with type-graphql, see 476, is what you are looking for.

Type-graphql also provides a nestjs module, which is still under development, which we can use together with the prisma integration.

marcjulian commented 4 years ago

New features are always welcome 💯