# maticzav/graphql-middleware

Split up your GraphQL resolvers in middleware functions

Repository: https://github.com/maticzav/graphql-middleware
Canonical: https://ross.abutalabs.com/products/graphql-middleware
Language: TypeScript
License: MIT
License Family: permissive
Last push: 2026-08-26T12:59:11+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 8, longevity 100
- inputs: {"age_days": 3219, "days_push": 7, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1145, forks 58 (observed 2026-08-28T04:03:45.566741+00:00)

## What it is
A TypeScript library that lets you split GraphQL resolvers into reusable middleware functions applied to any GraphQL schema. It follows the onion model, running code before and after resolver invocation for cross-cutting concerns like logging, auth, and error handling.

## Use cases
- add logging around graphql resolvers
- apply authentication middleware to graphql schema
- share logic across multiple graphql resolvers
- wrap graphql resolvers with error handling
- run code before and after resolver execution

## When to choose
- you want reusable cross-cutting logic across many resolvers
- you need middleware that works with any GraphQL schema
- you prefer the onion middleware pattern for resolver composition

## When to avoid
- you use GraphQL Yoga and need out-of-the-box support
- you want per-field resolver logic only within a single resolver
- your server framework already provides equivalent resolver middleware

## Facets
- artifact type: library
- maturity: stable
- function: middleware, graphql, web-framework
- domain: web-development, backend, apis, developer-tools
- platform: -
- tags: graphql-schema, resolver-middleware, onion-pattern, schema-wrapper, nodejs, typescript

## Member repositories
- maticzav/graphql-middleware (main) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:45.566741+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-30T06:34:40.144524+00:00, confidence not recorded.
  - readme: https://github.com/maticzav/graphql-middleware (fetched 2026-08-28T04:03:45.566741+00:00, sha cc0000caae10)
  - registry_npm: https://registry.npmjs.org/graphql-middleware (fetched 2026-08-29T12:39:51.559421+00:00, sha fd0c5e39242b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
