cruddl icon indicating copy to clipboard operation
cruddl copied to clipboard

Apollo Integration

Open itsezc opened this issue 5 years ago • 10 comments

Hello,

I used to use Prisma alot with Apollo, and I'd like to completely replace Prisma with Cruddl, but I have a few questions:

  • Is there a typeDefs generation for Cruddl as Prisma does (https://www.prisma.io/docs/prisma-cli-and-configuration/cli-command-reference/prisma-generate-xcv2/)

The reason for asking this is because currently (as far as the docs go), I'd have to setup a GraphQL server (Yoga or Apollo) with Cruddl from a GraphQL schema thats written by the developer, then another graphql server has to be made with custom resolvers, and rewrite the typeDefs (too much repetition) to get it all working the way prisma operates now.

Using the schema file as the typeDefs for Apollo server results in missing directives errors

Is there any way to shorten this process? i.e. Ability to overwrite resolvers in the schema generated by Cruddl as I'm aware that Apollo has addResolveFunctionsToSchema({ schema, resolvers }) however there is no API to access the data directly i.e. with Prisma you could do something like: users: (parent, args, ctx, info) => ctx.db.users(args, info)

  • Seeding (already answered on: https://github.com/AEB-labs/cruddl/issues/89)

Forgive me if the issue is straight forward, I've spent a few days playing around, researching, reading through the docs but this issue isn't referenced anywhere

itsezc avatar Aug 19 '19 08:08 itsezc

A demo application (with authentication, custom resolvers) etc. would be awesome for beginners to show / explain the features and limitations of Cruddl, hoping on this with the v1 release.

itsezc avatar Aug 29 '19 19:08 itsezc

In our set up, we serve the cruddl-generated schema directly on a server, then have other services that consume the schema of that server. That's the reason we never really needed dev tools to work with cruddl directly. A demo server would be a good idea, though 👍 I'll see what we can do.

Yogu avatar Aug 30 '19 14:08 Yogu

I think I have a similar situation in our setup. A good portion of our schema will be handled by cruddl. However, some things still need to be handled manually. This is especially true if not all of your graphql API is serviced by Arango. In our case, a portion of the API is a proxy for REST calls, while some serve other functional needs (testing, health check, etc.). My thinking right now is that some combination of schema stitching (merge-graphql, etc.) and/or federation techniques might get me there.

robross0606 avatar Sep 13 '19 15:09 robross0606

I think I have a similar situation in our setup. A good portion of our schema will be handled by cruddl. However, some things still need to be handled manually. This is especially true if not all of your graphql API is serviced by Arango. In our case, a portion of the API is a proxy for REST calls, while some serve other functional needs (testing, health check, etc.). My thinking right now is that some combination of schema stitching (merge-graphql, etc.) and/or federation techniques might get me there.

If by chance you have any plans to release some examples, I'd be in your debt as I've been looking to tackle this over the past few weeks

itsezc avatar Sep 13 '19 15:09 itsezc

In our set up, we serve the cruddl-generated schema directly on a server, then have other services that consume the schema of that server. That's the reason we never really needed dev tools to work with cruddl directly. A demo server would be a good idea, though 👍 I'll see what we can do.

This makes sense, however a typical setup would have Cruddl generate a schema -> write another service preferably in GraphQL again causing alot of repetition, I was hoping on a way to avoid it unless I'm missing something.

My current setup involves Orango (an ORM for ArangoDB) -> Apollo Server -> Apollo Client

with Cruddl (if I'm not misunderstanding) it would be: Cruddl -> Apollo Server -> Apollo Client

but the issue is I have to write a schema for Cruddl then rewrite it again for Apollo Server or atleast do some stitching / overwrite it with second layer causing alot of confusion and complexity, it would be much better if Cruddl can provide some sort of middleware alternative to make this stage easier.

itsezc avatar Sep 23 '19 04:09 itsezc

While I don't understand why you need multiple layers of graphQL.

Seems like Apollo federation, and indirectly, the ability for cruddl to generate a compatible federated schema would solve your issue.

That's exactly my use case !

orefalo avatar Oct 22 '19 18:10 orefalo

Since the time of my comment, I have done a lot of playing around with this whole issue and I agree (with you @orefalo) that as long as Cruddl is able to generate a compatible federated schema that would make life much easier.

itsezc avatar Oct 22 '19 21:10 itsezc

Hi

You can look into graphql-transform-federation for turning cruddl generated schema into a compatible federation schema. I have just begun to play with it, so i don't know if all cases are solved with this solution. Hope it helps !

dijbi avatar Jun 12 '20 19:06 dijbi

would be happy to hear about your feedback - please comment on the right issue https://github.com/AEB-labs/cruddl/issues/101 Tks

orefalo avatar Jun 13 '20 06:06 orefalo

@itsezc Hi I have just Added the Authentication and My Custom resolver. contact me know if you are still interested as my code is NDA signed.

hardikbeladiya avatar Aug 12 '20 10:08 hardikbeladiya