# Shopify/graphql-batch

A query batching executor for the graphql gem

Repository: https://github.com/Shopify/graphql-batch
Canonical: https://ross.abutalabs.com/products/graphql-batch
Language: Ruby
License: MIT
License Family: permissive
Topics: graphql, promise, batch
Last push: 2026-07-27T20:04:12+00:00

## Health v2 (maintenance only)
Score: 68/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 94, release rhythm 17, longevity 100
- inputs: {"age_days": 4000, "days_push": 37, "days_rel": 343, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1441, forks 108 (observed 2026-08-28T04:04:44.312116+00:00)

## What it is
A query batching executor for the Ruby graphql gem that lets GraphQL resolvers batch database lookups via custom loader classes. Loaders return promises and group loads by arguments, eliminating N+1 query problems in GraphQL APIs.

## Use cases
- batch database queries in graphql-ruby resolvers
- avoid N+1 queries in GraphQL API
- load records by id in batched fashion
- batch load associations for active record models
- chain dependent queries with promises in resolvers
- clear cached loaders after mutations

## When to choose
- you use the graphql gem and face N+1 query issues
- you want promise-based batching similar to Facebook's DataLoader in Ruby
- your resolvers load records or associations repeatedly per query

## When to avoid
- you don't use Ruby or the graphql gem
- you use graphql-ruby's built-in GraphQL::Dataloader instead
- your schema has no repeated per-object data lookups

## Facets
- artifact type: library
- maturity: stable
- function: graphql, middleware, caching, database
- domain: web-development, backend, apis, databases, developer-tools
- platform: ruby
- tags: graphql-ruby, query-batching, n-plus-one, dataloader, promise-based, active-record

## Member repositories
- Shopify/graphql-batch (main) score 68

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:44.312116+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:36:27.068772+00:00, confidence not recorded.
  - readme: https://github.com/Shopify/graphql-batch (fetched 2026-08-28T04:04:44.312116+00:00, sha fa902333e1b4)
- Data as of 2026-08-30T08:39:29.467469+00:00.
