GraphQl federation server that supports subscriptions - graphql

I'm currently evaluating different GraphQl servers in order to find one that supports subscriptions on a federated schema.
Apollo and HotChocolate don't support that. HotChocolate is going to (its on the roadmap) but I can't wait; and Apollo wants me to run a seperate subscription service which I'd like to avoid.
Anybody know of a service that allows me to use subscriptions this way, now?
To be clear: I only need the federation server that supports subscriptions. The single schemas behind may still be served thru hot chocolate.

https://tyk.io/docs/getting-started/key-concepts/graphql-subscriptions/#how-we-are-ahead-of-everyone-else
After some digging, I found this. Looks very promising. They claim to support subscriptions on federation.

have you tried https://github.com/sammysaglam/federation-with-subscriptions?
disclaimer: i am the author of this library.
it uses apollo server express under the hood, and supports federation with subscriptions. it works using schema stitching by converting federation SDL into schema-stitching SDL, allowing full gateway to microservice subscriptions support.

Related

Do I need to two links when building graphql subscription server?

I am planning to build a graphql application in ApolloServer to support query, mutation, subscription. I have read a lot of articles that subscription is done by websocket. All demos mention that I need to create 2 links, one for http, the other one is for ws.
based on my understanding, graphql spec doesn't include transport layer. I should be able to build one websocket transport to support all query, mutation, subscription.
Is it doable?
Is there any downside if I only use websocket link?

Which instance is the best to create an Apollo Graphql microservice on AWS?

Looking to create an Apollo Graphql microservice on AWS and am looking for the best way to build this on AWS, AWS do have their own Graphql as a service called Apsync but this seems like a blunt tool. Have found lots of suggestions to use Lambda but not much else. The Graphql layer will resolve data from several other AWS microservices.
Certainly don't use AppSync. We used it for a year, and found it's difficult to configure and does not perform well in many types of queries. We ended up using the Apollo Server on top of Lambda. As we use DynamoDb, we wrote our own resolvers (not much effort) as part of using the Apollo Server.

How to handle multi tenancy in graphql server ? Apollo/Prisma/ Hasura anything has this pugin?

Im trying to create a graphql server but in my case i need to setup multiple servers of diffrent customers. How can I implement multitenancy in graphql server?
Tried with apollo and prisma but none of them really worked.
Any libraries or plugin which i can use ?
Depending on the level of data separation needed, multi-tenancy can be achieved with a good attribute-based access control authorization setup at the GraphQL server level. Prebuilt solutions are available with a service like Auth0, or you can roll your own with a library like https://www.npmjs.com/package/passport.
The server lib (like Apollo Server!) can check the user’s tenancy at the time of request with middleware, then route to where ever it needs to go
On the database side, you can separate data by database, table, or just rely on the server level auth, depending on your separation requirements.

GraphQL replace Restful API or work with it?

So I gather GraphQL is a layer which sits in front of your RESTful API and can condense multiple requests down into one. Do you always have to go through a REST API, or can GraphQL talk directly with your MongoDB instead? Or it that what things like AWS Appsync and Hasura do, in that they use GraphQL and talk directly to a DB?
Thank in advance.
It can do either.
https://github.com/Soluto/graphql-to-mongodb
Appsync is a general purpose plugin framework so will need other API's to consume.
Here is a talk given this week about GraphQL vs REST:
https://github.com/MiyamotoAkira/grapqhl-presentation-round1

How ApolloGraphQL related to GraphQL?

I need to do a research on GraphQL and this confused me.
As I understand, ApolloGraphQL is some kind of framework/service that based on top of GraphQL (just like ExpressJS compared to Nodejs, Laravel framework compared to PHP)
Is that correct?
Thank you very much
GraphQL is a different way to interact with data. Under the hoods, it works through a single API endpoint - typically /graphql. And there is a client tool graphiql to make queries and perform mutations.
Apollo is a framework to implement GraphQL both on the client and the server. Most developers I know use Express-GraphQL to implement the server part as it is the recommended way. And they use Apollo client to connect to the Express-GraphQL server component.
Stephen Grider has a wonderful course in Udemy which teaches GraphQL and Apollo client. And he uses Express-GraphQL over the Apollo server to implement GraphQL on the server.
GraphQL is a language that is mostly used right now as an API on top of your Node.js server (so server-side)
Apollo is a client-side library that is made to consume GraphQL APIs
So, for a popular setup (express + GraphQL + Apollo),
express and GraphQL will execute server-side
The GraphQL API will be exposed a /graphql
Apollo will be executed client-side (in the browser for example) and will consume the API at /graphql
Yes you are correct on that point
ApolloGraphQL is framework for graphql like express framework for rest apis.
You can implement graphql without AppoloServer , but Appolo gives you easy ways to apply graphql that's why we use framework.

Resources