Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Lessons Learned from Integrating Django & GraphQL
Search
Krzysztof Żuraw
January 26, 2018
Programming
0
300
Lessons Learned from Integrating Django & GraphQL
A few lessons learned while working with GraphQL & Django.
Krzysztof Żuraw
January 26, 2018
Tweet
Share
More Decks by Krzysztof Żuraw
See All by Krzysztof Żuraw
TypeScript myths debunked
krzysztofzuraw
0
240
Solutions reviews
krzysztofzuraw
0
78
Other Decks in Programming
See All in Programming
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
380
AtCoder Conference 2025
shindannin
0
1.1k
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
210
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
130
CSC307 Lecture 07
javiergs
PRO
1
560
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
180
CSC307 Lecture 04
javiergs
PRO
0
660
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
470
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
6
630
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
390
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
220
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
320
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
Designing Powerful Visuals for Engaging Learning
tmiket
0
240
Bash Introduction
62gerente
615
210k
A Tale of Four Properties
chriscoyier
162
24k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
79
4 Signs Your Business is Dying
shpigford
187
22k
Skip the Path - Find Your Career Trail
mkilby
0
58
Transcript
LESSONS LEARNED LESSONS LEARNED FROM INTEGRATING DJANGO & FROM INTEGRATING
DJANGO & GRAPHQL GRAPHQL Created by Krzysztof Żuraw
WHO AM I? WHO AM I? PYTHON AND JAVASCRIPT DEVELOPER
PYTHON AND JAVASCRIPT DEVELOPER AT AT BASED IN WROCŁAW. BASED IN WROCŁAW. STXNEXT STXNEXT
None
LESSON 1: GRAPHQL LESSON 1: GRAPHQL IS COOL IS COOL
IF YOU KNOW HOW TO USE IT IF YOU KNOW HOW TO USE IT
TECHNOLOGY STACK TECHNOLOGY STACK
None
None
None
ASK FOR WHAT YOU NEED ASK FOR WHAT YOU NEED
GET RESULTS GET RESULTS { allActors{ lastName } } { "data": { "allActors": [ { "lastName": "Travolta" }, { "lastName": "Jackson" }, } }
GET MANY RESOURCES IN A GET MANY RESOURCES IN A
SINGLE REQUEST SINGLE REQUEST { film(id: 1) { title actors { firstName lastName } } }
{ "data": { "film": { "title": "Pulp Fiction", "actors": [
{ "firstName": "John", "lastName": "Travolta" }, { "firstName": "Samuel L.", "lastName": "Jackson" }, ]}}
DATA MUTATION DATA MUTATION mutation CreateFilm { createFilm(film: { title:
"My cool title" }) { title id } } { "data": { "createFilm": { "title": "My cool title", "id": 123 } } }
mutation UpdateFilm { updateFilm(film: { title: "Totaly different title" })
{ title } } { "data": { "updateFilm": { "title": "Totaly different title", } } }
None
None
LESSON 2: GRAPHENE-PYTHON LESSON 2: GRAPHENE-PYTHON class Film(graphene.ObjectType): class Meta:
interfaces = (relay.Node, ) title = graphene.String() actors = graphene.List(Actor) air_date = graphene_datetime.DateTime() rating = graphene.Int()
{ "name": "film", "description": "The ID of the object", "args":
[ { "name": "id", "description": null, "type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } }, "defaultValue": null } ], "type": { "kind": "OBJECT", "name": "Film", "ofType": null }, "isDeprecated": false
CONCLUSION CONCLUSION PYTHON HAS A GREAT GRAPHQL PYTHON HAS A
GREAT GRAPHQL LIBRARY LIBRARY BUT BUT You have to be aware that it is a new library
None
LESSON 3: GRAPHRELATED FIELD LESSON 3: GRAPHRELATED FIELD Why? Almost
like ForeginKey in Django but without existence checks
# one microservice class Film(models.Model): title = models.CharField(max_length=100) air_date =
models.DateField() actor = GraphRelatedField('Actor') # another microservice class Actor(models.Model): name = models.CharField(max_length=100) # usage actor_name = film.actor.name
CONCLUSION CONCLUSION WE WANT TO HAVE BETTER WE WANT TO
HAVE BETTER COMMUNICATION BETWEEN COMMUNICATION BETWEEN MICROSERVICES MICROSERVICES JUST TO JUST TO Merge them together
None
LESSON 4: NUMBER OF LESSON 4: NUMBER OF REQUESTS REQUESTS
Inspired by Django ORM `prefetch_related` Fetch list of objects using one HTTP query and place them in thread-safe attribute inside a context.
CACHING CACHING HTTP Headers caching
SET CACHING HEADERS TO SET CACHING HEADERS TO INFORM INFORM
For how long cache the response? When there is need for refetch data for different users using the `Vary` header
CACHE POLICY CACHE POLICY Short cache times - less than
1 minute
CONCLUSION CONCLUSION USING CACHING BY VARY HEADER AND USING CACHING
BY VARY HEADER AND PREFETCHING OBJECTS IS GOOD IDEA PREFETCHING OBJECTS IS GOOD IDEA
None
LESSON 5: AUTHENTICATION LESSON 5: AUTHENTICATION What? JWT Why?
CONCLUSION CONCLUSION CHOOSING JWT WAS A GOOD IDEA - IT
CHOOSING JWT WAS A GOOD IDEA - IT ALLOWS US TO STORE ADDITIONAL INFO ALLOWS US TO STORE ADDITIONAL INFO
LESSON 6: FRONTEND TOOLING LESSON 6: FRONTEND TOOLING
CONCLUSION CONCLUSION A LOT OF NEW LIBRARIES - NOT ALWAYS
A LOT OF NEW LIBRARIES - NOT ALWAYS MATURE MATURE
None
THIS IS THE END THIS IS THE END Thank you
My blog: krzysztofzuraw.com My twitter: @krzysztof_zuraw