Create GraphQL APIs on Azure Cosmos DB for NoSQL in 2 minutes

Connect Hasura to your new or existing Azure Cosmos NoSQL database and generate high-quality, secure, and performant GraphQL APIs.
Instant GraphQL APIs

Build high-quality GraphQL APIs on Azure Cosmos DB, instantly

Connect to a new or existing Azure Cosmos for NoSQL database and get standardized, highly composable GraphQL APIs. The Hasura GraphQL Engine introspects the database and automatically generates GraphQL schemas and resolvers based on the CosmosDB indices.

GraphQL queries on Azure Cosmos DB

Leverage the full power of GraphQL API to interact with your Azure Cosmos database for all your read use cases.

Query exactly what you want from your Cosmos DB index and documents.

Relationships and nesting

The GraphQL API on Azure Cosmos handles relationships between models, and queries can be nested to any depth if required.

Pagination

Easily manage large datasets with built-in pagination capabilities. Cursor-based, Relay-style, and offset-based pagination is supported natively.

Filtering

Filter query results on Cosmos DB documents and fields using advanced WHERE clauses and Boolean / logical operators like _and / _or, etc.

Sorting

Sort data based on multiple fields in Cosmos DB documents and specify the sort direction (ascending or descending), making it easy to present your data.

Aggregation

Perform various aggregations to get summary about your Cosmos DB data directly within your GraphQL queries. Leverage aggregate functions in Azure Cosmos DB like count, sum, min, max, avg, etc.

Search

Perform similarity, nearest neighbor search using native queries.

query fetchAccountsAndCustomer {
  accounts(where: { account_id: { _eq: "AZ2376" } }) {
    id
    account_id
    name
    customer {
      id
      first_name 
      last_name
      zip_code
    }
  }
}
Fetch accounts' data like the `id` and `name` where the account_id is equal to some value, and fetch the `customer` data for the account.

GraphQL mutations on Azure Cosmos DB

Perform robust data manipulation operations on your Cosmos database with GraphQL mutations. Insert, update, or delete data in Cosmos DB via Hasura’s native queries.

mutation {
 insert_artist(id: 100, name: "New Artist") {
   ArtistId
   Name
 }
}
Insert into the artist document in Azure Cosmos DB index with values for `id` and `name` fields.

High-performance GraphQL APIs, at scale

Hasura takes a domain-driven approach to GraphQL, where a GraphQL query is compiled to a query on a domain model (a database query or existing APIs) resulting in superior API performance.

Hasura leverages the goodness of Cosmos DB to create efficient GraphQL queries.

Compile vs. resolve

Hasura avoids the GraphQL N+1 query problem by compiling a query instead of resolving. This compiler-based approach allows Hasura to form a single database query for a GraphQL query of any depth and avoids the N+1 problem in GraphQL.

Predicate pushdown database query Azure Cosmos DB

Hasura filters data at the source with a predicate pushdown of queries to Azure Cosmos DB. Hasura can push down a majority of queries like projection, permissions, relationships and joins, arguments, and filtering.

High-performance GraphQL APIs, at scale
Performance benchmarks

Hasura’s GraphQL APIs are faster than handwritten subgraphs on top of Azure Cosmos DB

Add caching to existing Azure Cosmos DB GraphQL APIs for faster response times

Get up to 10x faster API performance on Cosmos DB with end-to-end caching, scaling vertically and horizontally.

Hasura has metadata about the data models across data sources, and the authorization rules at the application level, which helps provide end-to-end caching.

Production-ready APIs on Azure Cosmos DB, from day one

Observability

Monitor for known issues by debugging and analyzing metrics from your Hasura instance.

API security

Secure your Cosmos DB APIs with tools including allow list, multiple JWT secrets, API rate limits, and more.

Authorization

Make granular read and write access control easy to configure on your Cosmos DB database with a built-in authorization engine.

Frequently Asked Questions

Can’t find the answer you are looking for? Reach out to our team, and we can help you select the Hasura plan that’s right for you.

Can I use GraphQL with existing Azure Cosmos DB?

How can I secure my GraphQL API for Azure Cosmos DB?

Can I combine and join data from Azure Cosmos DB and other sources in a single GraphQL query?

How does Hasura optimize GraphQL performance for Cosmos?

Contact Us

If you have any more questions about pricing, we’re here to help.

2024 Edition

The GraphQL Handbook

A GraphQL Handbook for developers and architects to help plan your GraphQL adoption journey.
The GraphQL Handbook