aircliff01 / node-graphql-ts-prisma

Boilerplate for an Advanced GraphQL Server w/ TypeScript and Prisma and Graphqlgen
MIT License
3 stars 1 forks source link

Feature Requests: Emailer, Scalable Folder Structure & Role-Based Authorisation #1

Open olafwrieden opened 5 years ago

olafwrieden commented 5 years ago

I appreciate you putting together the boilerplate. This is more of a feature request than it is an issue. I thought I'd check your repository out and make a few suggestions following your post in the Prisma Slack channel.

Feature Request 1

I often find myself having to send welcome emails (among others) with the popular MailGun API, something I have achieved in REST APIs through the use of middleware.

Still being relatively new to the world of GraphQL (and Prisma), I haven't yet found an efficient way to add middleware into the equation. I know it's a boilerplate but would love to see your take on perhaps sending a welcome email to a newly registered user via the free MailGun API. That would really differentiate from similar tutorials/code.

Feature Request 2

I have yet to see a Prisma & GraphQL boilerplate that's scalable, most focus on the simple User / Post model and thus only require a tiny folder structure. Like probably many others wanting to incorporate Prisma into their GraphQL API, I am looking for how to best set up a scalable folder structure - from the start. For example, I see that the src/resolvers/Query.ts file contains mixed queries for both User and Post. If this boilerplate could show how the various methods could be split up among respective files to allow for modularity and scalability, I would pay to see it.

Feature Request 3

Why not incorporate a little role-based authorization which allows ADMIN users to have more control over Posts, even if they don't belong to them? Such might enable both USER (standard user accounts) and ADMIN to CRUD their own posts and everyone's posts respectively.

Those are just a few ideas I would like to propose. Looking forward to hearing your thoughts on the above. Cheers.

aircliff01 commented 5 years ago

Hi @olafwrieden, thanks for submitting the feature requests. See my response below to your comments:

Feature Request 1: This is definitely a great idea, i am also fairly new to graphql but i will give it a try and anyone with suggestions can add to it as needed.

Feature Request 2: I am fairly new to graphql and prisma so i don't have experience with it in terms of a folder structure that will scale. I'm quite curious to see how companies using graphql at full scale in production have their structure laid out. I can only try a few patterns with some examples to see how they fair but I will try to share this boilerplate in other channels to see if I can get PRs for it.

Feature Request 3

I was actually thinking about this after i pushed the boilerplate, so its something on my radar that i will be looking into for sure. I have found myself needing something similar in other boilerplates I have used in the past so its definitely a great feature to have.

Thanks for sharing your requests and comments. Much appreciated. If you happen to beat me to any of these features, please feel free to submit a PR :)