Unlocking Developer Productivity: The Power of GraphQL and Open Source
Author: Mark Stone
Whether you’re an architect, a full-stack developer building infrastructure systems for your organization, or an application developer working with a front end framework, GraphQL is increasingly important to your work. This post explains why GraphQL matters to each of these groups, and why the combination of GraphQL and open source is so compelling.
The growing complexity of data interactions forces enterprises to make tradeoffs that can impact application development. For example:
- Building a custom gateway solution, which might prove challenging to maintain and evolve, but will abstract application development from database particulars.
- Avoiding the development and operation burden of a custom gateway by expecting your app developers to know database internals well enough to build queries directly into their application code.
At DataStax, we’ve built the Stargate data gateway and released it as an open source project, because we see GraphQL, an advanced API for data interaction, and open source as keys to resolving this tradeoff.
So let’s talk about how data gateways simplify the joint challenges of application development and data management, and how open source is essential to a successful data gateway solution.
Modern application development
For application developers who began a journey with JSON and REST APIs, GraphQL is the most advanced waypoint on that journey. To truly unlock rapid development and accelerate time to market, a modern data gateway must support GraphQL.
For the last 15 years one consistent trend has been the emergence of JSON as the primary way application developers think about organizing data. APIs are a natural pairing with JSON. An HTTP-based API that supports manipulating JSON frees developers from:
- The particulars of database internals, because JSON serves as the mediating abstraction between application and database.
- Needing to develop in a particular language, because any language that can hit an HTTP endpoint can take advantage of the API.
We now live in a world where these trends can be powerful accelerators of application development, if organizations can deploy an API gateway in front of the necessary database systems.
Data management made easy
No engineering organization operates with a single database technology. Modern data platforms are heterogeneous — not only are there multiple databases underpinning the platform, there are different database solutions purpose-built for different needs. Like any natural ecosystem, diversity is a virtue, all other things being equal, yet diversity creates a challenge for application developers.
Most applications will require data from more than one source. How do you marshal all the needed data on behalf of a single application? Among the common options:
- Streaming services, such as Apache Kafka or Apache Pulsar. Streaming is essential for some use cases, particularly applications that need to respond to data changes in real time.
- Database JOIN. This is the traditional approach, but becomes increasingly difficult to implement amidst database diversity. This approach also burdens the application developer with knowing the query language particulars of each database involved.
- Federation. Data federation is emerging as the best modern practice for integrating data from multiple sources by putting a data gateway between the application and data source to broker federation and free the app from needing to do more than a simple HTTP API call.
In a world where data federation is the solution for application developers, GraphQL is the API of choice. GraphQL is an API framework that enables more fine-grained manipulation of elements in a JSON document than can be done with simple REST APIs, and less network chatter than can be done with either REST APIs or a Document API.
GraphQL’s tight focus on key-value pair manipulations also makes it well-suited for data federation scenarios. With appropriate resolvers between gateway and database, GraphQL doesn’t have to care very much about whether the backend database is relational, NoSQL, or even Graph. In turn, application developers are less burdened by these cares as well.
Why enterprises need a gateway that’s open source
When many technology organizations have the same problem, it makes sense to work toward common, shared solutions. In this context, open standards are good, and open source is better. Enterprises don’t want their developers to be locked into a proprietary platform. And if platform providers have learned anything from the last quarter century of open source, it’s that leading a growing market is always better than owning a closed market.
Released as open source by Facebook in 2015, and now under the stewardship of the Linux Foundation, GraphQL is a perfect example of one organization recognizing that the industry as a whole could make more progress on a common problem than a single organization could by itself.
We’ve started with Apache Cassandra® as the backend database behind Stargate’s GraphQL API, because we want application developers not to worry about the database. We’ve chosen the world’s most scalable database. The other side of the scalability coin is versatility — Cassandra runs well cloud-hosted, on-premises, or in hybrid environments.
We’ve opted for unparalleled scalability and resilience in any environment so that application developers don’t have to worry about those operational concerns. The most mature expression of this is Astra DB, which happens to be backed by Cassandra; it enables developers to build against data as a cloud service, freeing their engineering organization from operational concerns.
If that were the end of the story then DataStax would be just another cloud provider. In fact, it’s just the beginning of the story. We do all of this out in the open, leveraging and contributing to an open source ecosystem built around Cassandra (K8ssandra, Stargate, GraphQL, Apache Pulsar, etc.). We do this because we are part of an industry-wide effort to solve common problems in an industry standard and open source way. Ultimately that collaboration will yield the greatest gains for all of us.
If you want to go fast, go alone. If you want to go far, go together. This is the wisdom in Facebook’s original decision to open source Cassandra, and to subsequently open source GraphQL.
At DataStax, we respect and embrace that wisdom. Stargate releases always target not just the DataStax Enterprise and Astra DB version of Cassandra, but open source Cassandra as well. The same goes for the GraphQL API within Stargate; our work is, and always will be, available as open source.
The potential of GraphQL as the most refined HTTP-based API, and as a powerful tool for data federation, is only just being realized.
If you’re a stack builder who has considered Cassandra as a data platform for your developers, download Stargate and see how much more you can do running Cassandra with Stargate.
Follow DataStax on Medium for exclusive posts on all things open source, including Pulsar, Cassandra, streaming, Kubernetes, and more. To join a buzzing community of developers from around the world and stay in the data loop, follow DataStaxDevs on Twitter and LinkedIn.