Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Lessons Learned from Integrating Django & GraphQL
Search
Krzysztof Żuraw
January 26, 2018
Programming
310
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Lessons Learned from Integrating Django & GraphQL
A few lessons learned while working with GraphQL & Django.
Krzysztof Żuraw
January 26, 2018
More Decks by Krzysztof Żuraw
See All by Krzysztof Żuraw
TypeScript myths debunked
krzysztofzuraw
0
250
Solutions reviews
krzysztofzuraw
0
86
Other Decks in Programming
See All in Programming
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
200
私なりのハーネスエンジニアリング ~独自の言語処理系の開発を通して~
seosoft
0
190
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.4k
GraphQL の onError と Nullability のこれから
quramy
0
210
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
730
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
630
Event is what happens
moro
2
3.9k
Seven New Principles of Software Engineering
yegor256
0
470
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
290
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
240
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
310
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
230
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.7k
The Curse of the Amulet
leimatthew05
3
17k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
60k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
400
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
Designing Experiences People Love
moore
143
24k
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
RailsConf 2023
tenderlove
30
1.6k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
Navigating Weather and Climate Data
rabernat
0
590
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
450
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