SlideShare a Scribd company logo
1 of 57
Download to read offline
Choisir entre une API
RPC, SOAP, REST, GraphQL?


Et si le problème était ailleurs ?
François-Guillaume Ribreau
—
Architect & Head of development @Ouest-France
🌟 SaaS founder of _______ ____ MotionDynamic,
Mailpopin
🚀 Trainer @EPSI_Nantes @UnivNantes
📢 Twitter/Github: @FGRibreau
<quick>
<history>
- pattern: procedure(arguments...): [result]
- ~1980
- principle: simplest form of API interaction
- goal: run a task on another address space
- often requires an IDL (Interface Definition Language)
- well-known implementations:
- XML-RPC (XML to encode calls & HTTP as transport)
- JSON-RPC (JSON to encode calls & HTTP as transport)
- Thrift, gRPC, Avro... and *lots* of other implementation
RPC - Remote Procedure Call
client api
procedure(arguments...)
result
- ~successor of XML-RPC
- XML-based messaging framework
- can work with any transport protocol (just need XML)
- XML everywhere
- IDL: WSDL, a schema of every available operations
- 1998 (+18 yrs after RPC principle)
- Spec WG closed on 10 July 2009 (+11 yrs)
SOAP - Simple Object Access Protocol
client api
envelope(message(call))
envelope(message(response))
- Roy Fielding, 2000 (20 yrs after RPC)
- based on the uniform and predefined set of stateless
operations from HTTP protocol
- request/response
- server-side data are made available through
representations of data in simple formats (e.g. JSON, XML)
- IDL: no schema required (state-of-the-art: OpenAPI)
REST - Representational State Transfer
client api
HTTP request
HTTP response
More power on the client-side at request time
GET /ressources/?fields=property1,property2
GET /ressources/:ressource_id?fields=property1,property2
(e.g. Google APIs, Facebook APIs)
REST - Representational State Transfer
client api
HTTP request
HTTP response
GET /fql?
q=SELECT+uid2+FROM+friend+WHERE+uid1=me()&a
ccess_token=…
FQL @ Facebook (2007)
https://query.yahooapis.com/v1/public/yql?
q=select title, link from rss
where url='https://engt.co/2JyTaQP'
&format=json
&env=store://datatables.org/alltableswithkeys
YQL @ Yahoo (2008)
- Another RPC protocol (not a Graph db)
- 3 verbs (in the REST sense):
- fetch (implicit, read requests)
- subscription (explicit, read streams)
- mutation (writes requests)
- introduce inversion of control between client & server
- client only request needed data
GraphQL
client api
HTTP request
HTTP response
</history>
</quick>
Wow
much work
so specifications
client api
Current
State of the art
3-tier
Database
API
Client
3-tier
Database
(Tables / Views)
API
(Models)
Client
Validation
Database
(Schema (constraint))
API
(Models (validation))
Client
(validation)
Authorization
Database
(Users/roles, policies)
API
(Authorization
middleware)
Client
Etc… 🕰
Database
…
API
…
Client
Only for
data
persistence
Without
data
persistence
Mostly for
data
persistence
(+ some
MQueing)
What kind of API do you write the most?
~90% of the time
it's. just. CRUD.
effort =>
data
api
client
user
data
api
client
user
effort =>
Let's build a
persistence API
api.motiondynamic.tech
Fast highly dynamic video generation at scale 🚀
api
SQLHTTP
data
(PostgreSQL)
• HTTP request handling
• Authentication
• Authorization
• Request Parsing
• Request Validation
• Database Communication
• Database Response Handling (deserialization)
• Output format serialization
• HTTP Response Building
Persistence API
our job
api
SQLHTTP
Persistence API
TL;DR: HTTP <-> SQL mapping
… with a lot of space for potential mistakes. our job
data
(PostgreSQL)
Database Modelling 101
v1_0 schema authentication schema
theme schema
video schema
….
view schemastored
fn
generations
signIn signUp
themes
api
(PostgREST)
data
(PostgreSQL)
Persistence API
<= our job
#SSoT #DRY
v1_0
schema
client
HTTP / REST / (JSON,CSV)
Are we
serious?
Schema modelling
public private
v1_0 schema authentication schema
theme schema
video schema
….
view schemastored
fn
projects signIn signUp
Postgrest
videos
generations
startVideoGeneration
Read / Write requests
(read, view) GET /themes
(read, view) GET /videos
(read, view) GET /generations
(write, stored function) POST /rpc/signUp
(write, stored function) POST /rpc/signIn
(write, stored function) POST /rpc/startVideoGeneration
DBv1_0
schema
api
(PostgREST)
GET /themes?downloads=gte.1000&isMine=is.true
GET /themes?select=downloads::text,name,description
GET /stuff?metadata->a->>b=eq.2
GET /themes?select=id,name,generations{createdAt}
&order=name.asc&generations.order=createdAt.desc
How do you manage
projection, filtering, ordering?
Read / Write requests
(read, view) GET /themes
(read, view) GET /videos
(read, view) GET /generations
(write, stored function) POST /rpc/signUp
(write, stored function) POST /rpc/signIn
(write, stored function) POST /rpc/startVideoGeneration
(write) POST /generations
INSTEAD OF
create trigger generations_mutation
INSTEAD OF INSERT OR UPDATE OR DELETE
ON v1_0.generations
for each row execute procedure
video.mutation_generations_trigger()
Trigger
create or replace function video.mutation_generations_trigger() returns trigger as $$
declare
begin
if (tg_op = 'DELETE') then
-- delete generation
return new;
elsif (tg_op = 'UPDATE') then
-- update generation
return new;
elsif (tg_op = 'INSERT') then
-- create generation
return new;
end if;
end;
$$ security definer language plpgsql;
pl/pgsql ? It's 2018: pl/v8 (javascript) - pl/python - pl/java - pl/tcl
State-of-the-art API performance
api
data
(PostgreSQL)
client
HTTP / REST / JSON
deserialize db response
serialize http JSON response
serialize to internal representation
API performance 🚀
api
(PostgREST)
data
(PostgreSQL)
client
HTTP / REST / JSON
serialize result to JSON
“PostgreSQL JSON encoder is fast, it’s C fast.
For a large JSON object graph PostgreSQL JSON
generation can offer well over 12x the throughput.
It can be 2x/10x faster than ActiveRecord or even 160x
for large responses”
https://hashrocket.com/blog/posts/faster-json-generation-with-postgresql
Versioning
public private
v1_0 schema
v2_0 schema
authentication schema
theme schema
video schema
….
view schemastored
fn
videos signIn signUp
generations logIn signUp
How do you manage authentication?
How do you manage authorization?
CREATE ROLE authenticator NOINHERIT LOGIN;
CREATE ROLE anonymous;
CREATE ROLE authenticated_user;
GRANT anonymous, authenticated_user TO authenticator;
How do you manage authorization?
Row Level Security (PG 9.5+)
ALTER TABLE video.generation ENABLE ROW LEVEL SECURITY;
create policy generation_access_policy on video.generation to api
-- a user can only see its own generations, admin can see everything
using (
(request.user_role() = 'videoRequester' and user_id =
request.user_id()) or request.user_role() = 'admin')
-- only admin can change anyone generation data
with check (request.user_role() = 'admin');
3 lines of SQL
Reliable security model (closed by default)
Declarative
Expressive
Imperative
Programming
"how to do"
%📺'
Declarative
Programming
"what to do"
(🚀)
How do you manage
emails/3rd parties?
pg_notify (PG 9.2+)
http://bit.ly/2oNbaKy
How do you manage
emails/3rd parties?
pg_notify (PG 9.2+)
http://bit.ly/2JDCsQu
Rate-limiting? Headers?
Monitoring? Tracing? Custom-logic ?
Respect the separation of concerns
(that's what Service Mesh is all about btw)
data
api
client
user
proxy
(nginx/openresty | istio proxy | ...)
How to manage documentation?
OpenAPI (Swagger) format
automatically extracted from schema
How to manage
code-reviews, tests?
It’s just SQL.
SQL unit test: pgTAP
Functional tests: Supertest / Jest
How to manage migrations?
Full migration management
sqitch/apgdiff
How to build & deploy?
local env. + docker 🐳
(watch + SQL auto-reload)
Cloud (PostgreSQL + PostgREST + OpenResty)
apply migrations
rolling deploy PostgREST/OpenResty
run unit & functional tests
test migrations
One
more
thing
REST & GraphQL api
(PostgREST + SubZero)
data
(PostgreSQL)
<= our job
#SSoT #DRY
v1_0
schema
client
GraphQL ?
subZero ❤
GraphQL & REST (PostgREST) API for your database
This philosophy is
gaining traction
PostgraphQL - A GraphQL API created by reflection
over a PostgreSQL schema: NodeJS + PostgreSQL
Prisma - Prisma turns your database into a realtime
GraphQL API: Scala + MySQL/Postgres (upcoming: MongoDB,
ElasticSearch)
Graphql-engine - Instant GraphQL APIs on Postgres
with fine grained access control: NodeJS + PostgreSQL
Et si le problème était ailleurs ?
API
data
(BDD)
v1_0
schema
client
REST GraphQL Tomorrow?
Free plans for Redis
administration & monitoring
at redsmin.com
We are looking for Front-end Developers
twitter.com/iadvizetech
Questions?
@FGRibreau
No more server-side rendering pain,
1 url = 1 chart
image-charts.com
https://apple.github.io/foundationdb/transaction-manifesto.html
Performance and scalability?
We know of no practical limits to the scalability or performance of systems supporting
transactions. When the movement toward NoSQL databases began, early systems, such
as Google Bigtable, adopted minimal designs tightly focused on the scalability and
performance. Features familiar from relational databases had been aggressively shed and
the supposition was that the abandoned features were unnecessary or even harmful
for scalability and performance goals.

Those suppositions were wrong. It is becoming clear that supporting transactions is a
matter of engineering effort, not a fundamental tradeoff in the design space.
Algorithms for maintaining transactional integrity can be distributed and scale out like
many other problems. 

Transactional integrity does come at a CPU cost, but in our experience that cost is less
than 10% of total system CPU. This is a small price to pay for transactional integrity and
can easily be made up elsewhere.
I am quite convinced that in fact computing will
become a very important science. (🐶💩)
But at the moment we are in a very
primitive state of development; we don't
know the basic principles yet and we must
learn them first. 

If universities spend their time teaching the
state of the art, they will not discover
these principles and that, surely, is what
academics should be doing.



— Christopher Strachey, 1969 (49 yrs ago)

(quote by Edsger W. Dijkstra)
https://bit.ly/2pMI7aJ
“
”

More Related Content

What's hot

Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practiceGuilherme Garnier
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPCGuo Jing
 
Scaling Push Messaging for Millions of Netflix Devices
Scaling Push Messaging for Millions of Netflix DevicesScaling Push Messaging for Millions of Netflix Devices
Scaling Push Messaging for Millions of Netflix DevicesSusheel Aroskar
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelClaus Ibsen
 
How to build a streaming Lakehouse with Flink, Kafka, and Hudi
How to build a streaming Lakehouse with Flink, Kafka, and HudiHow to build a streaming Lakehouse with Flink, Kafka, and Hudi
How to build a streaming Lakehouse with Flink, Kafka, and HudiFlink Forward
 
Capabilities for Resources and Effects
Capabilities for Resources and EffectsCapabilities for Resources and Effects
Capabilities for Resources and EffectsMartin Odersky
 
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...GetInData
 
Temporal intro and event loop
Temporal intro and event loopTemporal intro and event loop
Temporal intro and event loopTihomirSurdilovic
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageAniruddha Chakrabarti
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testingupadhyay_25
 

What's hot (20)

Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practice
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
 
Scaling Push Messaging for Millions of Netflix Devices
Scaling Push Messaging for Millions of Netflix DevicesScaling Push Messaging for Millions of Netflix Devices
Scaling Push Messaging for Millions of Netflix Devices
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
KrakenD API Gateway
KrakenD API GatewayKrakenD API Gateway
KrakenD API Gateway
 
Integrating Apache Spark and NiFi for Data Lakes
Integrating Apache Spark and NiFi for Data LakesIntegrating Apache Spark and NiFi for Data Lakes
Integrating Apache Spark and NiFi for Data Lakes
 
Memory in go
Memory in goMemory in go
Memory in go
 
Models for hierarchical data
Models for hierarchical dataModels for hierarchical data
Models for hierarchical data
 
How to build a streaming Lakehouse with Flink, Kafka, and Hudi
How to build a streaming Lakehouse with Flink, Kafka, and HudiHow to build a streaming Lakehouse with Flink, Kafka, and Hudi
How to build a streaming Lakehouse with Flink, Kafka, and Hudi
 
GRPC.pptx
GRPC.pptxGRPC.pptx
GRPC.pptx
 
Capabilities for Resources and Effects
Capabilities for Resources and EffectsCapabilities for Resources and Effects
Capabilities for Resources and Effects
 
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
 
Temporal intro and event loop
Temporal intro and event loopTemporal intro and event loop
Temporal intro and event loop
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Json Web Token - JWT
Json Web Token - JWTJson Web Token - JWT
Json Web Token - JWT
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testing
 
Building Netty Servers
Building Netty ServersBuilding Netty Servers
Building Netty Servers
 
Rest API
Rest APIRest API
Rest API
 

Similar to Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ailleurs ?

StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopJimmy Guerrero
 
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays
 
apidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuseapidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuseapidays
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCTim Burks
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays
 
Serverless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersServerless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersSashko Stubailo
 
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}Md. Sadhan Sarker
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a bossFrancisco Ribeiro
 
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...chbornet
 
