GraphQL Mesh – Query Anything, Run Anywhere


In this talk I will demonstrate the new GraphQL Mesh library that was recently announced. GraphQL Mesh changes a lot of the traditional ideas about GraphQL and its relationship with other API protocols.

It can automatically generate a GraphQL API from openapi/Swagger, gRPC, SOAP, oData and others without changing the source and merge them all schemas into a single schema - Schema Stitching for any source!

In this talk I will share some of the original ideas behind it and my opinions on how the future looks for API consumption and exposure.


Hi everyone. My name is Uli and I'm the founder of a group called The Guild. I have short time so I'll get right to it. We are a group that created GraphQL Code Generator, GraphQL Inspector to compare schemas and validate before you go to production, GraphQL CLI, GraphQL Modules and many other community packages that we maintain and we strive to get very high level of maintenance of our open source libraries. We combine them all because we use them as just building blocks or a complete platform for your building your applications using GraphQL. But today I want to talk about a new library that we're very excited about, but it's called GraphQL Mesh. So GraphQL is great. GraphQL you can query what you want. GraphQL will get whatever it needs from your data sources and gets you back a predictable response. And one of the cool things about it is that the back end, the resolvers, I know exactly in each resolver we know what we're going to get from the parent resolver and what we need to return. So we can basically know those types and even generate typings for the inputs and the outputs of those resolvers. But one thing that we sometimes forget is that, yeah, we have type safety over the network, but what about all the data sources that we, the old data sources that we keep on query? Over there, let's say in the resolver I'm calling some, you know, rest, the rest endpoints that I used to call before, I don't have types for it. So I have no idea what's coming. That can be a problem. So now that we have GraphQL on the front end, what can we do to make the back end even better and all the interactions we have with it? Should we use GraphQL everywhere? I mean, one solution would be to basically build small GraphQL endpoints into those services, into those old back ends and teach them GraphQL or Federation, which can be nice, but you know, many times those are old servers, like an old Java server or.NET server, you know, it's not maintained or the people there won't get to learn GraphQL in the foreseeable future. There's also other problems, but I don't have a lot of time to talk about it. But what if, what do we really want for it? Like what do we love about GraphQL that we want on the back end? And that's probably the schema and the query language. So you know, what can we do with it? So we thought about it and we thought, well, those back ends, they do send something and they do sometimes have schemas, even if it's not GraphQL. And in the past, we created a library called Sofa that took a similar concept where we took existing GraphQL server and we generated a complete REST and OpenAPI server endpoints out of it to serve for third parties or like other applications that don't know GraphQL. So we thought, well, maybe in order to solve those problems, we can do the other way around. Maybe we can take those services, get their schemas, whether if they have it defined like gRPC or OpenAPI, or maybe we can just look at the logs of the responses and generate schemas from there, convert each one of those schemas into GraphQL, and then even merge them into one single GraphQL endpoint that basically we can query for all of our sources that we need when we into our resolvers. And what we've done here is basically, if we'll do that, we can take the best out of GraphQL using all the existing services we have today without needing to change them or touch them or them even being aware of what GraphQL is. And that's GraphQL Mesh. So GraphQL Mesh takes all those different sources, there's a lot of them, and generates a fully typed GraphQL SDK, which you can run anywhere. So basically takes all those sources and merge them into one. Let's see an example. So this is a simple example where we have two public APIs, one cities, which is a REST API with Swagger and another weather, which also is a public Swagger API. So just by defining those two into our Mesh config, we can start querying it as it was GraphQL. That's it. And those are just the existing endpoint, we have full documentation, GraphQL, anything. But that's not where we want to stop. We also want to merge them. So we can add a new field called daily forecasts on a city. And in those functions that we're connecting them both, this function is completely typed because we generate SDKs out of it. So now just by defining this field, we can start querying not only the city Tel Aviv, but also the forecast there. And what we've done here is basically schema stitching, not only on GraphQL, but on any source, which is extremely powerful. We can do schema stitching between OData and gRPC. We can do schema stitching between GraphQL and GraphQL Federation. And there's many, many sources that we already created and there's more coming. So OpenAPI and Swagger, gRPC, so GraphQL Federation, federated services and regular GraphQL, SQL and more. So just by trying to solve the problem of having full type safety over our resolvers, we basically solved a much bigger problem. Now GraphQL Mesh has much more into it. Those merging that I showed you, I showed you with stitching, which by the way, we took over schema stitching, improve it and release new versions to make it undeprecated. But you can also use Federation into doing those stitching. And more than that, we have an opportunity, we have a way for you to take existing services and even Swagger services and add federated metadata into it and then federate services that are not Federation at all. And there's many more things we can mock each one of those sources. We can snapshot prefix, do any transformation we want. It's all pluggable. And the most exciting thing about Mesh is that it's not essential gateway. It can run as a central gateway, but you can basically generate the SDK and run it anywhere on each of your services. So it's completely distributed. It can be like one central place or a distributed source. And if we take this idea one step further, we can actually start taking those codes that I showed you in the example, and you can start creating a weather API using GraphQL. And you can take your own existing bank API and expose this as a public Mesh module exposing GraphQL, without the bank even knowing what GraphQL is. And now suddenly you can even expose the merging strategy of those. So now that your bank has a public GraphQL API that also shows the weather in each of those branches, and the bank didn't do anything, you have, the community did. And if we take this one step further, that basically means that now we can start having public Mesh modules that run anywhere and are completely distributed. So we can have, and they're fully open source. The community is owning it. The registry can be any registry, NPM, GitHub, whatever. And we can really, that can take us closer to the Web 3.0 semantic web. We can all start exposing data that is connected to each other without putting it all in a central place. So if that's interesting for you, then go to and join the Guild community. We have discussions about it all the time and we're moving forward very fast. Thank you very much. Well, that's a lot of knowledge in just 20 or 28 minutes it was. Four great topics. I would like to invite all the lightning talk speakers with me on the stage to do the last round of Q&A of the day. Hey everyone. Hello. Hey there. Hey. Hello. Good morning, evening, night, whatever it is for you. Yeah, I'm going to go straight into the questions. I'm going to start with the first question for Matt and Claire. What market are you targeting? And why would someone use Mux instead of Twitch or YouTube? Yeah, it's a valid question. We're a developer facing product. So we're purely just APIs for developers to build into their platform as opposed to Twitch and YouTube, which are much more consumer facing products. So if you're a streamer just looking to go live without writing any code whatsoever, those are great platforms you should probably use them. If you're trying to build a platform, we're probably a better fit there. Okay. So it's more about the target audience, I guess, and that you have more control over what you're doing. Yeah, I would think about it a little bit like a bad analogy that I mentioned in Slack is they're more like the PayPal or Venmo. We're more the Stripe, if you're thinking about it in terms of like payment APIs. Okay. Thank you. Thank you. The next question is for Jen. What are the reasons why someone like the React Native web team would want to use a div as a button? The reason is that putting HTML inside of a button is not actually semantic HTML. So they may want to wrap that content, for instance, a card or a block of like an image and text into a div and make that an accessible button instead of putting a button around it. Yeah. So if you have a completely clickable card with different elements inside it, you can do that semantically within a button. Correct. So in that case, you'll want to make an accessible div. Well, you should want to at least. Perhaps. And can I say, if you don't, Jen is going to come and get you. I will very kindly tap you on the shoulder and make suggestions. How about that? Yeah. But tap doesn't work. Then I might hack it. Yeah. Yeah. Not a question, but just for you, a nice tap on the shoulder from Martin van Houten. Not really a question. I just want to say, Mesh looks awesome. Well, that's always nice to hear. Thank you very much. I hope that you feel the same and not hate me. Well, actually, at the company I work for, Albert Heijn, we are using it. And I have to say, it's been a pleasure. So thanks a lot. Oh, you're my neighbor. I can come visit you. Yeah. It would be a pleasure. Yeah. It would be a pleasure. Mike, does Ionic support native apps similar to React Native? Or is it like a Cordova standard app where it's a web UI instead of a native app? So it's kind of a mix of both. The majority of the UI is displayed in a web view. But you can integrate with custom native views or activities on Android and kind of mix which one gets displayed, either the web view or the native view, or even just overlay the native view on top of the web view. So you get kind of the best of both worlds. That feels powerful. Okay. Thanks guys and my lady for these great talks. For the people watching, they're also going to be in the Zoom rooms for questions. But the formal part is now over. I'm going to say goodbye to you for a little bit. So thanks for joining. Thank you. Thank you. Bye bye.
15 min
02 Aug, 2021

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Workshops on related topic