Apollo vs GraphQL: What are the differences?
Apollo: GraphQL server for Express, Connect, Hapi, Koa and more. Build a universal GraphQL API on top of your existing REST APIs, so you can ship new application features fast without waiting on backend changes; GraphQL: A data query language and runtime. GraphQL is a data query language and runtime designed and used at Facebook to request and deliver data to mobile and web apps since 2012.
Apollo belongs to "Platform as a Service" category of the tech stack, while GraphQL can be primarily classified under "Query Languages".
"From the creators of Meteor" is the top reason why over 8 developers like Apollo, while over 61 developers mention "Schemas defined by the requests made by the user" as the leading cause for choosing GraphQL.
Apollo and GraphQL are both open source tools. It seems that GraphQL with 11.7K GitHub stars and 753 forks on GitHub has more adoption than Apollo with 7.55K GitHub stars and 940 GitHub forks.
Facebook, Instagram, and Twitter are some of the popular companies that use GraphQL, whereas Apollo is used by CircleCI, Swat.io, and Flexport. GraphQL has a broader approval, being mentioned in 561 company stacks & 750 developers stacks; compared to Apollo, which is listed in 131 company stacks and 127 developer stacks.
What is Apollo?
What is GraphQL?
Need advice about which tool to choose?Ask the StackShare community!
Sign up to add, upvote and see more prosMake informed product decisions
What are the cons of using Apollo?
Sign up to get full access to all the companiesMake informed product decisions
Sign up to get full access to all the tool integrationsMake informed product decisions
When I joined NYT there was already broad dissatisfaction with the LAMP (Linux Apache HTTP Server MySQL PHP) Stack and the front end framework, in particular. So, I wasn't passing judgment on it. I mean, LAMP's fine, you can do good work in LAMP. It's a little dated at this point, but it's not ... I didn't want to rip it out for its own sake, but everyone else was like, "We don't like this, it's really inflexible." And I remember from being outside the company when that was called MIT FIVE when it had launched. And been observing it from the outside, and I was like, you guys took so long to do that and you did it so carefully, and yet you're not happy with your decisions. Why is that? That was more the impetus. If we're going to do this again, how are we going to do it in a way that we're gonna get a better result?
So we're moving quickly away from LAMP, I would say. So, right now, the new front end is React based and using Apollo. And we've been in a long, protracted, gradual rollout of the core experiences.
React is now talking to GraphQL as a primary API. There's a Node.js back end, to the front end, which is mainly for server-side rendering, as well.
Behind there, the main repository for the GraphQL server is a big table repository, that we call Bodega because it's a convenience store. And that reads off of a Kafka pipeline.
ReactQL is written in TypeScript to provide full types/Intellisense, and pick up hard-to-diagnose goofs that might later show up at runtime. React makes heavy use of Webpack 4 to handle transforming your code to an optimised client-side bundle, and in throws back just enough code needed for the initial render, while seamlessly handling
import statements asynchronously as needed, making the payload your user downloads ultimately much smaller than trying to do it by hand.
React Helmet was chosen to handle
<head> content, because it works universally, making it easy to throw back the correct
<title> and other tags on the initial render, as well as inject new tags for subsequent client-side views.
<style> tags when using #StyledComponents.
React Router handles routing, because it works both on the server and in the client. ReactQL customises it further by capturing non-200 responses on the server, redirecting or throwing back custom 404 pages as needed.
Koa is the web server that handles all incoming HTTP requests, because it's fast (TTFB < 5ms, even after fully rendering React), and its natively #async, making it easy to async/await inside routes and middleware.
Apollo is my favorite open source project.
Two things you need to worry about when making a statement like that: is the tool good, and how is the tool being built?
From a tool perspective... yeah, Apollo is great. I'm convinced that GraphQL is the way forward for me, and Apollo's just a great way to tackle it. Even beyond that, it just offers a good mentality to how you should build your database-backed app. I've used Relay in the past, back before they made a bunch of changes with Relay Modern (which all seem positive!), but switching to Apollo is just night-and-day. They've been doing better in the last 12 months or so at making smart abstractions in the React Apollo library, to the point where I'd just get these monster all-red pull requests where I can delete all my cruddy code and replace it with far fewer lines of their great abstractions.
But from a build perspective... Apollo fares even better, I think. By this, I mean their project inertia, their progress, their ability to ship stable code — but still ship meaningful new functionality, too. They're not afraid to move their ideas in other directions (integrating with React Native, for example). Kills me to see projects that are just heads-down on their little world as the world passes them by, and so far... yeah, Apollo's been on top of it.
Anyway, big fan. It's really changed how I write frontend code, and I feel hella confident while working with it.
At Airbnb we use GraphQL Unions for a "Backend-Driven UI." We have built a system where a very dynamic page is constructed based on a query that will return an array of some set of possible “sections.” These sections are responsive and define the UI completely.
The central file that manages this would be a generated file. Since the list of possible sections is quite large (~50 sections today for Search), it also presumes we have a sane mechanism for lazy-loading components with server rendering, which is a topic for another post. Suffice it to say, we do not need to package all possible sections in a massive bundle to account for everything up front.
Each section component defines its own query fragment, colocated with the section’s component code. This is the general idea of Backend-Driven UI at Airbnb. It’s used in a number of places, including Search, Trip Planner, Host tools, and various landing pages. We use this as our starting point, and then in the demo show how to (1) make and update to an existing section, and (2) add a new section.
While building your product, you want to be able to explore your schema, discovering field names and testing out potential queries on live development data. We achieve that today with GraphQL Playground, the work of our friends at #Prisma. The tools come standard with Apollo Server.
One of the joys I wanted to demonstrate in a GraphQL Summit talk I did is having so many helpful tools at my fingertips while building our product at Airbnb. This includes access to Git in Visual Studio Code, as well as the integrated terminal and tasks for running frequently-needed commands.
Of course, we also had some fun stuff to show for GraphQL and Apollo! The part that most people had not seen was the new Apollo GraphQL VS Code Extension. There is no need for me to copy over all juicy features from their marketing site (there are many!), but I will elaborate on one feature: Schema Tags.
If you are going to lint your queries against the schema you are working on, you will invariably be presented with the decision of “which schema?” The default may be your production schema (“current,” by convention), but as we discuss in the demo, if you need to iterate and explore new ideas, you need the flexibility of targeting a provisional schema.
Since we are using Apollo Engine, publishing multiple schemas using tags allows us this flexibility, and multiple engineers can collaborate on a single proposed schema. Once proposed schema changes for a service are merged upstream and those changes are naturally flowing down in the current production schema, we can flip back to “current” in VS Code. Very cool.
I just finished a web app meant for a business that offers training programs for certain professional courses. I chose this stack to test out my skills in graphql and react. I used Node.js , GraphQL , MySQL for the #Backend utilizing Prisma as a database interface for MySQL to provide CRUD APIs and graphql-yoga as a server. For the #frontend I chose React, styled-components for styling, Next.js for routing and SSR and Apollo for data management. I really liked the outcome and I will definitely use this stack in future projects.