Skip to main content
EuroPythonCode of ConductLive 📹

Build a production ready GraphQL API using Python

Room:
Wicklow Hall 1
Start (Dublin time):
Start (your time):
Duration:
180 minutes

Abstract

This workshop will teach you how to create a production ready GraphQL API using Python and Strawberry. We will be using using Django as our framework of choice, but most of the concept will be applicable to other frameworks too.

We'll learn how GraphQL works under the hood, and how we can leverage type hints to create end to end type safe GraphQL queries.

We'll also learn how to authenticate users when using GraphQL and how to make sure our APIs are performant.

If we have enough time we'll take a look at doing realtime APIs using GraphQL subscriptions and how to use GraphQL with frontend frameworks such as React.

TutorialWeb

Description

Note: to follow this tutorial make sure you setup your environment following the readme here:

https://github.com/patrick91/strawberry-workshop

Agenda of the worshop

  • Workshop introduction
    • The introduction will explain the goal of the workshop and make sure everyone is ready to start
  • Intro to type hints
    • Before looking at what GraphQL is, we'll do a short introduction on type hints in Python, since we'll be using the a lot during the workshop.
  • Introduction to GraphQL
    • Here we'll be looking at what GraphQL is, how it works and why it has been created
  • Our first GraphQL API
    • Here we'll get our hands dirty by creating our first GraphQL API using Strawberry. We'll also take time to see how to configure Strawberry with Django.
  • Let's test our API
    • I'm a big fan of TDD, so before continuing with our workshop we'll quickly see how to test our GraphQL API using pytest.
  • Schema design
    • In this section we'll spend time taking a look at how to design a GraphQL schema. We'll also understand the difference between queries and mutations.
  • Authentication
    • In this section we'll implement authentication to our GraphQL API. We'll discuss session based auth vs JWT authentication.
  • Performance / Monitoring / Observability
    • In this section we'll discuss how we can add observability/monitoring to our APIs and make sure we can keep our API performant over time.
    • We'll also see how we can use dataloaders to make our queries efficient. We'll also talk about other potential performance improvements (SQL optimisation, Static Queries and more)
  • Bonus
    • Integration with React
      • In this section we'll see how we can use GraphQL with a frontend framework like React.
    • Subscriptions
      • In this section we'll see what subscriptions are in GraphQL and how you can leverage them to build realtime APIs.

The speaker

Patrick Arminio

¡Hello there! I'm Patrick, a Swiss-Italian living in London.

I'm currently mainly working on Strawberry 🍓, a modern Python library for GraphQL. I'm a huge fan of GraphQL and also a Python user for more than 10 years now, so I'm super excited to contribute to the GraphQL ecosystem in Python.

I'm also the Chair of Python Italia, the association that organises events around Python in Italy, I'm currently working on the new website for the conference with some friends.



← Back to schedule