Apollo Server vs GraphQL.js
Which should you use? A side-by-side look at what each one does, who it suits, what it costs, how hard it is to set up, and where each falls short.
Open source · MIT
A JavaScript GraphQL server that works with Express, Koa, Hapi and similar Node frameworks.
Open source · MIT
JavaScript reference implementation of GraphQL, a query language for APIs.
The short answer
Choose Apollo Server if you need…
- Node.js developers who want to add a GraphQL API to an existing Express, Koa or Hapi app
- Teams that prefer defining a schema first and then implementing resolvers
- Developers who want a widely used, MIT-licensed GraphQL server in TypeScript
Choose GraphQL.js if you need…
- JavaScript or TypeScript developers building a GraphQL API on Node.js
- Developers who want the reference implementation that other GraphQL tools are built on
- Teams building browser-side tools that work with GraphQL schemas
Side-by-side
| Apollo Server | GraphQL.js | |
|---|---|---|
| Type | Library | Library |
| Price | Free and open source | Free and open source |
| Licence | MIT | MIT |
| GitHub stars | 14k | 20.3k |
| Setup difficulty | Intermediate | Intermediate |
| How you get it | Install with a package manager | Install with a package manager |
| Main language | TypeScript | TypeScript |
| Last code update | 5 days ago | 4 days ago |
What each one is
Apollo Server
Apollo Server is a JavaScript library for running a GraphQL API on Node.js. You describe your data with a GraphQL schema and write resolver functions that fetch the data for each field. It plugs into common Node web frameworks so clients can send GraphQL queries over HTTP. The description says it is spec-compliant and built for a schema-first way of working.
GraphQL.js
GraphQL.js is the official JavaScript implementation of GraphQL, a query language for APIs originally created by Facebook. It lets developers define a typed schema that maps to their code, then run queries against that schema, with validation of queries before they execute. It works in both Node.js servers and browsers.
Best for
Apollo Server
- Node.js developers who want to add a GraphQL API to an existing Express, Koa or Hapi app
- Teams that prefer defining a schema first and then implementing resolvers
- Developers who want a widely used, MIT-licensed GraphQL server in TypeScript
GraphQL.js
- JavaScript or TypeScript developers building a GraphQL API on Node.js
- Developers who want the reference implementation that other GraphQL tools are built on
- Teams building browser-side tools that work with GraphQL schemas
Strengths
Apollo Server
- Built to follow the GraphQL spec and designed for production use, per its description
- Works with several popular Node.js web frameworks
- Open source under the MIT license with a large community (about 14,000 stars)
GraphQL.js
- Maintained as the reference implementation of the GraphQL specification for JavaScript
- Ships both CommonJS and ES module builds, so it works with most bundlers
- Released under the permissive MIT license
Not ideal for
Apollo Server
- People who only need a REST API or static site, since GraphQL adds a layer they would not use
- Non-programmers, because it requires writing server code in JavaScript or TypeScript
- Projects that need a non-Node.js server language, since this library runs only on Node.js
GraphQL.js
- People who only want to call an existing GraphQL API and do not write server code; a client library would fit better
- Non-developers, since the README assumes familiarity with JavaScript and schemas
Trade-offs
Apollo Server
- Requires working knowledge of GraphQL concepts such as schemas and resolvers
- The README excerpt provided is truncated, so details on configuration and advanced features could not be verified here
- Being a JavaScript/TypeScript library, it is only useful within the Node.js ecosystem
GraphQL.js
- The README's getting-started material is brief; fuller documentation is on external sites
- Building a full API typically needs additional libraries not covered in this README
- Contributions require signing a GraphQL Specification Membership agreement
Getting started
Apollo Server
Install the server package
npm install @apollo/server graphqlGraphQL.js
Install with npm
npm install --save graphqlInstall with yarn
yarn add graphqlFrequently asked questions
What is the difference between Apollo Server and GraphQL.js?
Apollo Server: A JavaScript GraphQL server that works with Express, Koa, Hapi and similar Node frameworks. GraphQL.js: JavaScript reference implementation of GraphQL, a query language for APIs. Apollo Server suits node.js developers who want to add a graphql api to an existing express, koa or hapi app, while GraphQL.js suits javascript or typescript developers building a graphql api on node.js.
Are Apollo Server and GraphQL.js free?
Apollo Server: Free and open source. GraphQL.js: Free and open source.
Is Apollo Server or GraphQL.js more popular?
GraphQL.js has more GitHub stars (20.3k) than Apollo Server (14k). Popularity isn't the same as fit — check which one matches your use case above.
What are other alternatives to Apollo Server and GraphQL.js?
Other options people compare them with include Apollo Client, Koa, Yoga.
Keep comparing
Built from our catalogue entries for both products: open-source details come from each project's README (AI-assisted, refreshed weekly) and GitHub data; AI-tool details are editorial. Spotted something wrong? Let us know from either product's page.