Discover how Astra DB reduces the TCO of self-managed Cassandra by over 85%. Read now!

Toggle Menu

Accessing Cassandra with the Stargate GraphQL API

GraphQL is a powerful language for accessing data from APIs in microservice architectures. Stargate makes it easy to query Cassandra databases directly via queries expressed in GraphQL, allowing you to combine data from multiple sources with a high degree of flexibility.

What Is GraphQL?

What Is GraphQL?

GraphQL is an open-source data query and manipulation language for APIs, originally developed by Facebook in 2012 and publicly released in 2015. GraphQL allows clients to understand the data that your APIs expose and ask for only the portions they want. With GraphQL, you can create applications and services to aggregate data from multiple services or data stores.

Next concept: Why GraphQL for Cassandra?

Why GraphQL For Cassandra?

GraphQL improves upon some of the limitations of the popular REST API style by providing a typesafe, graph-based schema, where nodes represent objects and edges represent relationships. This allows clients to query and manipulate multiple data items with a single query. Queries target a single URL endpoint to perform graph traversals, which access dictionaries of values in each node. This allows clients to get tailored data in a single query, instead of multiple round trips using heavy payloads of entire records.

When the Stargate GraphQL API is added to an existing Cassandra deployment, it automatically creates HTTP endpoints that expose GraphQL queries and mutations for the objects that it finds in the database. You can also create new database tables directly via the API. The built-in GraphQL Playground servlet makes it easy to prototype your mutations and queries and experiment with new approaches.

Next concept: How to get the Stargate GraphQL API
Why GraphQL For Cassandra?
How To Get The Stargate GraphQL API

How To Get The Stargate GraphQL API

Stargate is an open-source data gateway, and is now available in DataStax Astra. If you have an Astra database, the Stargate GraphQL API is already enabled. If you don’t have a Cassandra cluster and want one, you can set up a database for free at astra.datastax.com. If you have access to your own self-hosted Cassandra cluster, see the Stargate documentation for instructions on how to install and use the GraphQL API.

Next: Try It Out

Try It Out

With the Stargate GraphQL API your applications can get exactly the data they need, directly from Cassandra. Here’s two ways you can try it yourself.

Explore The Stargate GraphQL API In DataStax Astra With This Gatsby Starter App.

Try on Astra
Astra GraphQL

More Resources

Items related to GraphQL

Stargate.io

Stargate.io

Everything you need to get up to speed on all things Stargate.

Learn More
Stargate Discord Server

Stargate Discord Server

Join our discord room to chat with the contributors and meet the community.

Start Learning
Community

Community

Learn about how you can get involved in the Stargate project.

Read More