SlideShare a Scribd company logo
Une API REST sans code grâce à
Postgrest, Sub0 et PostgreSQL
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgREST, sub0 et PostgreSQL
François-Guillaume Ribreau
—
François-Guillaume Ribreau
—
Ex-Bringr cofounder & CTO
François-Guillaume Ribreau
—
Ex-Bringr cofounder & CTO
Ex-Architect @iAdvize
François-Guillaume Ribreau
—
Ex-Bringr cofounder & CTO
Ex-Architect @iAdvize
Architect & Head of development @Ouest-France
François-Guillaume Ribreau
—
Ex-Bringr cofounder & CTO
Ex-Architect @iAdvize
Architect & Head of development @Ouest-France
🌟 Founded @imagecharts @Redsmin @mailpopin
François-Guillaume Ribreau
—
Ex-Bringr cofounder & CTO
Ex-Architect @iAdvize
Architect & Head of development @Ouest-France
🌟 Founded @imagecharts @Redsmin @mailpopin
🚀 Trainer @EPSI_Nantes @UnivNantes
François-Guillaume Ribreau
—
Ex-Bringr cofounder & CTO
Ex-Architect @iAdvize
Architect & Head of development @Ouest-France
🌟 Founded @imagecharts @Redsmin @mailpopin
🚀 Trainer @EPSI_Nantes @UnivNantes
📢 Twitter/Github: @FGRibreau
[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgREST, sub0 et PostgreSQL
API?
API?
Persistence API?
Single Source of Truth?
API?
Persistence API?
Single Source of Truth?
DRY?
API?
Persistence API?
3-tier
Database
API
Frontend
3-tier
Database
(Tables/Views
Schema)
API
(Models / ORM)
Front
Validation
Database
(Schema (constraint))
API
(Models / ORM
(validation))
Front
(validation)
Relation
Database
(Schema (referential
integrity))
API
(Models / ORM
(relations))
Front
Authorization
Database
(Users, roles,
policies)
API
(Authorization
middleware)
Front
Etc… 🕰
Database
…
API
…
Front
API
DB
• HTTP request handling
• Authentication
• Authorization
• Request Parsing
• Request Validation
• Database Communication
• Database Response Handling
• HTTP Response Building
Persistence API
your job
API
SQLHTTP DB
• HTTP request handling
• Authentication
• Authorization
• Request Parsing
• Request Validation
• Database Communication
• Database Response Handling
• HTTP Response Building
Persistence API
your job
API
SQLHTTP DB
Persistence API
TL;DR: HTTP <-> SQL mapping
… with a lot of space for potential mistakes.
your job
Postgrest DB
Persistence API
your job
#SSoT #DRY
Are we
serious?
Are we
serious?
Postgrest DB
Persistence API
your job
#SSoT #DRY
schema
Postgrest
Read / Write requests
(read) GET /projects
(read) GET /account
(write) POST /rpc/signUp
(write) POST /rpc/logIn
How do you manage
projection, filtering, ordering?
GET /people?age=gte.18&isStudent=is.true
How do you manage
projection, filtering, ordering?
GET /people?age=gte.18&isStudent=is.true
GET /people?select=age::text,height,weight
How do you manage
projection, filtering, ordering?
GET /people?age=gte.18&isStudent=is.true
GET /people?select=age::text,height,weight
GET /stuff?metadata->a->>b=eq.2
How do you manage
projection, filtering, ordering?
GET /people?age=gte.18&isStudent=is.true
GET /people?select=age::text,height,weight
GET /stuff?metadata->a->>b=eq.2
GET /projects?select=id,name,tasks{id,name}
&order=id.asc&tasks.order=name.asc
How do you manage
projection, filtering, ordering?
How do you manage versioning?
How do you manage versioning?
public private
How do you manage versioning?
public private
authentication schema
i18n schema
app schema
….
schema
How do you manage versioning?
public private
v1_0 schema authentication schema
i18n schema
app schema
….
view schemastored
fn
projects signIn signUp
How do you manage versioning?
public private
v1_0 schema
v2_0 schema
authentication schema
i18n schema
app schema
….
view schemastored
fn
projects signIn signUp
projects logIn signUp
How do you manage authentication?
How do you manage authentication?
How do you manage authorization?
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?
How do you manage authorization?
Row Level Security (PG 9.5+)
How do you manage authorization?
Row Level Security (PG 9.5+)
ALTER TABLE app.project ENABLE ROW LEVEL SECURITY;
CREATE POLICY user_can_only_access_its_own_project on app.project
— Any rows for which the expression returns false or null will not be visible to the user
(in a SELECT), and will not be available for modification (in an UPDATE or DELETE)
using (user_id = current_setting('request.jwt.claim.user_id'))
How do you manage authorization?
Row Level Security (PG 9.5+)
ALTER TABLE app.project ENABLE ROW LEVEL SECURITY;
CREATE POLICY user_can_only_access_its_own_project on app.project
— Any rows for which the expression returns false or null will not be visible to the user
(in a SELECT), and will not be available for modification (in an UPDATE or DELETE)
using (user_id = current_setting('request.jwt.claim.user_id'))
2 lines of SQL
Reliable security model (closed by default)
Declarative
Expressive
How do you manage
emails/3rd parties?
http://bit.ly/2oNbaKy
How do you manage
emails/3rd parties?
pg_notify (PG 9.2+)
http://bit.ly/2oNbaKy
How do you manage documentation?
How do you manage documentation?
OpenAPI (Swagger) format
automatically extracted from schema
How do you manage
code-reviews, tests, migrations?
Pivotal/trilogy
pg_tag
pg_unit
pg_unit2
How do you manage
code-reviews, tests, migrations?
It’s just SQL.
Pivotal/trilogy
pg_tag
pg_unit
pg_unit2
One
more
thing
PostgraphQL
A GraphQL API created by reflection over a PostgreSQL schema. (NodeJS)
Sub0 ❤
GraphQL & REST API for your database
Free plans for Redis
administration & monitoring
at redsmin.com
Questions?
@FGRibreau
No more server-side rendering pain,
1 url = 1 chart
image-charts.com
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

More Related Content

What's hot (20)

PPTX
Rapid development with angular
Hongbiao Chen
 
PDF
Breaking News and Breaking Software by Andy Hume
SyncConf
 
PDF
Metasepi team meeting #16: Safety on ATS language + MCU
Kiwamu Okabe
 
PDF
Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021
César Hernández
 
PDF
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Matt Raible
 
PDF
React native
Omid Nikrah
 
PDF
Use Groovy&Grails in your spring boot projects
Paradigma Digital
 
PDF
Power of React Native
Murugan Durai
 
PDF
Testing Angular Applications - Jfokus 2017
Matt Raible
 
PDF
5 best practices for (web/ software) development (2010)
Erwin Elling
 
PDF
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
Roy Derks
 
PDF
Spring IO '15 - Developing microservices, Spring Boot or Grails?
Fátima Casaú Pérez
 
PDF
PyCon Korea 2019 REST API Document Generation
용선 이
 
PDF
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
Matt Raible
 
PDF
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
Matt Raible
 
PDF
ATS Programming Tutorial
Kiwamu Okabe
 
PDF
Cloud Native Progressive Web Applications - Denver JUG 2016
Matt Raible
 
PDF
20180524 Android Taipei : RxJava Threading
PRADA Hsiung
 
PDF
What's New in JHipsterLand - DevNexus 2017
Matt Raible
 
PDF
Testing Angular 2 Applications - Rich Web 2016
Matt Raible
 
Rapid development with angular
Hongbiao Chen
 
Breaking News and Breaking Software by Andy Hume
SyncConf
 
Metasepi team meeting #16: Safety on ATS language + MCU
Kiwamu Okabe
 
Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021
César Hernández
 
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Matt Raible
 
React native
Omid Nikrah
 
Use Groovy&Grails in your spring boot projects
Paradigma Digital
 
Power of React Native
Murugan Durai
 
Testing Angular Applications - Jfokus 2017
Matt Raible
 
5 best practices for (web/ software) development (2010)
Erwin Elling
 
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
Roy Derks
 
Spring IO '15 - Developing microservices, Spring Boot or Grails?
Fátima Casaú Pérez
 
PyCon Korea 2019 REST API Document Generation
용선 이
 
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
Matt Raible
 
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
Matt Raible
 
ATS Programming Tutorial
Kiwamu Okabe
 
Cloud Native Progressive Web Applications - Denver JUG 2016
Matt Raible
 
20180524 Android Taipei : RxJava Threading
PRADA Hsiung
 
What's New in JHipsterLand - DevNexus 2017
Matt Raible
 
Testing Angular 2 Applications - Rich Web 2016
Matt Raible
 

Similar to [BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgREST, sub0 et PostgreSQL (20)

PPTX
A Tour of PostgREST
begriffs
 
ODP
Postgrest: the REST API for PostgreSQL databases
Lucio Grenzi
 
PPTX
Day 9 - PostgreSQL Application Architecture
Barry Jones
 
PPTX
APIs SOS: A Tactical Guide to Detection and Response - Anjum Ahuja, Traceable.ai
Nordic APIs
 
PDF
apidays LIVE Australia 2021 - Levelling up database security by thinking in A...
apidays
 
PPTX
Http and REST APIs.
Rahul Tanwani
 
PDF
Writing infinite scalability web applications with PHP and PostgreSQL
Gabriele Bartolini
 
PPTX
PostgREST Design Philosophy
begriffs
 
PPTX
CakeFest 2013 - A-Z REST APIs
anthony_putignano
 
PPTX
CakeFest 2013 - A-Z REST APIs
anthony_putignano
 
PDF
API Security - OWASP top 10 for APIs + tips for pentesters
Inon Shkedy
 
PPTX
API Services: Building State-of-the-Art APIs
Apigee | Google Cloud
 
PDF
Let your DBAs get some REST(api)
Ludovico Caldara
 
PDF
BPM and SOA Are Going Mobile: An Architectural Perspective
Guido Schmutz
 
PDF
REST APIs
Arthur De Magalhaes
 
PDF
Dev objecttives-2015 auth-auth-fine-grained-slides
ColdFusionConference
 
PDF
Authentication Control
devObjective
 
PPTX
Securing Microservices with Spring Cloud Security
Will Tran
 
PDF
Checkmarx meetup API Security - API Security in depth - Inon Shkedy
Adar Weidman
 
PDF
Software Developer Portfolio: Backend Architecture & Performance Optimization
kiwoong (daniel) kim
 
A Tour of PostgREST
begriffs
 
Postgrest: the REST API for PostgreSQL databases
Lucio Grenzi
 
Day 9 - PostgreSQL Application Architecture
Barry Jones
 
APIs SOS: A Tactical Guide to Detection and Response - Anjum Ahuja, Traceable.ai
Nordic APIs
 
apidays LIVE Australia 2021 - Levelling up database security by thinking in A...
apidays
 
Http and REST APIs.
Rahul Tanwani
 
Writing infinite scalability web applications with PHP and PostgreSQL
Gabriele Bartolini
 
PostgREST Design Philosophy
begriffs
 
CakeFest 2013 - A-Z REST APIs
anthony_putignano
 
CakeFest 2013 - A-Z REST APIs
anthony_putignano
 
API Security - OWASP top 10 for APIs + tips for pentesters
Inon Shkedy
 
API Services: Building State-of-the-Art APIs
Apigee | Google Cloud
 
Let your DBAs get some REST(api)
Ludovico Caldara
 
BPM and SOA Are Going Mobile: An Architectural Perspective
Guido Schmutz
 
Dev objecttives-2015 auth-auth-fine-grained-slides
ColdFusionConference
 
Authentication Control
devObjective
 
Securing Microservices with Spring Cloud Security
Will Tran
 
Checkmarx meetup API Security - API Security in depth - Inon Shkedy
Adar Weidman
 
Software Developer Portfolio: Backend Architecture & Performance Optimization
kiwoong (daniel) kim
 
Ad

More from François-Guillaume Ribreau (13)

PDF
REX LEAN- Créer un SaaS et être rentable après 6 mois
François-Guillaume Ribreau
 
PDF
Une plateforme moderne pour le groupe SIPA/Ouest-France 
François-Guillaume Ribreau
 
PDF
RedisConf 2016 - Redis usage and ecosystem
François-Guillaume Ribreau
 
PDF
Implementing pattern-matching in JavaScript (full version)
François-Guillaume Ribreau
 
PDF
Implementing pattern-matching in JavaScript (short version)
François-Guillaume Ribreau
 
PDF
Automatic constraints as a team maturity accelerator for startups
François-Guillaume Ribreau
 
PDF
Development Principles & Philosophy
François-Guillaume Ribreau
 
PDF
Les enjeux de l'information et de l'algorithmique dans notre société
François-Guillaume Ribreau
 
PDF
How I monitor SaaS products
François-Guillaume Ribreau
 
PDF
Continous Integration of (JS) projects & check-build philosophy
François-Guillaume Ribreau
 
PDF
Introduction to Redis
François-Guillaume Ribreau
 
PDF
Approfondissement CSS3
François-Guillaume Ribreau
 
PDF
Découverte HTML5/CSS3
François-Guillaume Ribreau
 
REX LEAN- Créer un SaaS et être rentable après 6 mois
François-Guillaume Ribreau
 
Une plateforme moderne pour le groupe SIPA/Ouest-France 
François-Guillaume Ribreau
 
RedisConf 2016 - Redis usage and ecosystem
François-Guillaume Ribreau
 
Implementing pattern-matching in JavaScript (full version)
François-Guillaume Ribreau
 
Implementing pattern-matching in JavaScript (short version)
François-Guillaume Ribreau
 
Automatic constraints as a team maturity accelerator for startups
François-Guillaume Ribreau
 
Development Principles & Philosophy
François-Guillaume Ribreau
 
Les enjeux de l'information et de l'algorithmique dans notre société
François-Guillaume Ribreau
 
How I monitor SaaS products
François-Guillaume Ribreau
 
Continous Integration of (JS) projects & check-build philosophy
François-Guillaume Ribreau
 
Introduction to Redis
François-Guillaume Ribreau
 
Approfondissement CSS3
François-Guillaume Ribreau
 
Découverte HTML5/CSS3
François-Guillaume Ribreau
 
Ad

Recently uploaded (20)

PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Human Resources Information System (HRIS)
Amity University, Patna
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Tally software_Introduction_Presentation
AditiBansal54083
 

[BreizhCamp, format 15min] Une api rest et GraphQL sans code grâce à PostgREST, sub0 et PostgreSQL