RESTful API-centric Universe
RESTful API-centric UniverseRESTful API-centric Universe
RESTful API-centric UniverseTihomir Opačić
 
PostgreSQL 10; Long Awaited Enterprise Solutions
PostgreSQL 10; Long Awaited Enterprise SolutionsPostgreSQL 10; Long Awaited Enterprise Solutions
PostgreSQL 10; Long Awaited Enterprise SolutionsJulyanto SUTANDANG
 
Webinar september 2013
Webinar september 2013Webinar september 2013
Webinar september 2013Marc Gille
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherSashko Stubailo
 
Adding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIsAdding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIsMichael Petychakis
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)Sascha Wenninger
 

Similar to Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ailleurs ? (20)

Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js Workshop
 
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
 
apidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuseapidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuse
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
Serverless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersServerless GraphQL for Product Developers
Serverless GraphQL for Product Developers
 
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a boss
 
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
 
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
 
RESTful API-centric Universe
RESTful API-centric UniverseRESTful API-centric Universe
RESTful API-centric Universe
 
PostgreSQL 10; Long Awaited Enterprise Solutions
PostgreSQL 10; Long Awaited Enterprise SolutionsPostgreSQL 10; Long Awaited Enterprise Solutions
PostgreSQL 10; Long Awaited Enterprise Solutions
 
