SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
API-First Design
and Django
The tale of caring for your fellow developer
Olá! 🇧🇷
I am Klaus Laube
In ❤ with Django since version 0.96
Back-end developer at Son of a Tailor
klauslaube.com.br
github.com/kplaube
What’s an API again?
“(...) a set of dedicated URLs that return pure
data responses — meaning the responses
won’t contain the kind of presentational
overhead that you would expect in a
graphical user interface like a website.
Petr Gazarov
https://www.freecodecamp.org/news/what-is-an-api-in-english-please-b880a3214a82/
Let's build a
product! 🚀
The Code-First approach
Install Django
It’s not up to decision
picking a different
framework ❤
The Code-First approach
Install Django
It’s not up to decision
picking a different
framework ❤
Design the
database
Come up with
diagrams, define the
indexes, describe
relationships 💾
The Code-First approach
Install Django
It’s not up to decision
picking a different
framework ❤
Design the
database
Come up with
diagrams, define the
indexes, describe
relationships 💾
Write the code
Organize the packages,
do some TDD, write the
models, the views,
perhaps some API 👨‍💻
The Code-First approach
Install Django
It’s not up to decision
picking a different
framework ❤
Design the
database
Come up with
diagrams, define the
indexes, describe
relationships 💾
Write the code
Organize the packages,
do some TDD, write the
models, the views,
perhaps some API 👨‍💻
Deploy &
release
Deal with CI, CD, PaaS,
provisioning,
monitoring, caching,
etc 🖥
The Code-First approach
Install Django
It’s not up to decision
picking a different
framework ❤
Design the
database
Come up with
diagrams, define the
indexes, describe
relationships 💾
Write the code
Organize the packages,
do some TDD, write the
models, the views,
perhaps some API 👨‍💻
Expose
Let other stakeholders
know about your
release 🎉
☝
Here is where we’ll
start to integrate with
other developers
Deploy &
release
Deal with CI, CD, PaaS,
provisioning,
monitoring, caching,
etc 🖥
“Today Django is arguably used more often as
just a back-end API rather than a full
monolithic website solution at large
companies!
William S. Vincent
Django for APIs
What’s API-First?
“(...) the first, most waterfall aspect of
application development is the design of the
API’s.
Casey Lutz
https://medium.com/trimble-maps-engineering-blog/api-first-development-and-openapi-83
5afb46b7f1
3 principles of
API-First Design
#1
Your API is the first user interface of your application
#2
Your API comes first, then the implementation
#3
Your API is described (and maybe even self-descriptive)
It’s about caring for other
developers! 👨‍💻 👩‍💻
How can we do
that with
Django? 🤔
Design the API
Understand the
requirements, know your
stakeholders, set standards,
start defining behaviours.
API Blueprint example 👉
20
Validate
Get stakeholders involved,
think about use cases,
validate ideas through mock
servers, and get an
agreement.
Or you can use Prism:
https://stoplight.io/open-source/pris
m/
21
Test! Test! Test!
https://dredd.org
Implement
It’s time for some coding.
And it’s not just you! With a
solid contract your
stakeholders can start the
development as well.
Django REST Framework example 👉
23
What about {over,under}-fetching?
https://github.com/rsinger86/drf-flex-fields
Or consider
GraphQL 🤷‍♂
It’s official!
It’s time to turn the
agreement into a
specification.
rest_framework (with
uritemplate and pyyaml) is
enough to do this job.
26
$ python manage.py generateschema >
openapi-schema.yml
How to deal with changes?
▷ Path: mytodoapp.com/v1/tasks
▷ Querystring: mytodoapp.com/tasks?version=1.0
▷ Host: v1.mytodoapp.com/tasks
▷ Accept header: Accept: application/json; version=1.0
▷ Custom header: X-API-VERSION
▷ No versioning at all 🙃
https://www.django-rest-framework.org/api-guide/versioning/
Release
Turn the specification public.
Publish the API
documentation. drf-yasg is
your sidekick here.
Engage
Promote your API, start
monitoring, collect feedback,
and learn from your mistakes
and successes.
29
Repeat ♻
Further readings:
API-First Processes
and Tools
bit.ly/api-first-article
31
Further readings:
How To Design
Great APIs With
API-First Design
bit.ly/3hQYw7d
32
Further readings:
Django for APIs
leanpub.com/djangoforapis
33
Tak! 🇩🇰
You can find me at:
klauslaube.com.br
github.com/kplaube
Django Forum: kplaube

Mais conteúdo relacionado

Mais procurados

考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半
考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半
考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半
Management_CoLtd
 
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
복연 이
 

Mais procurados (20)

AI-first Code Editor 「Cursor」の機能紹介
AI-first Code Editor 「Cursor」の機能紹介AI-first Code Editor 「Cursor」の機能紹介
AI-first Code Editor 「Cursor」の機能紹介
 
Gartner market guide ai ops platforms
Gartner market guide ai ops platformsGartner market guide ai ops platforms
Gartner market guide ai ops platforms
 
