The most popular GraphQL Servers and Clients for Node.js

Thilo Haas

September 2021

Which GraphQL Server and Client for Node.js should you use? A Comparison.

We will walk you through the most recent and most popular open-source GraphQL Servers and Clients and share some useful hints and insights in our choices along the way.

GraphQL Servers

Apollo Server

⭐ 11.7k GitHub stars • Documentation

Apollo Server is an open-source GraphQL server with a great developer experience and a huge community. Its development is led by Apollo Graph Inc. which also provides enterprise support.

When to choose Apollo Server:

  • simple setup
  • excellent documentation
  • great tooling and developer experience
  • enterprise support

GraphQL.js

⭐ 17.9k GitHub stars • Documentation

GraphQL.js is the reference implementation of the GraphQL specification in Node.js. It is the best choice if you want to start small and don’t need the full blown and extensible Apollo framework.

When to choose GraphQL.js:

  • If you only need the most basic GraphQL server features
  • Small footprint — not as big as the Apollo framework — therefore you need to do more by yourself

Also have a look at this Blogpost comparing GraphQL.js with Apollo.

Express GraphQL

⭐ 6k GitHub stars

Express GraphQL is the reference implementation of a GraphQL server over an Express web server.

When to choose Express GraphQL:

  • Extend your existing Connect, Express or Restify API with a GraphQL endpoint
  • Simple to get started

GraphQL Clients

When we want to connect our web frontends to a GraphQL backend it’s always a trade-off between simplicity, tooling and performance (e.g. bundle size).

Browser Fetch

For small use cases and straightforward GraphQL queries, always start with a plain fetch call:

When to use fetch:

  • For small applications
  • Simple GraphQL calls

If it gets any more complex, let’s have a look at the following GraphQL clients:

Apollo Client

⭐ 16.6k GitHub stars📦 75.7kb minified bundle size🔗 Website

Apollo Client is a full-featured GraphQL client that comes with caching and integrations for React, Angular, and more.

When to use Apollo Client:

  • Full-featured GraphQL client
  • Flexible client with a shallow learning curve
  • Easy to integrate into existing applications
  • Huge community & support

Relay

⭐ 15.9k GitHub stars📦 122.4kb minified bundle size🔗 Website

Relay is a framework for building data-driven React applications on top of a GraphQL API. Its development is led by Facebook. Relay makes additional assumptions about the standard GraphQL specification. Therefore you need a Relay compatible GraphQL server.

When to use Relay:

  • Full featured GraphQL client
  • Structured and opinionated client that enforces a defined style
  • Working with a big team on the same huge application
  • Your GraphQL server follows the Relay GraphQL specification

GraphQL Hooks

⭐ 1.5k GitHub stars📦 10.6kb minified bundle size

GraphQL Hooks is a minimal GraphQL client for React.

When to use GraphQL Hooks:

  • Web performance: Tiny bundle size
  • You only need the basic (query, mutations) GraphQL features
  • Versatile, easy to integrate and use

If you’re still unsure whether to choose the Apollo or Relay client, have a look at Scott Domes’ comparison of both clients within a React application: Apollo and Relay Side by Side.

Or another one by LogRocket comparing graphql-hooks with Apollo hooks: https://blog.logrocket.com/comparing-hooks-libraries-for-graphql

Conclusion

Which library you choose always depends on your use case. On our backends we mostly use Apollo GraphQL server because of simplicity, great tooling, and enterprise support.

On our frontends we start simple with browser fetch calls. For more advanced applications we use the graphql-hooks library because of its small bundle size. Only if we need a more advanced feature set we use the Apollo GraphQL client, because the size of the package is not negligible.

This should give you a good starting point. If you want to know more, have a look at https://graphql.org/code/ for an extensive list of even more clients, servers and tools — also in other programming languages.

Build Enterprise-Grade GraphQL Applications

Want to become a GraphQL pro? Follow us and read our whole series on enterprise-grade GraphQL applications.