# maticzav/graphql-shield

🛡 A GraphQL tool to ease the creation of permission layer.

Repository: https://github.com/maticzav/graphql-shield
Canonical: https://ross.abutalabs.com/products/graphql-shield
Homepage: https://graphql-shield.com
Language: TypeScript
License: MIT
License Family: permissive
Topics: graphql, permissions, server, shield, graphql-yoga, apollo, hacktoberfest
Last push: 2026-08-26T12:55:38+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": 3125, "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 3578, forks 188 (observed 2026-08-28T04:08:10.870067+00:00)

## What it is
GraphQL Shield is a TypeScript library that lets you build a permission layer for GraphQL servers using an intuitive rule-based API. It works with any GraphQL server via GraphQL Middleware and includes a caching shield engine to keep request overhead low.

## Use cases
- add role-based permissions to a GraphQL API
- restrict access to specific GraphQL fields or types
- hide internal data from unauthorized GraphQL queries
- write reusable authorization rules for Apollo Server
- prevent unauthorized resolvers from executing in GraphQL Yoga
- cache permission checks to speed up GraphQL requests

## When to choose
- you need per-field or per-type authorization in a GraphQL schema
- you want a declarative, rule-based permission layer instead of ad-hoc resolver checks
- you use Apollo Server, GraphQL Yoga, or another middleware-compatible GraphQL server
- you want cached permission evaluation to minimize request overhead

## When to avoid
- your API is REST or otherwise not GraphQL-based
- you need authorization enforced at the database or service layer rather than the GraphQL layer
- your project is not on Node.js/TypeScript
- you need very complex, dynamic policies better suited to a policy engine like OPA or Casbin

## Facets
- artifact type: library
- maturity: stable
- function: authorization, middleware, graphql, security
- domain: web-development, backend, apis, security
- platform: -
- tags: graphql-middleware, permissions, rule-based, apollo-server, graphql-yoga, permission-layer, nodejs, typescript

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

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:10.870067+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-29T18:34:01.288972+00:00, confidence not recorded.
  - readme: https://github.com/maticzav/graphql-shield (fetched 2026-08-28T04:08:10.870067+00:00, sha be8c7ef2edc8)
  - homepage: https://graphql-shield.com (fetched 2026-08-29T09:27:53.437743+00:00, sha ac6f5401d178)
- Data as of 2026-08-30T08:39:29.467469+00:00.
