A node.js proxy
between Drupal
and yourconsumers
DECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCHBOSCH

MATEU AGUILÓ BOSCH

1

TOKYO 2019+MATEU AGUILÓ BOSCH

Back-end node.js + PHP dev.
Maintainer of decoupledDrupal.
API-First Initiative
coordinator.

2

TOKYO 2019

+MATEU AGUILÓ BOSCHStrategy, design, andDrupal development
for large-scale
publishers.

3

The powerful abstractions⭑The benefits of a proxy⭑The abstraction of your proxy

DECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCHBOSCHWhat we’ll cover⭑4

MATEU AGUILÓ BOSCH+TOKYO 2019

OUR JOB IS BASEDONABSTRACTIONSTHE POWERFUL ABSTRACTIONS

5TOKYO 2019+MATEU AGUILÓ BOSCH

What goes into
an HTTPrequest?
fetch(url: string): Promise
THE POWERFUL ABSTRACTIONS

6THE POWERFUL ABSTRACTIONS
7TOKYO 2019+MATEU AGUILÓ BOSCH

THE POWERFUL ABSTRACTIONS
8DECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCHBOSCH

THE POWERFUL ABSTRACTIONS
9TOKYO 2019+MATEU AGUILÓ BOSCH

THE POWERFUL ABSTRACTIONS

MATEU AGUILÓ BOSCH+TOKYO 2019Your contentrepository
Drupal isalreadyabstracted out.

10Abstractions
Content repository (R&W) - JSON:API.

⭑API customizations - JSON:API Extras.

⭑OAuth 2 authorization - Simple OAuth.

⭑Remote tasks - JSON-RPC.

⭑Performance - Subrequests, Consumer Image Styles, JSON:APIBoost.

⭑Application enablers - JSON:API Hypermedia, JSON:API Schema.

⭑Automatic documentation - Open API.
THE POWERFUL ABSTRACTIONSTOKYO 2019+

MATEU AGUILÓ BOSCH⭑11

TOKYO 2019+

MATEU AGUILÓ BOSCH

What about therest of thestack? Can we
provide helpful
abstractions?

Photo by Everton Vila on Unsplash

THE POWERFUL ABSTRACTIONS

12

back-ends to be primarily a node.jsapplication.

DECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCHBOSCH”

I advocate for all decoupled Drupal

13THE POWERFUL ABSTRACTIONSTOKYO 2019+MATEU AGUILÓ BOSCH

Why node.js?

Photo by Patrick Perkins on Unsplash

THE BENEFITS OF A PROXY

14

TOKYO 2019+MATEU AGUILÓ BOSCH

Flexibility
THE BENEFITS OF A PROXY

15

MATEU AGUILÓ BOSCH+

3rd party API

Icons made by Freepik and phatplus from www.flaticon.com is licensed by CC 3.0 BY

A/B testing

Personalization

Feature flags

THE BENEFITS OF A PROXYTOKYO 2019

Content APIs

16

MATEU AGUILÓ BOSCHTOKYO 2019+Performance
THE BENEFITS OF A PROXY

17

Server side renderingStateless applications scalebetter
THE BENEFITS OF A PROXYDECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCH
BOSCH

Non-blocking I/O

18

TOKYO 2019+MATEU AGUILÓ BOSCHSecurity
THE BENEFITS OF A PROXY

19

DECOUPLED DAYS 2019 + MATEU AGUILÓ
TOKYO 2019 + MATEU AGUILÓ BOSCH
BOSCHPrivate connexion
between node.jsand Drupal
THE BENEFITS OF A PROXY20

