zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
2.07k stars 89 forks source link

[Feature Request] Generate RESTful, GraphQL and tRPC at the same time #770

Open olehmelnyk opened 11 months ago

olehmelnyk commented 11 months ago

Is your feature request related to a problem? Please describe. Can we generate at the same time tRPC, REST, and GraphQL APIs?

ymc9 commented 11 months ago

Hey @olehmelnyk , today you can already use the trpc plugin to generate trpc routers. For REST, you can simply use one of the supported server adapters to install automatic APIs to the server, no code generation is needed.

GraphQL is a big topic. We haven't put too much thought into it yet. Do you plan to use all three flavors of API in your app?

olehmelnyk commented 11 months ago

@ymc9 there are community generators/plugins that generate GraphQL from prisma schema. Currently, I'm thinking of creating a boilerplate/starter kit for new projects and I want to make it as flexible as possible, so would like to have the ability to generate REST, tRPC, and GraphQL at the same time or once needed.

ymc9 commented 11 months ago

@ymc9 there are community generators/plugins that generate GraphQL from prisma schema. Currently, I'm thinking of creating a boilerplate/starter kit for new projects and I want to make it as flexible as possible, so would like to have the ability to generate REST, tRPC, and GraphQL at the same time or once needed.

Got it. We haven't got many requests about GQL yet but it's definitely something worth adding in the future. I'll keep the request active in the backlog for the time being, and keep prioritizing it. Let me know if you're interested in working on it, and I'll be happy to facilitate.

TGTGamer commented 7 months ago

+1. Would also like to see better GraphQL support. I'm using Apollo to manage both my rest and GraphQL, and would love to make it easier for my community to utilise our central database. If we can get a GraphQL out from here that would be amazing for us :)

trancong12102 commented 6 months ago

We are using ZenStack in production along with GraphQL using NestJS. We combine the ZenStack enhanced client, Unlight/Prisma-NestJS-GraphQL, and a custom prisma generator to generate queries, mutations, and resolve fields. We are researching ZenStack's plugin system to write a plugin instead of using a mix of ZenStack and Prisma generator.

ymc9 commented 6 months ago

Prisma-NestJS-GraphQL

👍🏻 Let us know if there's anything we can help! @nopain1210

jiashengguo commented 6 months ago

@nopain1210, It's encouraging to see another production adoption of ZenStack. Is your project public available?

We would love to learn more about the use case which could guide ZenStack's future direction.