Feathers: GraphQL Support?

Created on 15 Oct 2015  ·  12Comments  ·  Source: feathersjs/feathers

I'm still learning GraphQL (https://learngraphql.com) but my first impression is that the support for multiple/batched reads/writes and "selectable" schema would be powerful when combined with the rest of the feathers workflow. Thoughts?

Most helpful comment

How about being able to use other middlewares? something like this is pretty great. https://github.com/calebmer/postgraphql

Though as the name suggests it only works with postgres.

I'm pretty new to feathers, but would love to be able to write a feathers-postgraphql service for a middleware like this if possible.

Also wondering if there is an easy way to convert a regular ol express middleware into a service. Express middlewares work fine with feathers, but they obviously don't register as other feathers-services.

All 12 comments

I read the introductory post a while ago and just scrolled through the GraphQL spec and I think it makes sense to explore this option a little more.

Currently Feathers supports query batching through feathers-batch and all 1.0 db adapters support field querying through the $select special query param (see e.g. here for feathers-nedb). We are also working on nested services in feathers-associations and schemas can be easily implemented via feathers-hooks.

It seems like those are doing a lot of the things that - at least from what I understand - GraphQL covers as well. It almost looks as if a GraphQL adapter would just consolidate all those separate features into a unified interface (the full spec looks like a bit to work through ;).

Once you learned a little more maybe you can help answer some of the questions that came to my mind:

  • How does the Feathers service model tie into GraphQL?
  • Can the existing plugins be combined to provide this functionality?
  • What is missing?
  • Where are the potential implementation challenges?
  • What's the deal with https://github.com/graphql/graphql-js? I don't see any tests and if it is a reference client implementation I am not sure how you can verify that you built a server that implements the spec.

Also, besides the current real-time events (which might potentially be hard to correlate with your GraphQL query results), could we have such thing as real-time GraphQL queries? How could that look like?

In fact, this may be solved with adding support for Waterline because we can just use https://github.com/wistityhq/waterline-graphql. /cc @ekryski

Haven't had a chance to experiment with GraphQL much more but I'm glad there may be a simple way to add support. Makes evangelizing Feathers that much easier :+1:

We're making some progress here. Once https://github.com/feathersjs/feathers-waterline is complete (still in the works) you will be able to use https://github.com/wistityhq/waterline-graphql and should make using graphql rather trivial.

We'll probably just need to document an example.

The first version of feathers-waterline has been published which should allow using the Waterline GraphQL module. I haven't tested it yet but if there are any issues with the integration it can be reported in the Waterline adapter.

Thanks for adding that @andrejunges! ^ that is the recommended way so far. I believe the repo is a bit more up to date. https://github.com/swarthout/feathers-apollo

How about being able to use other middlewares? something like this is pretty great. https://github.com/calebmer/postgraphql

Though as the name suggests it only works with postgres.

I'm pretty new to feathers, but would love to be able to write a feathers-postgraphql service for a middleware like this if possible.

Also wondering if there is an easy way to convert a regular ol express middleware into a service. Express middlewares work fine with feathers, but they obviously don't register as other feathers-services.

Status on @subodhpareek18 suggestion - would love to know if a decision has been made, since it's been a year.

One option is the docs for a graphql adapter will be available within a month. A repo to help generate resolvers will be available the month after that.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings