3 ms·
Related and FWIW: I checked all solutions in this space and I stuck with type-graphql which is not only an amazing lib but offers a clean architecture: Decorat
by desmap 6y ago
Related and FWIW: I checked all solutions in this space and I stuck with type-graphql which is not only an amazing lib but offers a clean architecture:
Decorated Typescript types as classes dictate the GraphQL schema and the DB model (either through further decorator libs or custom solutions). So, you end up with only one source of truth + stay DRY + very low level of abstractions. There is some debate around the right approach but I much prefer this approach over the others such as DB-model-first (Hasura) or Prisma 2 which I remember has its own DSL for modeling data.
- nikolasburk 6y agoTypeGraphQL and Prisma are not really comparable though. Prisma is an open-source database toolkit (much like an ORM), TypeGraphQL is a GraphQL schema construction library (like `graphql-js` or `@nexus/schema`), they solve very different problems! You can even combine Prisma with TypeGraphQL if you're building a GraphQL server that needs to access a databases. In that case, you'd use Prisma Client inside your TypeGraphQL resolvers to send database queries. In fact, we are collaborating with the maintainer of TypeGraphQL to build an integration between Prisma and TypeGraphQL that will allow you to leverage information from your Prisma models when building your GraphQL schema! :)
- desmap 6y agoThey can be compared in terms of who dictates the model/is the leading source of truth. I saw that you integrate with type-graqhql but the integration hasn't convinced me yet, somehow type-graqhql loses its elegance with the resulting architecture. Besides, did you sponsor type-graqhql's maintainer to collaborate with Prisma 2?
- hervelabas 6y ago> They can be compared in terms of who dictates the model/is the leading source of truth. You can also use introspection to keep the database as the source of truth for the model, and lean on the Prisma schema for type safety if you prefer.