Introducing a new way to review your PRs.

Read the announcement

strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations 🍓

View on GitHub

21 documents · Updated Nov 18, 2026

overview

Knowledge Base updated: 2026-11-17

Strawberry knowledge base

Orientation

Strawberry is a Python GraphQL library. Python decorators and annotations define GraphQL types, which are converted into a graphql-core schema and executed through Schema.

Its core packages cover type definition, schema construction, operation execution, subscriptions, and batching. Framework integrations layer HTTP, ASGI, and WebSocket transport behavior over a shared schema.

Cross-cutting capabilities live in extensions, permissions, directives, federation, Relay, Pydantic integration, and developer tooling. Critical request state is carried through execution context, resolver context, DataLoader instances, and transport request/response objects.

flowchart TD
  App[Application Python types] --> Types[Type definitions]
  Types --> Schema[Schema construction]
  Schema --> Core[graphql-core schema]
  Client[GraphQL client] --> Transport[HTTP / ASGI transport]
  Transport --> Execution[Operation execution]
  Execution --> Schema
  Execution --> Resolvers[Resolvers]
  Resolvers --> Loader[DataLoader]
  Execution --> Result[Execution result]
  Schema --> Extensions[Extensions and permissions]
  Schema --> Federation[Federation]
  Schema --> Relay[Relay]
  Types --> Pydantic[Pydantic integration]
  Schema --> Tooling[CLI and code generation]
  Transport --> Frameworks[Framework adapters]

Glossary

  • Strawberry type: Python declaration annotated by Strawberry decorators and metadata for GraphQL schema conversion.
  • Schema: The Strawberry object that owns the graphql-core schema and executes GraphQL operations.
  • DataLoader: Request-scoped asynchronous batching and caching utility for resolver data access.
  • GlobalID: Relay-compatible opaque identifier combining a GraphQL type name and node identifier.
  • Subgraph: A federation-enabled GraphQL service composed with other services.

Codebase-wide invariants

  • Public GraphQL types are declared through Strawberry metadata and decorators rather than raw graphql-core type construction; see strawberry/types/** and strawberry/schema/**.
  • Resolver annotations must be resolvable into Strawberry/GraphQL types before schema conversion; see strawberry/annotation.py and strawberry/types/**.
  • Framework adapters delegate GraphQL request semantics to shared HTTP or ASGI base behavior; see strawberry/http/**, strawberry/asgi/**, and strawberry/…/views.py.
  • Async batching is coordinated through DataLoader rather than implicit resolver batching; see strawberry/dataloader.py.
  • Federation and Relay extend normal schema/type behavior through dedicated packages; see strawberry/federation/** and strawberry/relay/**.

Routing table

Code or change areaRead
strawberry/schema/**, strawberry/types/**, strawberry/annotation.pySchema and type system
strawberry/schema/**, strawberry/…/object_type.py, strawberry/…/field.py, strawberry/…/arguments.pyDefining GraphQL types
strawberry/annotation.py, strawberry/lazy_type.py, strawberry/…/base.py, strawberry/…/auto.pyType annotations and resolution
strawberry/…/schema.py, strawberry/…/schema_converter.py, strawberry/…/config.py, strawberry/printer/**Schema conversion and printing
strawberry/…/execute.py, strawberry/…/base.py, strawberry/…/execution.pyGraphQL execution
strawberry/…/execute.py, strawberry/…/schema.py, strawberry/…/execution.pyExecuting GraphQL operations
strawberry/…/subscribe.py, strawberry/subscriptions/**, strawberry/asgi/**Subscriptions and streaming
strawberry/dataloader.py, strawberry/…/info.pyDataloading and batching
strawberry/http/**, strawberry/asgi/**, strawberry/file_uploads/**Web framework integration
strawberry/http/**, strawberry/asgi/**, strawberry/file_uploads/**HTTP and ASGI transport
strawberry/aiohttp/**, strawberry/chalice/**, strawberry/channels/**, strawberry/django/**, strawberry/fastapi/**, strawberry/flask/**, strawberry/litestar/**, strawberry/quart/**, strawberry/sanic/**Framework adapters
strawberry/extensions/**, strawberry/directive.py, strawberry/permission.py, strawberry/file_uploads/**Extensibility and cross-cutting behavior
strawberry/extensions/**, strawberry/directive.py, strawberry/permission.py, strawberry/field_extensions/**, strawberry/file_uploads/**Extensions, directives, and permissions
strawberry/federation/**, strawberry/schema/**Federation and Relay support
strawberry/federation/**Federation support
strawberry/relay/**Relay nodes and connections
strawberry/cli/**, strawberry/codegen/**, strawberry/schema_codegen/**Developer tooling
strawberry/cli/**, strawberry/codegen/**, strawberry/schema_codegen/**CLI and code generation
strawberry/experimental/pydantic/**Pydantic integration
strawberry/experimental/pydantic/**Pydantic types and conversion