Culture Deck_Sustainable Lab.pptx
Culture Deck_Sustainable Lab.pptxCulture Deck_Sustainable Lab.pptx
Culture Deck_Sustainable Lab.pptx
 
アップルの特許に見るUI特許のポイント
アップルの特許に見るUI特許のポイントアップルの特許に見るUI特許のポイント
アップルの特許に見るUI特許のポイント
 
Copyright, quotations and figures in your report
Copyright, quotations and figures in your reportCopyright, quotations and figures in your report
Copyright, quotations and figures in your report
 
kintone & AWSサーバレスアーキテクチャのベストプラクティス
kintone & AWSサーバレスアーキテクチャのベストプラクティスkintone & AWSサーバレスアーキテクチャのベストプラクティス
kintone & AWSサーバレスアーキテクチャのベストプラクティス
 
Black Belt Online Seminar AWS上の暗号化ソリューション
Black Belt Online Seminar AWS上の暗号化ソリューションBlack Belt Online Seminar AWS上の暗号化ソリューション
Black Belt Online Seminar AWS上の暗号化ソリューション
 
考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半
考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半
考える技術(ロジカルシンキング・ワークショップ)公開スライド:後半
 
Why Mulesoft ?
Why Mulesoft ?Why Mulesoft ?
Why Mulesoft ?
 
IIJmio meeting 23 DNSフィルタリングをなぜ行うのか
IIJmio meeting 23 DNSフィルタリングをなぜ行うのかIIJmio meeting 23 DNSフィルタリングをなぜ行うのか
IIJmio meeting 23 DNSフィルタリングをなぜ行うのか
 
AWS Elemental MediaConvert で動画変換
AWS Elemental MediaConvert で動画変換AWS Elemental MediaConvert で動画変換
AWS Elemental MediaConvert で動画変換
 
SharePoint Online へのアクセスを制限しよう
SharePoint Online へのアクセスを制限しようSharePoint Online へのアクセスを制限しよう
SharePoint Online へのアクセスを制限しよう
 
AWS Lambda@Edge でできること!
AWS Lambda@Edge でできること!AWS Lambda@Edge でできること!
AWS Lambda@Edge でできること!
 
AWS Black Belt Online Seminar 2016 Amazon EC2 Spot Instances(スポットインスタンス)
AWS Black Belt Online Seminar 2016 Amazon EC2 Spot Instances(スポットインスタンス)AWS Black Belt Online Seminar 2016 Amazon EC2 Spot Instances(スポットインスタンス)
AWS Black Belt Online Seminar 2016 Amazon EC2 Spot Instances(スポットインスタンス)
 
Démystifions l'API-culture!
Démystifions l'API-culture!Démystifions l'API-culture!
Démystifions l'API-culture!
 
ISPの向こう側、どうなってますか
ISPの向こう側、どうなってますかISPの向こう側、どうなってますか
ISPの向こう側、どうなってますか
 
クラウドでも非機能要求グレードは必要だよね
クラウドでも非機能要求グレードは必要だよねクラウドでも非機能要求グレードは必要だよね
クラウドでも非機能要求グレードは必要だよね
 
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
 
Mule : Building Blocks for Microservices
Mule : Building Blocks for MicroservicesMule : Building Blocks for Microservices
Mule : Building Blocks for Microservices
 
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
 

Semelhante a API-First Design and Django

Semelhante a API-First Design and Django (20)

Rest apis with DRF
Rest apis with DRFRest apis with DRF
Rest apis with DRF
 
Content Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortalsContent Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortals
 
Django Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersDjango Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python Developers
 
Space Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdfSpace Camp June 2022 - API First.pdf
Space Camp June 2022 - API First.pdf
 
Concepts and applications of Django.pptx
Concepts and applications of Django.pptxConcepts and applications of Django.pptx
Concepts and applications of Django.pptx
 
Django in the Real World
Django in the Real WorldDjango in the Real World
Django in the Real World
 
Web API Design
Web API DesignWeb API Design
Web API Design
 
Web API Design: Crafting Interfaces that Developers Love
Web API Design:  Crafting Interfaces that Developers LoveWeb API Design:  Crafting Interfaces that Developers Love
Web API Design: Crafting Interfaces that Developers Love
 
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
 
General Terminologies to understand programming and Data Science
General Terminologies to understand programming and Data ScienceGeneral Terminologies to understand programming and Data Science
General Terminologies to understand programming and Data Science
 
Dev Learn Handout - Session 604
Dev Learn Handout - Session 604Dev Learn Handout - Session 604
Dev Learn Handout - Session 604
 
Learn Django Tips, Tricks & Techniques for Developers
Learn Django Tips, Tricks & Techniques for DevelopersLearn Django Tips, Tricks & Techniques for Developers
Learn Django Tips, Tricks & Techniques for Developers
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworks
 
Why your APIs should fly first class
Why your APIs should fly first classWhy your APIs should fly first class
Why your APIs should fly first class
 
What Web Framework To Use?
What Web Framework To Use?What Web Framework To Use?
What Web Framework To Use?
 
