explaingit

strawberry-graphql/strawberry

4,653PythonAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Strawberry lets you build GraphQL APIs in Python by writing normal Python classes with type hints, no separate schema language needed, and it plugs straight into Django or FastAPI.

Mindmap

mindmap
  root((strawberry))
    What it does
      Build GraphQL APIs
      Auto-generate schema
      Type-safe development
    Tech stack
      Python
      GraphQL
      pip
      mypy
    Integrations
      Django
      FastAPI
      Starlette
    Features
      Python type hints
      GraphiQL browser UI
      mypy plugin
    Getting started
      pip install
      Dev server
      GraphiQL explorer
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a GraphQL API to an existing Django or FastAPI project without rewriting your data layer.

USE CASE 2

Define your API schema using Python type annotations and let Strawberry auto-generate the GraphQL schema.

USE CASE 3

Use the built-in GraphiQL browser tool to explore and test your API during development without a separate client.

USE CASE 4

Run mypy with the Strawberry plugin to catch GraphQL schema errors at development time before deploying.

Tech stack

PythonGraphQLDjangoFastAPIStarlettemypypip

Getting it running

Difficulty · easy Time to first run · 5min

Install via pip, built-in dev server means no extra infrastructure needed to try your first query.

MIT, use freely for any purpose including commercial, just keep the copyright notice.

In plain English

Strawberry is a Python library for building GraphQL APIs. GraphQL is an approach to building web APIs where the client specifies exactly which fields it wants, and the server returns only that data, rather than a fixed response shape regardless of what the caller needs. This pattern is common in apps that have many different types of clients, each needing a different subset of the same underlying data. With Strawberry, you define your data using Python's built-in type annotation syntax, the same style you use in regular Python code to describe variable types. The library reads those annotations and generates the corresponding GraphQL schema automatically, so there is no separate schema definition language to learn or maintain. You write Python classes, add a few decorators, and Strawberry handles translating that into the structure GraphQL clients expect. Getting started is quick. Install the package with pip, write a file that defines your data types and query fields, and run the included development server. Strawberry ships with a browser-based tool called GraphiQL, which lets you type queries and inspect results without writing a separate client application. The library integrates with several popular Python web frameworks including Django, FastAPI, and Starlette, so it can be added to an existing project without a full rewrite. It also includes a plugin for mypy, a Python type-checking tool, allowing you to catch schema errors during development rather than at runtime. The project is open source under the MIT license. A Discord community, a contributing guide, and several example repositories are available for those who want to go further.

Copy-paste prompts

Prompt 1
Show me how to create a basic GraphQL API in Python using Strawberry with a Query type that returns a list of users.
Prompt 2
How do I integrate Strawberry GraphQL into an existing FastAPI application?
Prompt 3
How do I define a Strawberry mutation that accepts input and writes data to a Django model?
Prompt 4
Set up Strawberry with mypy so I get type-checking errors when my resolvers return the wrong type.
Open on GitHub → Explain another repo

← strawberry-graphql on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.