Talk

Building high-performance, type-safe GraphQL APIs with Strawberry and Django

giovedì 23 maggio

15:25 - 16:10
StanzaSpaghetti
LinguaInglese
Livello audienceIntermediate
Elevator pitch

Discover the power of GraphQL APIs with Strawberry & Django in this talk! We’ll explore GraphQL vs RESTful APIs, tackle the N+1 problem, and unveil Strawberry’s Django integration for efficient queries. Learn to build high-performance, type-safe APIs with ease 😊

Descrizione

In this talk, we will explore the world of GraphQL APIs with Strawberry, a new Python library that makes it easy to create GraphQL APIs with Django. We will dive into what GraphQL is, how it compares to traditional RESTful APIs, and what makes Strawberry stand out from other Python GraphQL libraries.

One of the biggest challenges in GraphQL API development is the N+1 problem, where queries can become exponentially slow as more data is requested. We will discuss how data loaders can help solve this problem, and go in-depth on how to use them in Strawberry. In this topic we will also cover how the Strawberry Django integration leverages query introspection and user defined hints to automatically call .only(…)/.select_related(…)/.prefetch_related(…) on querysets, making your queries more efficient and avoiding common pitfalls. This is especially important in high-traffic, production environments where performance is critical.

Finally, we will showcase some of the benefits of using Strawberry and Django together, including a type-safe approach to API development and streamlined code maintenance. By the end of this talk, you’ll have the knowledge and tools you need to create high-performance GraphQL APIs with Strawberry and Django.

It will be presented in the following order:

  • Intro
  • Quick overview of what a GraphQL API looks like and its advantages
  • Writing general GraphQL APIs using Strawberry
  • Integrating the Django ORM with Strawberry
  • Some common pitfalls, with emphasis on the N+1 problem
  • GraphQL tools to avoid those pitfalls and how to use them with Strawberry
  • How the Strawberry Django integration uses introspection to automatically overcome those pitfalls and also improve performance when executing Django querysets
TagsAsyncIO, Django, GraphQL, APIs, Performance
Participant

Thiago Bellini Ribeiro

I’m a 35-year-old software developer based in Ribeirão Preto, Brazil with a passion for Python programming. Since embarking on my software development journey in 2007, I’ve honed my skills and specialized in Python development since 2011. Over the years, I’ve collaborated on numerous Python-based applications, always striving to contribute to the open-source community in meaningful ways.

One of my proudest achievements was developing the strawberry-django-plus project in 2021. Additionally, I was appointed a core developer of the Strawberry lib and the official maintainer of the Strawberry-Django integration in 2022. My dedication to the open-source community reflects my commitment to improving software development for everyone.

Beyond my professional pursuits, I’m known for my positive attitude and willingness to assist others in the community. I enjoy engaging with others and fostering meaningful connections to help propel the industry forward.