Getting Started With Django
Getting Started With DjangoGetting Started With Django
Getting Started With Django
 
Gapand 2017 - Diseñando Arquitecturas Serverless en Azure
Gapand 2017 - Diseñando Arquitecturas Serverless en AzureGapand 2017 - Diseñando Arquitecturas Serverless en Azure
Gapand 2017 - Diseñando Arquitecturas Serverless en Azure
 
Top 10 web development tools in 2022
Top 10 web development tools in 2022Top 10 web development tools in 2022
Top 10 web development tools in 2022
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in Django
 
10 Best Web Development Frameworks for Your Business Needs
10 Best Web Development Frameworks for Your Business Needs10 Best Web Development Frameworks for Your Business Needs
10 Best Web Development Frameworks for Your Business Needs
 

Último

Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
ellan12
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
shivangimorya083
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
SofiyaSharma5
 

Último (20)

Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 

API-First Design and Django

  • 1. API-First Design and Django The tale of caring for your fellow developer
  • 2. Olá! 🇧🇷 I am Klaus Laube In ❤ with Django since version 0.96 Back-end developer at Son of a Tailor klauslaube.com.br github.com/kplaube
  • 4. “(...) a set of dedicated URLs that return pure data responses — meaning the responses won’t contain the kind of presentational overhead that you would expect in a graphical user interface like a website. Petr Gazarov https://www.freecodecamp.org/news/what-is-an-api-in-english-please-b880a3214a82/
  • 6. The Code-First approach Install Django It’s not up to decision picking a different framework ❤
  • 7. The Code-First approach Install Django It’s not up to decision picking a different framework ❤ Design the database Come up with diagrams, define the indexes, describe relationships 💾
  • 8. The Code-First approach Install Django It’s not up to decision picking a different framework ❤ Design the database Come up with diagrams, define the indexes, describe relationships 💾 Write the code Organize the packages, do some TDD, write the models, the views, perhaps some API 👨‍💻
  • 9. The Code-First approach Install Django It’s not up to decision picking a different framework ❤ Design the database Come up with diagrams, define the indexes, describe relationships 💾 Write the code Organize the packages, do some TDD, write the models, the views, perhaps some API 👨‍💻 Deploy & release Deal with CI, CD, PaaS, provisioning, monitoring, caching, etc 🖥
  • 10. The Code-First approach Install Django It’s not up to decision picking a different framework ❤ Design the database Come up with diagrams, define the indexes, describe relationships 💾 Write the code Organize the packages, do some TDD, write the models, the views, perhaps some API 👨‍💻 Expose Let other stakeholders know about your release 🎉 ☝ Here is where we’ll start to integrate with other developers Deploy & release Deal with CI, CD, PaaS, provisioning, monitoring, caching, etc 🖥
  • 11. “Today Django is arguably used more often as just a back-end API rather than a full monolithic website solution at large companies! William S. Vincent Django for APIs
  • 13. “(...) the first, most waterfall aspect of application development is the design of the API’s. Casey Lutz https://medium.com/trimble-maps-engineering-blog/api-first-development-and-openapi-83 5afb46b7f1
  • 15. #1 Your API is the first user interface of your application
  • 16. #2 Your API comes first, then the implementation
  • 17. #3 Your API is described (and maybe even self-descriptive)
  • 18. It’s about caring for other developers! 👨‍💻 👩‍💻
  • 19. How can we do that with Django? 🤔
  • 20. Design the API Understand the requirements, know your stakeholders, set standards, start defining behaviours. API Blueprint example 👉 20
  • 21. Validate Get stakeholders involved, think about use cases, validate ideas through mock servers, and get an agreement. Or you can use Prism: https://stoplight.io/open-source/pris m/ 21
  • 23. Implement It’s time for some coding. And it’s not just you! With a solid contract your stakeholders can start the development as well. Django REST Framework example 👉 23
  • 26. It’s official! It’s time to turn the agreement into a specification. rest_framework (with uritemplate and pyyaml) is enough to do this job. 26 $ python manage.py generateschema > openapi-schema.yml
  • 27. How to deal with changes? ▷ Path: mytodoapp.com/v1/tasks ▷ Querystring: mytodoapp.com/tasks?version=1.0 ▷ Host: v1.mytodoapp.com/tasks ▷ Accept header: Accept: application/json; version=1.0 ▷ Custom header: X-API-VERSION ▷ No versioning at all 🙃 https://www.django-rest-framework.org/api-guide/versioning/
  • 28. Release Turn the specification public. Publish the API documentation. drf-yasg is your sidekick here.
  • 29. Engage Promote your API, start monitoring, collect feedback, and learn from your mistakes and successes. 29
  • 31. Further readings: API-First Processes and Tools bit.ly/api-first-article 31
  • 32. Further readings: How To Design Great APIs With API-First Design bit.ly/3hQYw7d 32
  • 33. Further readings: Django for APIs leanpub.com/djangoforapis 33
  • 34. Tak! 🇩🇰 You can find me at: klauslaube.com.br github.com/kplaube Django Forum: kplaube