CLI tool
strawberry-graphql/strawberry avatar
strawberry-graphql/strawberry

Strawberry: dataclasses become a GraphQL schema, extras decide the framework

A GraphQL library for Python that leverages type annotations 🍓

4,733 stars691 forksPythonMIT

At a glance

What is it?
strawberry-graphql/strawberry is a Python GraphQL library built on dataclasses and type annotations, distributed as one small package with a dozen optional extras, a dev server CLI, a Django view and a mypy plugin. The install is one line; the decisions live in the extras and in what the README leaves undocumented.
Who is it for?
Adopt it when your team already writes typed Python and wants a schema generated from dataclasses with static checking attached. Check the extra you need against your framework version floor first, and treat the dev server command as development only, because the README documents no production entry point.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 6 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 19, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • strawberry-graphql/strawberry4,733 ★ · +13
Star history
Repository2026-09-232026-11-19
strawberry-graphql/strawberry4.7k4.7k

13 Stars in the last 57 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Decorators turn plain annotated classes into the schema

The whole quick start is one file, and there is no schema definition language and no SDL document anywhere in it. You write an ordinary Python class, annotate the fields, and let decorators do the rest:

python
import strawberry

@strawberry.type
class User:
    name: str
    age: int

@strawberry.type
class Query:
    @strawberry.field
    def user(self) -> User:
        return User(name="Patrick", age=100)

schema = strawberry.Schema(query=Query)

That block is the entire contract. The decorator on User says this dataclass is a GraphQL type, the decorator on the method says it is a query field, and the Schema constructor is what makes the set executable. The result, as the README puts it, is a User type plus one query field named user that returns a hardcoded user. Nothing in the snippet reaches a database or a network, which is the point of the design: the type annotations you already wrote are the schema.

One extra installs the CLI and one command serves the schema

The quick start method is called that because it pulls a server and a CLI in one step:

shell
pip install "strawberry-graphql[cli]"
strawberry dev app

The dev server then answers on http://0.0.0.0:8000/graphql and opens GraphiQL, so you can type queries against the schema immediately. That the command is named strawberry comes from the console script declared in the manifest, strawberry = "strawberry.cli:run". Two things to notice. The bind address is 0.0.0.0 rather than localhost, so the endpoint is reachable from other machines while it runs. And this is the only server command in the README: no production run command, no ASGI or WSGI entry point for your own app, and no deployment recipe. Anything beyond local development is left to you.

The framework you use is an extra you install by hand

The base package has five runtime dependencies and then a long tail of extras, one per framework or tool. They are declared as optional dependencies in the project manifest:

toml
[project.optional-dependencies]
aiohttp = ["aiohttp>=3.7.4.post0,<4"]
asgi = ["starlette>=0.18.0", "python-multipart>=0.0.7"]
debug = ["rich>=12.0.0", "libcst>=1.9.0"]
django = ["Django>=5.2", "asgiref>=3.2"]
channels = ["channels>=4.0.0", "Django>=5.2", "asgiref>=3.2"]
flask = ["flask>=1.1"]
quart = ["quart>=0.19.3"]
apollo-federation = ["protobuf>=3.20"]
opentelemetry = ["opentelemetry-api<2", "opentelemetry-sdk<2"]
pydantic = ["pydantic>1.6.1"]
sanic = ["sanic>=20.12.2"]

A fastapi extra is declared as well. Read the floors before you pin anything: Django needs 5.2 or newer, aiohttp is held below 4, and Flask accepts anything from 1.1 upward. The asgi extra pulls python-multipart alongside starlette, which is what a file upload endpoint needs. Since these are optional, a bare install gives you the library and no web server at all, and the README only walks through Django, so the other eleven integrations are undocumented at this level.

graphql-core is capped below 3.4.0 and Python below 4.0

The runtime dependency block is short enough to read in one breath, and the version bounds are the interesting part:

toml
requires-python = ">=3.11,<4.0"
dependencies = [
  "graphql-core>=3.3.0,<3.4.0",
  "typing-extensions>=4.14.0",
  "python-dateutil>=2.7",
  "packaging>=23",
  "cross-web>=0.6.0",
]

Two ceilings matter more than the floors. Python is capped under 4.0, and graphql-core is pinned to the 3.3 series, so a dependency resolver that wants 3.4 will fight this package. typing-extensions at 4.14.0 or newer is what lets one codebase cover annotation syntax across the whole supported Python range. The last entry, cross-web at 0.6.0 or newer, is the one the README never explains, so if you vendor Strawberry you should look at that package yourself before deciding whether it belongs in your dependency budget.

Django needs the app registered before the view does anything

Django is the only integration the README actually walks through, and it takes two steps rather than one. The app goes into INSTALLED_APPS:

python
INSTALLED_APPS = [
    ...,  # your other apps
    "strawberry.django",
]

