Accelerate and improve app development with Apollo GraphQL
December 1, 2022 • 5 min read
These days, there is an ever-more pressing need for app development to be fast, dynamic, and scalable. That’s why Grid Dynamics teamed up with Apollo, the leader in open source and commercial GraphQL technologies. Apollo’s supergraph adds a revolutionary layer to your organization’s technology stack that allows you to consolidate legacy APIs, microservices, and various databases into a single graph that every app across every platform can query. It promotes better separation of responsibilities, improved IT landscape architecture, faster time to market, resilience to changes in business needs, and the ability to scale without breaking the API.
Let’s look closely at Apollo GraphQL’s service, what powers it, and how to start implementing it for your business.
What is Apollo GraphQL?
Migrating from a monolithic to a microservices architecture is critical for businesses that are looking to stay ahead in the digital era. That’s because a microservices architecture makes it easier and faster to update and scale digital services. However, doing so introduces a new set of potential challenges when it comes to managing it all – and that’s where Apollo GraphQL comes in.
GraphQL is an open-source data query and code-generating language for application programming interfaces (APIs). The GraphQL API is represented as a single endpoint – rather than several – and is served over HTTP. Without GraphQL, it would take developers much longer to build the API for a service. The Apollo team has taken GraphQL to a new level with what it calls the supergraph, or “the graph of all graphs.”
The supergraph is a unified layer of assorted subgraphs that continuously and organically evolve. The engineering team carefully designs schemas from the ground up and defines their integrations based on the needs of the business enterprise. What’s more, each subgraph that exists within the supergraph is capable of being independently developed, tested, and deployed.
Building faster and better apps has never been easier with Apollo GraphQL.
The essence of the supergraph is based on three core principles:
- A unified composition layer: The supergraph’s network is comprised of the company’s data, microservices, and digital capabilities;
- Modular architecture: A set of separately-built and easily scalable functions that can communicate but don’t rely directly on one another. This provides a better on-ramp for developers and quicker validation; and
- Agile approach: Self-organized and cross-functional development teams are better equipped to publish changes into the schema that supports product development.
From a business point of view, the supergraph allows you to approach APIs as more of a business domain. It brings business operations to light across the enterprise rather than only exposing bits and pieces for purely technical reasons. For larger companies, this would evolve into thinking of their API’s as a service (SaaS API). This means that you’re able to interact with third-party APIs while managing your own custom ones. The main benefit of a SaaS API is that it offers more support for designing and deploying API services.
Supergraph overview
How does one seamlessly merge several subgraphs into one supergraph? The Apollo team relies on three driving forces behind the supergraph: Apollo federation 2, the Apollo router, and Apollo studio. All three of them work in sync to create a functional supergraph. Let’s break down what each of them does specifically and how it makes app building more efficient.
Apollo Federation 2
Apollo Federation allows developers to merge subgraphs into a single supergraph. Each subgraph is independent, with its own schema, meaning that developers can build, test, and deploy them without directly impacting other subgraphs. Combining these subgraphs is done through a principled set of primitives. There are already 20 programming languages, not to mention GraphQL-native services and products, supported by Federation. To start things off, a subgraph is written to conform to Federation’s subgraph specification, which then conveys the subgraph’s capabilities to the Apollo router and Apollo studio.
Apollo federation 2 adds more support, including a more streamlined interface and the use of directives. It promotes greater cooperation between subgraphs and gives developers greater control over the supergraph schema. The previous iteration of Apollo Federation was implemented manually.
Apollo router
The Apollo router is written in Rust, a multi-paradigm, general-purpose programming language and is the entrypoint to the supergraph. The Apollo router processes and carries out GraphQL queries across several subgraphs and provides a response to the client. It is 10x faster than its predecessor. What’s more, the Apollo router’s behavior is customizable with scripts that use the Rhai scripting language.
Apollo studio
Subgraphs need to be easily scalable – this means adding, removing, or modifying types and fields in a subgraph schema. It also includes migrating types or fields between subgraphs and adding or removing entire subgraphs altogether. With Apollo studio, it is much easier to manage the validation, automation, and observability of data sources within the supergraph by rapidly delivering changes.
Developers can verify changes beforehand with Schema Checks that help them to identify if any changes are potentially dangerous to the overall health of the code. This is done by comparing the proposed changes in the supergraph to past ones and ensuring it won’t break downstream consumers. If the changes are potentially harmful, the developer will receive an advanced warning before implementing them.
Supergraph in practice: Supply chain use case
In essence, GraphQL “hides” the fact that you have a microservices architecture, making the API look far more simple. This provides us with an interesting use case for supply chains. When you have a single-access endpoint – rather than several – implementation details are hidden, removing the need for client adapters and creating more simplified access control. Otherwise, there would be a need for an ever-growing number of REST APIs and adapter services requiring complex control and provision of different levels of data access and mutations.
Get started with Apollo GraphQL
There is no one-size-fits-all solution when it comes to implementing the supergraph. Technology stacks like Node JS, Java, and Python are all excellent choices. Your business needs to understand the technology stack – or perhaps even a mix of technology stacks – that works best for you. This choice relies on thinking about your business domain and its overall function rather than thinking purely about technology. GraphQL experimentation is easy and safe, meaning that you can start small, mix GraphQL with the more familiar REST architecture, and see how it goes from there. Regardless, there is a fast and substantial return on investment.
Apollo also provides technical guidance from their experts, given that GraphQL is still a relatively new technology. They work closely with your development team to help write code, provide emergency patches when necessary, and make the right architectural decisions.
Summing it up
App development involves many moving parts but it doesn’t have to be complicated. Apollo GraphQL unifies all your services, data, and capabilities within a single tech infrastructure. We’re excited by our budding partnership with them and looking forward to what we can achieve together.
Grid Dynamics is a digital-native technology services provider that accelerates growth and bolsters competitive advantage for Fortune 1000 companies. We have more than 15 years of experience in digital transformation and software innovation.
Interested in more details of how Apollo GraphQL can help you accelerate and improve app development? Get in touch with us to start learning more!