Webinar september 2013
Webinar september 2013Webinar september 2013
Webinar september 2013
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits together
 
Adding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIsAdding Rules on Existing Hypermedia APIs
Adding Rules on Existing Hypermedia APIs
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
 

More from François-Guillaume Ribreau

REX LEAN- Créer un SaaS et être rentable après 6 mois
REX LEAN- Créer un SaaS et être rentable après 6 moisREX LEAN- Créer un SaaS et être rentable après 6 mois
REX LEAN- Créer un SaaS et être rentable après 6 moisFrançois-Guillaume Ribreau
 
⛳️ Votre API passe-t-elle le contrôle technique ?
⛳️ Votre API passe-t-elle le contrôle technique ?⛳️ Votre API passe-t-elle le contrôle technique ?
⛳️ Votre API passe-t-elle le contrôle technique ?François-Guillaume Ribreau
 
He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!François-Guillaume Ribreau
 
Une plateforme moderne pour le groupe SIPA/Ouest-France 
Une plateforme moderne pour le groupe SIPA/Ouest-France Une plateforme moderne pour le groupe SIPA/Ouest-France 
Une plateforme moderne pour le groupe SIPA/Ouest-France François-Guillaume Ribreau
 
[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...
[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...
[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...François-Guillaume Ribreau
 
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...François-Guillaume Ribreau
 
Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)François-Guillaume Ribreau
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)François-Guillaume Ribreau
 
Automatic constraints as a team maturity accelerator for startups
Automatic constraints as a team maturity accelerator for startupsAutomatic constraints as a team maturity accelerator for startups
Automatic constraints as a team maturity accelerator for startupsFrançois-Guillaume Ribreau
 
Les enjeux de l'information et de l'algorithmique dans notre société
Les enjeux de l'information et de l'algorithmique dans notre sociétéLes enjeux de l'information et de l'algorithmique dans notre société
Les enjeux de l'information et de l'algorithmique dans notre sociétéFrançois-Guillaume Ribreau
 
Continous Integration of (JS) projects & check-build philosophy
Continous Integration of (JS) projects & check-build philosophyContinous Integration of (JS) projects & check-build philosophy
Continous Integration of (JS) projects & check-build philosophyFrançois-Guillaume Ribreau
 

More from François-Guillaume Ribreau (17)

REX LEAN- Créer un SaaS et être rentable après 6 mois
REX LEAN- Créer un SaaS et être rentable après 6 moisREX LEAN- Créer un SaaS et être rentable après 6 mois
REX LEAN- Créer un SaaS et être rentable après 6 mois
 
⛳️ Votre API passe-t-elle le contrôle technique ?
⛳️ Votre API passe-t-elle le contrôle technique ?⛳️ Votre API passe-t-elle le contrôle technique ?
⛳️ Votre API passe-t-elle le contrôle technique ?
 
He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!
 
Une plateforme moderne pour le groupe SIPA/Ouest-France 
Une plateforme moderne pour le groupe SIPA/Ouest-France Une plateforme moderne pour le groupe SIPA/Ouest-France 
Une plateforme moderne pour le groupe SIPA/Ouest-France 
 
[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...
[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...
[BreizhCamp, format 15min] Construire et automatiser l'ecosystème de son Saa...
 
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgR...
 
RedisConf 2016 - Redis usage and ecosystem
RedisConf 2016 - Redis usage and ecosystemRedisConf 2016 - Redis usage and ecosystem
RedisConf 2016 - Redis usage and ecosystem
 
Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)Implementing pattern-matching in JavaScript (full version)
Implementing pattern-matching in JavaScript (full version)
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)
 
Automatic constraints as a team maturity accelerator for startups
Automatic constraints as a team maturity accelerator for startupsAutomatic constraints as a team maturity accelerator for startups
Automatic constraints as a team maturity accelerator for startups
 
Development Principles & Philosophy
Development Principles & PhilosophyDevelopment Principles & Philosophy
Development Principles & Philosophy
 
Les enjeux de l'information et de l'algorithmique dans notre société
Les enjeux de l'information et de l'algorithmique dans notre sociétéLes enjeux de l'information et de l'algorithmique dans notre société
Les enjeux de l'information et de l'algorithmique dans notre société
 
How I monitor SaaS products
How I monitor SaaS productsHow I monitor SaaS products
How I monitor SaaS products
 
Continous Integration of (JS) projects & check-build philosophy
Continous Integration of (JS) projects & check-build philosophyContinous Integration of (JS) projects & check-build philosophy
Continous Integration of (JS) projects & check-build philosophy
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Approfondissement CSS3
Approfondissement CSS3Approfondissement CSS3
Approfondissement CSS3
 
Découverte HTML5/CSS3
Découverte HTML5/CSS3Découverte HTML5/CSS3
Découverte HTML5/CSS3
 

Recently uploaded

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 

Recently uploaded (20)

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 

Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ailleurs ?

  • 1. Choisir entre une API RPC, SOAP, REST, GraphQL? 
 Et si le problème était ailleurs ?
  • 2. François-Guillaume Ribreau — Architect & Head of development @Ouest-France 🌟 SaaS founder of _______ ____ MotionDynamic, Mailpopin 🚀 Trainer @EPSI_Nantes @UnivNantes 📢 Twitter/Github: @FGRibreau
  • 4. - pattern: procedure(arguments...): [result] - ~1980 - principle: simplest form of API interaction - goal: run a task on another address space - often requires an IDL (Interface Definition Language) - well-known implementations: - XML-RPC (XML to encode calls & HTTP as transport) - JSON-RPC (JSON to encode calls & HTTP as transport) - Thrift, gRPC, Avro... and *lots* of other implementation RPC - Remote Procedure Call client api procedure(arguments...) result
  • 5. - ~successor of XML-RPC - XML-based messaging framework - can work with any transport protocol (just need XML) - XML everywhere - IDL: WSDL, a schema of every available operations - 1998 (+18 yrs after RPC principle) - Spec WG closed on 10 July 2009 (+11 yrs) SOAP - Simple Object Access Protocol client api envelope(message(call)) envelope(message(response))
  • 6. - Roy Fielding, 2000 (20 yrs after RPC) - based on the uniform and predefined set of stateless operations from HTTP protocol - request/response - server-side data are made available through representations of data in simple formats (e.g. JSON, XML) - IDL: no schema required (state-of-the-art: OpenAPI) REST - Representational State Transfer client api HTTP request HTTP response
  • 7. More power on the client-side at request time GET /ressources/?fields=property1,property2 GET /ressources/:ressource_id?fields=property1,property2 (e.g. Google APIs, Facebook APIs) REST - Representational State Transfer client api HTTP request HTTP response
  • 8. GET /fql? q=SELECT+uid2+FROM+friend+WHERE+uid1=me()&a ccess_token=… FQL @ Facebook (2007) https://query.yahooapis.com/v1/public/yql? q=select title, link from rss where url='https://engt.co/2JyTaQP' &format=json &env=store://datatables.org/alltableswithkeys YQL @ Yahoo (2008)
  • 9. - Another RPC protocol (not a Graph db) - 3 verbs (in the REST sense): - fetch (implicit, read requests) - subscription (explicit, read streams) - mutation (writes requests) - introduce inversion of control between client & server - client only request needed data GraphQL client api HTTP request HTTP response
  • 18. Only for data persistence Without data persistence Mostly for data persistence (+ some MQueing) What kind of API do you write the most? ~90% of the time it's. just. CRUD.
  • 22. api.motiondynamic.tech Fast highly dynamic video generation at scale 🚀
  • 23. api SQLHTTP data (PostgreSQL) • HTTP request handling • Authentication • Authorization • Request Parsing • Request Validation • Database Communication • Database Response Handling (deserialization) • Output format serialization • HTTP Response Building Persistence API our job
  • 24. api SQLHTTP Persistence API TL;DR: HTTP <-> SQL mapping … with a lot of space for potential mistakes. our job data (PostgreSQL)
  • 25. Database Modelling 101 v1_0 schema authentication schema theme schema video schema …. view schemastored fn generations signIn signUp themes
  • 26. api (PostgREST) data (PostgreSQL) Persistence API <= our job #SSoT #DRY v1_0 schema client HTTP / REST / (JSON,CSV)
  • 28. Schema modelling public private v1_0 schema authentication schema theme schema video schema …. view schemastored fn projects signIn signUp Postgrest videos generations startVideoGeneration
  • 29. Read / Write requests (read, view) GET /themes (read, view) GET /videos (read, view) GET /generations (write, stored function) POST /rpc/signUp (write, stored function) POST /rpc/signIn (write, stored function) POST /rpc/startVideoGeneration DBv1_0 schema api (PostgREST)
  • 30. GET /themes?downloads=gte.1000&isMine=is.true GET /themes?select=downloads::text,name,description GET /stuff?metadata->a->>b=eq.2 GET /themes?select=id,name,generations{createdAt} &order=name.asc&generations.order=createdAt.desc How do you manage projection, filtering, ordering?
  • 31. Read / Write requests (read, view) GET /themes (read, view) GET /videos (read, view) GET /generations (write, stored function) POST /rpc/signUp (write, stored function) POST /rpc/signIn (write, stored function) POST /rpc/startVideoGeneration (write) POST /generations
  • 32. INSTEAD OF create trigger generations_mutation INSTEAD OF INSERT OR UPDATE OR DELETE ON v1_0.generations for each row execute procedure video.mutation_generations_trigger()
  • 33. Trigger create or replace function video.mutation_generations_trigger() returns trigger as $$ declare begin if (tg_op = 'DELETE') then -- delete generation return new; elsif (tg_op = 'UPDATE') then -- update generation return new; elsif (tg_op = 'INSERT') then -- create generation return new; end if; end; $$ security definer language plpgsql; pl/pgsql ? It's 2018: pl/v8 (javascript) - pl/python - pl/java - pl/tcl
  • 34. State-of-the-art API performance api data (PostgreSQL) client HTTP / REST / JSON deserialize db response serialize http JSON response serialize to internal representation
  • 35. API performance 🚀 api (PostgREST) data (PostgreSQL) client HTTP / REST / JSON serialize result to JSON “PostgreSQL JSON encoder is fast, it’s C fast. For a large JSON object graph PostgreSQL JSON generation can offer well over 12x the throughput. It can be 2x/10x faster than ActiveRecord or even 160x for large responses” https://hashrocket.com/blog/posts/faster-json-generation-with-postgresql
  • 36. Versioning public private v1_0 schema v2_0 schema authentication schema theme schema video schema …. view schemastored fn videos signIn signUp generations logIn signUp
  • 37. How do you manage authentication?
  • 38. How do you manage authorization? CREATE ROLE authenticator NOINHERIT LOGIN; CREATE ROLE anonymous; CREATE ROLE authenticated_user; GRANT anonymous, authenticated_user TO authenticator;
  • 39. How do you manage authorization? Row Level Security (PG 9.5+) ALTER TABLE video.generation ENABLE ROW LEVEL SECURITY; create policy generation_access_policy on video.generation to api -- a user can only see its own generations, admin can see everything using ( (request.user_role() = 'videoRequester' and user_id = request.user_id()) or request.user_role() = 'admin') -- only admin can change anyone generation data with check (request.user_role() = 'admin'); 3 lines of SQL Reliable security model (closed by default) Declarative Expressive
  • 41. How do you manage emails/3rd parties? pg_notify (PG 9.2+) http://bit.ly/2oNbaKy
  • 42. How do you manage emails/3rd parties? pg_notify (PG 9.2+) http://bit.ly/2JDCsQu
  • 43. Rate-limiting? Headers? Monitoring? Tracing? Custom-logic ? Respect the separation of concerns (that's what Service Mesh is all about btw) data api client user proxy (nginx/openresty | istio proxy | ...)
  • 44.
  • 45. How to manage documentation? OpenAPI (Swagger) format automatically extracted from schema
  • 46. How to manage code-reviews, tests? It’s just SQL. SQL unit test: pgTAP Functional tests: Supertest / Jest
  • 47. How to manage migrations? Full migration management sqitch/apgdiff
  • 48. How to build & deploy? local env. + docker 🐳 (watch + SQL auto-reload) Cloud (PostgreSQL + PostgREST + OpenResty) apply migrations rolling deploy PostgREST/OpenResty run unit & functional tests test migrations
  • 50. REST & GraphQL api (PostgREST + SubZero) data (PostgreSQL) <= our job #SSoT #DRY v1_0 schema client GraphQL ?
  • 51. subZero ❤ GraphQL & REST (PostgREST) API for your database
  • 53. PostgraphQL - A GraphQL API created by reflection over a PostgreSQL schema: NodeJS + PostgreSQL Prisma - Prisma turns your database into a realtime GraphQL API: Scala + MySQL/Postgres (upcoming: MongoDB, ElasticSearch) Graphql-engine - Instant GraphQL APIs on Postgres with fine grained access control: NodeJS + PostgreSQL
  • 54. Et si le problème était ailleurs ? API data (BDD) v1_0 schema client REST GraphQL Tomorrow?
  • 55. Free plans for Redis administration & monitoring at redsmin.com We are looking for Front-end Developers twitter.com/iadvizetech Questions? @FGRibreau No more server-side rendering pain, 1 url = 1 chart image-charts.com
  • 56. https://apple.github.io/foundationdb/transaction-manifesto.html Performance and scalability? We know of no practical limits to the scalability or performance of systems supporting transactions. When the movement toward NoSQL databases began, early systems, such as Google Bigtable, adopted minimal designs tightly focused on the scalability and performance. Features familiar from relational databases had been aggressively shed and the supposition was that the abandoned features were unnecessary or even harmful for scalability and performance goals. Those suppositions were wrong. It is becoming clear that supporting transactions is a matter of engineering effort, not a fundamental tradeoff in the design space. Algorithms for maintaining transactional integrity can be distributed and scale out like many other problems. Transactional integrity does come at a CPU cost, but in our experience that cost is less than 10% of total system CPU. This is a small price to pay for transactional integrity and can easily be made up elsewhere.
  • 57. I am quite convinced that in fact computing will become a very important science. (🐶💩) But at the moment we are in a very primitive state of development; we don't know the basic principles yet and we must learn them first. 
 If universities spend their time teaching the state of the art, they will not discover these principles and that, surely, is what academics should be doing. — Christopher Strachey, 1969 (49 yrs ago) (quote by Edsger W. Dijkstra) https://bit.ly/2pMI7aJ “ ”