Then the view goes into urls.py:

python
from strawberry.django.views import GraphQLView
from .schema import schema

urlpatterns = [
    ...,
    path("graphql", GraphQLView.as_view(schema=schema)),
]

Two details are easy to miss. Registering the app is a separate requirement from importing the view, so a missing entry in INSTALLED_APPS breaks the setup in a way the import line suggests it should not. And the endpoint is mounted at the bare path graphql with no trailing slash. The django extra requires Django 5.2 or newer plus asgiref 3.2 or newer, and a channels extra exists for the async case. For every other framework in the extras list, you get the dependency and no documentation.

mypy.ini is where schema mistakes surface before runtime

Statically checking the schema is one plugin line, and it is easy to leave out:

ini
[mypy]
plugins = strawberry.ext.mypy_plugin

The plugin is what lets a type checker understand the decorators, so without it the annotated classes are only checked as ordinary dataclasses and the GraphQL side stays invisible to mypy. The repository already has a mypy.ini at its root, alongside noxfile.py for sessions, .coveragerc for coverage and .pre-commit-config.yaml plus .prettierrc and .editorconfig for formatting. Those files describe a project that expects checks to run before code lands, not after. The practical consequence for a new user is that copying the quick start gives you a working schema but a silent one, until you add the plugin line to your own configuration.

Contributing goes through uv while setup.py only exists for GitHub

The contributor path is uv based and takes four commands:

shell
git clone https://github.com/strawberry-graphql/strawberry
cd strawberry
uv sync
uv run pytest

There is also a hook to install with pre-commit install, and CONTRIBUTING.md holds the rest. The oddity worth knowing about is setup.py, which contains only this:

python
import setuptools

if __name__ == "__main__":
    setuptools.setup(name="strawberry-graphql")

Its own comment says uv is used for the build and this file exists so the GitHub dependencies graph works. So if you arrive expecting a setuptools build, you will be reading a placeholder. Dependency work happens through uv.lock, which means a pip only environment cannot reproduce what the maintainers test, and noxfile.py sits alongside it as a second way to run tasks.

Three releases on a single day at version 0.331.6

The manifest declares version 0.339.1 and the classifier Development Status :: 5 - Production/Stable, yet the release list shows three tags within six days: 0.338.0 on 2026-10-26, 0.339.0 on 2026-10-29 and 0.339.1 on 2026-10-31, with the last push to main on 2026-11-02 and no archive flag on the repository. That cadence is the practical warning. Releases landing every few days mean a resolver left to float will move your GraphQL behaviour underneath you, so pin an exact version and read CHANGELOG.md at the repository root, or the changelog page linked from the manifest URLs, before upgrading. The stability classifier and the churn are not in conflict, but only one of them tells you what your next pip install will do.

Editorial conclusion

Adopt it when your team already writes typed Python and wants a schema generated from dataclasses with static checking attached. Check the extra you need against your framework version floor first, and treat the dev server command as development only, because the README documents no production entry point.

Frequently asked questions

What is strawberry-graphql used for?

It is a Python GraphQL library based on dataclasses and type annotations. Decorators such as strawberry.type and strawberry.field turn an annotated class and its methods into GraphQL types and resolvers, and strawberry.Schema(query=Query) builds the executable schema from them.

How do I install and run Strawberry GraphQL?

The quick start is one line: pip install "strawberry-graphql[cli]", then strawberry dev app with a module named app. The dev server serves GraphiQL at http://0.0.0.0:8000/graphql, and the console script comes from strawberry = "strawberry.cli:run" in the project manifest.

Does Strawberry GraphQL have a Django integration?

Yes, and it takes two steps: add "strawberry.django" to INSTALLED_APPS, then wire GraphQLView.as_view(schema=schema) into urls.py at the path graphql. The django extra requires Django 5.2 or newer and asgiref 3.2 or newer, and a separate channels extra covers the async case.

What does Strawberry GraphQL require to run?

Python 3.11 or newer with an upper bound under 4.0, plus graphql-core>=3.3.0,<3.4.0, typing-extensions>=4.14.0, python-dateutil>=2.7, packaging>=23 and cross-web>=0.6.0. Web framework support comes from optional extras such as aiohttp, asgi, django, flask, quart, sanic and a declared fastapi extra.

How do I set up Strawberry from a source checkout?

Clone the repository, cd strawberry, then run uv sync and uv run pytest. Dependencies are managed with uv and pinned in uv.lock, and pre-commit install adds the hook. The setup.py in the root only calls setuptools.setup so the GitHub dependencies graph has something to read.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. strawberry-graphql/strawberry on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/strawberry-graphql-strawberry.svg)](https://hysenlabs.com/projects/strawberry-graphql-strawberry)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/strawberry-graphql-strawberry.svg)](https://hysenlabs.com/projects/strawberry-graphql-strawberry)

Was this useful?