Strawberry comes with an AWS Chalice integration. It provides a view that you can use to serve your GraphQL schema:

Use the Chalice CLI to create a new project

chalice new-project badger-project
cd badger-project

Replace the contents of with the following:

from chalice import Chalice
from import Request, Response
import strawberry
from strawberry.chalice.views import GraphQLView
app = Chalice(app_name="BadgerProject")
class Query:
def greetings(self) -> str:
return "hello from the illustrious stack badger"
class Mutation:
def echo(self, string_to_echo: str) -> str:
return string_to_echo
schema = strawberry.Schema(query=Query, mutation=Mutation)
view = GraphQLView(schema=schema, render_graphiql=True)
@app.route("/graphql", methods=["GET", "POST"], content_types=["application/json"])
def handle_graphql() -> Response:
request: Request = app.current_request
result = view.execute_request(request)
return result

And then run chalice local to start the localhost

chalice local

The GraphiQL interface can then be opened in your browser on http://localhost:8000/graphql


The GraphQLView accepts two options at the moment:

  • schema: mandatory, the schema created by strawberry.Schema.
  • graphiql: optional, defaults to True, whether to enable the GraphiQL interface.

Was this helpful? What can we improve?

Edit on Github

Newsletter 💌

Do you want to receive the latest updates on Strawberry? Subscribe to our newsletter!