Stay private/admin/*⭑/node/*⭑/user/login/*⭑/devel/php⭑“Insecure” contribs: query string params, forms, access bypass,
information disclosure, …

⭑“Insecure” core.
THE BENEFITS OF A PROXYTOKYO 2019

+MATEU AGUILÓ BOSCH⭑21

MATEU AGUILÓ BOSCHTOKYO 2019

+Robustness
THE BENEFITS OF A PROXY22

TOKYO 2019

+MATEU AGUILÓ BOSCH

Robustflexibility

Photo by kazuend on Unsplash

THE BENEFITS OF A PROXY23

Editorial

Personalization

Icons made by Freepik and phatplus from www.flaticon.com is licensed by CC 3.0 BY

MarketingAds

Datascience
THE BENEFITS OF A PROXYTOKYO 2019

+MATEU AGUILÓ BOSCHSTATUS:😅👍

24

THE BENEFITS OF A PROXYDECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCHBOSCH

Allows each team toexercise their
domain expertise.

25

TOKYO 2019+MATEU AGUILÓ BOSCH

Don’t force
a fight

Photo by CloudVisual on Unsplash

THE BENEFITS OF A PROXY

26

MATEU AGUILÓ BOSCHTOKYO 2019+Don’t fighta force

27
Photo by CloudVisual on Unsplash

MATEU AGUILÓ BOSCH+TOKYO 2019

OUR JOB IS BASEDONABSTRACTIONS
THE ABSTRACTION OF YOUR PROXY28

MATEU AGUILÓ BOSCHTOKYO 2019+GitHub ⭐️contentacms/contentajs

THE ABSTRACTION OF YOUR PROXY29

THE ABSTRACTION OF YOUR PROXYDECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCHBOSCH

The auto-generated
proxy: based onOpenAPI.

30

that is vendor neutral, portable and openis critical to accelerating the vision of atruly connected world.

+open description format for API services

MATEU AGUILÓ BOSCH

modern applications […]. Creating anTOKYO 2019”

APIs form the connecting glue between— The OpenAPI Initiative, open governance structure under the Linux Foundation

31

THE ABSTRACTION OF YOUR PROXY

THE ABSTRACTION OF YOUR PROXYMATEU AGUILÓ BOSCH+TOKYO 2019

On server start wedownload the OpenAPI
document from Drupal:- Schema- Routing32

Photo by elCarito on Unsplash

THE ABSTRACTION OF YOUR PROXYDECOUPLED DAYS 2019 + MATEU AGUILÓTOKYO 2019 + MATEU AGUILÓ BOSCHBOSCH“But why not justAWS API Gateway?”33

MATEU AGUILÓ BOSCH+TOKYO 2019
Icons made by Freepik and phatplus from www.flaticon.com is licensed by CC 3.0 BY

THE ABSTRACTION OF YOUR PROXY34

TOKYO 2019+MATEU AGUILÓ BOSCH

No custom
computations

Icons made by Freepik and phatplus from www.flaticon.com is licensed by CC 3.0 BYTHE ABSTRACTION OF YOUR PROXY35

MATEU AGUILÓ BOSCH+Icons made by Freepik and phatplus from www.flaticon.com is licensed by CC 3.0 BYTHE ABSTRACTION OF YOUR PROXYTOKYO 2019DATA SERVICESONLY*36

MATEU AGUILÓ BOSCH+TOKYO 2019
Icons made by Freepik and phatplus from www.flaticon.com is licensed by CC 3.0 BY

THE ABSTRACTION OF YOUR PROXY37

MATEU AGUILÓ BOSCH+TOKYO 2019

THE ABSTRACTION OF YOUR PROXY38

MATEU AGUILÓ BOSCHTOKYO 2019+❤
️Icons made by Freepik and phatplus from www.flaticon.com is licensed by CC 3.0 BY

THE ABSTRACTION OF YOUR PROXY

39

DECOUPLED DAYS 2019 + MATEU AGUILÓ
TOKYO 2019 + MATEU AGUILÓ BOSCHBOSCH

Would I use
this pattern
everywhere?
40

MATEU AGUILÓ BOSCH+TOKYO 201941
Photo by Kelly Sikkema on Unsplash