SlideShare a Scribd company logo
Next.js with Drupal,
the good parts
Sebastian Ferrari
sebas@taller.net.br
@sebas5384
● From Uruguay living in Brazil
● CTO & Co-Founder of Taller
● +15 years as developer
● ~10 years as a Drupal dev
● Co-founder of React Conf Brazil
● DevOps chairman of the
Drupal Conference LATAM (2015)
A brief history
decoupling Drupal sites
��
● Still in production
● Not fully decoupled
● Drupal 8.x
● Simple controllers serving JSON payloads
● SPA using React with Redux (and Redux Boot)
● Integration with payment gateway
Natura’s paying Web App (2016)
● Still in production
● Not fully decoupled
● Drupal 8.x and Apache Solr
● Controllers serving JSON+LD schema payloads
● SPA using React with Redux (and Redux Boot)
● Immutable.js + Reselect + Normalizr
Natura’s public and private FAQ (2016)
● ~1 million of contents
● ~900 simultaneous users
● Drupal 8.x and Apache Solr
● GraphQL module (before RC) with Apollo Client
● Next.js 4.x with custom server routing
● Edit-in-line everything!! Layout, Blocks and Contents
● Paywall using AWS Lambda’s integrated with Drupal
NSC Total publishing site (2018)
● Next.js on Kubernetes
● Drupal 8.x and Apache Solr
● GraphQL module with Apollo Client
● GraphQL gateway using stitching and delegation
● Drupal integration with the ATG Business Control
Center for demographic segmentation
● Endured a black friday!! o/
Natura’s E-Commerce (2018)
What’s
Drupal ?
What’s
?
Next.js with drupal, the good parts
React Framework
which takes out the
pain of building
Universal Apps
��
JS
Browser rendering
Server rendering
ZERO
CONFIGURATION !!!!
����
Why
?
Once upon a time at
the Brazil JS Conf (2014)
The 7 Principles of
Rich Web Applications
by Guillermo Rauch
1. Server rendered pages are not optional
2. Act immediately on user input
3. React to data changes
4. Control the data exchange with the server
5. Don’t break history, enhance it
6. Push code updates
7. Predict behavior
Next.js was born from
those 7 principles
SSR as first citizen
Collection of
best practices
to build Universal Apps
Who’s using it?
Flexibility
Compose Webpack configurations
with plugins
● next-plugins
● next-compose-plugins
Next.js with drupal, the good parts
Next.js with drupal, the good parts
Customize Babel configurations
Customize everything
● ./pages/_app.js
Root App component
● ./pages/_document.js
Document's markup like <html>
● ./pages/_error.js
Customize universal error pages
● (SUPER) Dynamic routing
● It’s just an ordinary express server, so
you can proxy requests, add middlewares
● Your project has specific needs for a
different web server
Customize the web server
Next.js with drupal, the good parts
Performance
● Common libs
● Webpack runtime
● Each page earns its own chunk
● Use import() out of the box
● Cache busting
● Defer parsing JS files when rendering the DOM
Code splitting (chunks)
Next.js with drupal, the good parts
Next.js with drupal, the good parts
Next.js with drupal, the good parts
Next.js with drupal, the good parts
Prefetching
Dev Workflow
● Start with a single file: ./pages/index.js
● Fast hot-reload
● Build bundles on-demand
● Awesome error stack traces
● Zero-config Typescript support
Dev Workflow
Documentation
��
● All the docs fit in a README file
● Examples oriented (203 in the official repo)
● Guided learning path
Documentation
Routing system
● File system as dynamic routes (demo)
● Full custom routing by using custom server
● API Routes (demo)
● Code Splitting
● Universal routing with next-routes module
Routing System
Serverless ready!
● Function as a Page
● Serverless mode:
○ Completely standalone files which don’t
require any dependencies
○ Reduce cold start
● Hybrid rendering, pre-rendering or on-demand
Serverless
When to use
?
● You use or want to use React.js to
build universal applications
● High volume of content
● High frequency of updates
● Breaking news, publish in less than 5 minutes
● Server Side Rendering (SSR)
○ Need SEO
○ Performance: First Meaningful Paint (for RUM)
When to use Next.js?
Next on Drupal
the boilerplate
GraphQL module
for Drupal
Next.js with drupal, the good parts
Universal Drupal
route resolver
● Try to resolve on GraphQL route() query first
● Deduce which page/component needs to load for
the entity of that route
● Use dynamic importing for better code splitting
● Universal 404 errors, both server and browser
● Redirects (already in production)
Drupal route resolver
Contextual Data
by route
● Blocks
○ Resolver by region to mount a layout
○ Each block expose a GraphQL fragment
○ Blocks can execute its own query
○ Entity reference field to blocks
● Metatags module (GraphQL)
○ Get’s Metatags from contextual entity
○ Component/Container ready to use in pages
Contextual data by route (DEMO)
Drupal Menus !
● Supports many levels of depth
● Can be used multiple times in the same page
● A Container <MenuContainer /> ready to use
Menu
Next.js with drupal, the good parts
Next.js with drupal, the good parts
Internal links
for SPA navigation
● Keep the user navigation through SPA mode
● Use <Link as=”/drupal” href=”/my-article”> to
resolve an url on Drupal, both server and client
● <HtmlText> component will patch every <a> which
has an internal (relative) href
Internal Links
Next.js with drupal, the good parts
Translation
🚧 WIP
Next on Drupal
the boilerplate
We need help!
🥰
● Suspense to get rid of static
hoisting of getInitalProps()
● WebAssembly (WASM) for
cross teams
○ PHP in the browser and Nodejs?
● Better serverless support
The future is bright
Stale content first
approach
● Revalidate cache on the background
● Soft purging!! please!!
● Cache-tags with soft purging
● Use a CDN (or/and Varnish) which better
fits your needs
● Use Apollo’s “cache-and-network” fetch policy to
maintain your user navigation fresh
● Perfect for serverless rendering on-demand
Serve Stale first
Credits: KeyCDN
Next.js with drupal, the good parts
Next.js with drupal, the good parts

More Related Content

What's hot (20)

PDF
Vue, vue router, vuex
Samundra khatri
 
ODP
Basics of VueJS
Squash Apps Pvt Ltd
 
PDF
TypeScript
Saray Chak
 
PDF
Intro to react native
ModusJesus
 
PDF
Understanding Reactive Programming
Andres Almiray
 
PDF
Front-End Frameworks: a quick overview
Diacode
 
PDF
Intro to vue.js
TechMagic
 
ODP
BDD with Cucumber
Knoldus Inc.
 
PPT
Angular App Presentation
Elizabeth Long
 
PDF
Next.js Introduction
Saray Chak
 
PDF
Quarkus - a next-generation Kubernetes Native Java framework
SVDevOps
 
ODP
Angular 6 - The Complete Guide
Sam Dias
 
PPTX
Micro frontend
Amr Abd El Latief
 
PDF
GraalVM Native and Spring Boot 3.0
MoritzHalbritter
 
PDF
Corso Javascript
Giuseppe Dell'Abate
 
PPTX
Angular
khoado2002
 
PPTX
React vs angular what to choose for your app
Concetto Labs
 
PPTX
DevOps with Kubernetes
EastBanc Tachnologies
 
PDF
Front-End Testing: Demystified
Seth McLaughlin
 
PDF
How to make APEX print through Node.js
Dimitri Gielis
 
Vue, vue router, vuex
Samundra khatri
 
Basics of VueJS
Squash Apps Pvt Ltd
 
TypeScript
Saray Chak
 
Intro to react native
ModusJesus
 
Understanding Reactive Programming
Andres Almiray
 
Front-End Frameworks: a quick overview
Diacode
 
Intro to vue.js
TechMagic
 
BDD with Cucumber
Knoldus Inc.
 
Angular App Presentation
Elizabeth Long
 
Next.js Introduction
Saray Chak
 
Quarkus - a next-generation Kubernetes Native Java framework
SVDevOps
 
Angular 6 - The Complete Guide
Sam Dias
 
Micro frontend
Amr Abd El Latief
 
GraalVM Native and Spring Boot 3.0
MoritzHalbritter
 
Corso Javascript
Giuseppe Dell'Abate
 
Angular
khoado2002
 
React vs angular what to choose for your app
Concetto Labs
 
DevOps with Kubernetes
EastBanc Tachnologies
 
Front-End Testing: Demystified
Seth McLaughlin
 
How to make APEX print through Node.js
Dimitri Gielis
 

Similar to Next.js with drupal, the good parts (20)

PDF
Universal React apps in Next.js
🐕 Łukasz Ostrowski
 
PPTX
Server side rendering review
Vladyslav Morzhanov
 
PPTX
Introduction to React.js and Next.js.pptx
alpeshconnect1
 
PDF
What is Next js.pdf
nikhilsuman11
 
PPTX
Progressive Web Apps and React
Mike Melusky
 
PPTX
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
zmulani8
 
PDF
Step Into the Future with Next.js: Performance Meets Innovation
Mobisoft Infotech
 
PDF
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Fwdays
 
PPTX
Isomorphic JavaScript – future of the web
Sigma Software
 
PDF
nextjs-handbook.pdf
RaviKumar76265
 
PDF
Web Development with Delphi and React - ITDevCon 2016
Marco Breveglieri
 
PDF
Frontrunners react
Allison Kunz
 
PPTX
Building isomorphic java script apps faster with next.js
Madhav Chaturvedi
 
PDF
Review on React JS
ijtsrd
 
PPTX
Next JS vs React.pptx
Albiorix Technology
 
PDF
Easy Decoupled Sitebuilding with GraphQL and Next.js
Jani Tarvainen
 
PDF
Integrating React.js Into a PHP Application: Dutch PHP 2019
Andrew Rota
 
PPTX
Nextjs_Presentation_Ankita_MIT aurangabad.pptx
AnkitaRaut26
 
PDF
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
GreeceJS
 
PDF
ReactJS - frontend web developing reactjs
ducpvcontact
 
Universal React apps in Next.js
🐕 Łukasz Ostrowski
 
Server side rendering review
Vladyslav Morzhanov
 
Introduction to React.js and Next.js.pptx
alpeshconnect1
 
What is Next js.pdf
nikhilsuman11
 
Progressive Web Apps and React
Mike Melusky
 
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
zmulani8
 
Step Into the Future with Next.js: Performance Meets Innovation
Mobisoft Infotech
 
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Fwdays
 
Isomorphic JavaScript – future of the web
Sigma Software
 
nextjs-handbook.pdf
RaviKumar76265
 
Web Development with Delphi and React - ITDevCon 2016
Marco Breveglieri
 
Frontrunners react
Allison Kunz
 
Building isomorphic java script apps faster with next.js
Madhav Chaturvedi
 
Review on React JS
ijtsrd
 
Next JS vs React.pptx
Albiorix Technology
 
Easy Decoupled Sitebuilding with GraphQL and Next.js
Jani Tarvainen
 
Integrating React.js Into a PHP Application: Dutch PHP 2019
Andrew Rota
 
Nextjs_Presentation_Ankita_MIT aurangabad.pptx
AnkitaRaut26
 
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
GreeceJS
 
ReactJS - frontend web developing reactjs
ducpvcontact
 
Ad

More from Taller Negócio Digitais (20)

PPTX
Indo além do técnico para desenvolver sistemas que evoluem na velocidade do...
Taller Negócio Digitais
 
PPTX
Discovery kanban
Taller Negócio Digitais
 
PDF
Taller Negócios Digitais
Taller Negócio Digitais
 
PDF
De um sistema legado para micro serviços com GraphQL
Taller Negócio Digitais
 
PPTX
Gestão Ágil com Fluxo Unificado
Taller Negócio Digitais
 
PDF
Alinhando Discovery com Delivery usando Upstream Kanban
Taller Negócio Digitais
 
PDF
Lições Aprendidas com Fluxo Unificado
Taller Negócio Digitais
 
PDF
Como a liderança descentralizada tornou a Taller mais efetiva
Taller Negócio Digitais
 
PDF
Métricas no Fluxo Unificado
Taller Negócio Digitais
 
PDF
Práticas e ferramentas de feedback: potencializando a cultura da confiança
Taller Negócio Digitais
 
PDF
Como preparar seu time para receber feedback - Scrum Gathering Rio 2017
Taller Negócio Digitais
 
PDF
Vacinando mais de 200 mil pessoas com ReactJS e GraphQL
Taller Negócio Digitais
 
PDF
Taller – Treinamentos e consultorias
Taller Negócio Digitais
 
PDF
Taller - Ateliê de desenvolvimento de software
Taller Negócio Digitais
 
PDF
Introdução ao Fluxo Unificado - TDC Florianópolis 2017
Taller Negócio Digitais
 
PDF
Javascript Funcional - TDC Florianópolis 2017
Taller Negócio Digitais
 
PDF
11 maneiras de compartilhar conhecimento - TDC Florianópolis 2017
Taller Negócio Digitais
 
PDF
Kanban no Fluxo Unificado de Portfolio de Projetos - Agile Brazil 2016
Taller Negócio Digitais
 
PPTX
Programação Eficaz - Agile Trends Floripa 2016
Taller Negócio Digitais
 
PDF
Trabalhando a cultura do feedback. Por onde começar?
Taller Negócio Digitais
 
Indo além do técnico para desenvolver sistemas que evoluem na velocidade do...
Taller Negócio Digitais
 
Discovery kanban
Taller Negócio Digitais
 
Taller Negócios Digitais
Taller Negócio Digitais
 
De um sistema legado para micro serviços com GraphQL
Taller Negócio Digitais
 
Gestão Ágil com Fluxo Unificado
Taller Negócio Digitais
 
Alinhando Discovery com Delivery usando Upstream Kanban
Taller Negócio Digitais
 
Lições Aprendidas com Fluxo Unificado
Taller Negócio Digitais
 
Como a liderança descentralizada tornou a Taller mais efetiva
Taller Negócio Digitais
 
Métricas no Fluxo Unificado
Taller Negócio Digitais
 
Práticas e ferramentas de feedback: potencializando a cultura da confiança
Taller Negócio Digitais
 
Como preparar seu time para receber feedback - Scrum Gathering Rio 2017
Taller Negócio Digitais
 
Vacinando mais de 200 mil pessoas com ReactJS e GraphQL
Taller Negócio Digitais
 
Taller – Treinamentos e consultorias
Taller Negócio Digitais
 
Taller - Ateliê de desenvolvimento de software
Taller Negócio Digitais
 
Introdução ao Fluxo Unificado - TDC Florianópolis 2017
Taller Negócio Digitais
 
Javascript Funcional - TDC Florianópolis 2017
Taller Negócio Digitais
 
11 maneiras de compartilhar conhecimento - TDC Florianópolis 2017
Taller Negócio Digitais
 
Kanban no Fluxo Unificado de Portfolio de Projetos - Agile Brazil 2016
Taller Negócio Digitais
 
Programação Eficaz - Agile Trends Floripa 2016
Taller Negócio Digitais
 
Trabalhando a cultura do feedback. Por onde começar?
Taller Negócio Digitais
 
Ad

Recently uploaded (20)

PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 

Next.js with drupal, the good parts

  • 1. Next.js with Drupal, the good parts Sebastian Ferrari [email protected] @sebas5384
  • 2. ● From Uruguay living in Brazil ● CTO & Co-Founder of Taller ● +15 years as developer ● ~10 years as a Drupal dev ● Co-founder of React Conf Brazil ● DevOps chairman of the Drupal Conference LATAM (2015)
  • 3. A brief history decoupling Drupal sites ��
  • 4. ● Still in production ● Not fully decoupled ● Drupal 8.x ● Simple controllers serving JSON payloads ● SPA using React with Redux (and Redux Boot) ● Integration with payment gateway Natura’s paying Web App (2016)
  • 5. ● Still in production ● Not fully decoupled ● Drupal 8.x and Apache Solr ● Controllers serving JSON+LD schema payloads ● SPA using React with Redux (and Redux Boot) ● Immutable.js + Reselect + Normalizr Natura’s public and private FAQ (2016)
  • 6. ● ~1 million of contents ● ~900 simultaneous users ● Drupal 8.x and Apache Solr ● GraphQL module (before RC) with Apollo Client ● Next.js 4.x with custom server routing ● Edit-in-line everything!! Layout, Blocks and Contents ● Paywall using AWS Lambda’s integrated with Drupal NSC Total publishing site (2018)
  • 7. ● Next.js on Kubernetes ● Drupal 8.x and Apache Solr ● GraphQL module with Apollo Client ● GraphQL gateway using stitching and delegation ● Drupal integration with the ATG Business Control Center for demographic segmentation ● Endured a black friday!! o/ Natura’s E-Commerce (2018)
  • 11. React Framework which takes out the pain of building Universal Apps ��
  • 14. Why ?
  • 15. Once upon a time at the Brazil JS Conf (2014)
  • 16. The 7 Principles of Rich Web Applications by Guillermo Rauch
  • 17. 1. Server rendered pages are not optional 2. Act immediately on user input 3. React to data changes 4. Control the data exchange with the server 5. Don’t break history, enhance it 6. Push code updates 7. Predict behavior
  • 18. Next.js was born from those 7 principles
  • 19. SSR as first citizen
  • 20. Collection of best practices to build Universal Apps
  • 23. Compose Webpack configurations with plugins ● next-plugins ● next-compose-plugins
  • 27. Customize everything ● ./pages/_app.js Root App component ● ./pages/_document.js Document's markup like <html> ● ./pages/_error.js Customize universal error pages
  • 28. ● (SUPER) Dynamic routing ● It’s just an ordinary express server, so you can proxy requests, add middlewares ● Your project has specific needs for a different web server Customize the web server
  • 31. ● Common libs ● Webpack runtime ● Each page earns its own chunk ● Use import() out of the box ● Cache busting ● Defer parsing JS files when rendering the DOM Code splitting (chunks)
  • 38. ● Start with a single file: ./pages/index.js ● Fast hot-reload ● Build bundles on-demand ● Awesome error stack traces ● Zero-config Typescript support Dev Workflow
  • 40. ● All the docs fit in a README file ● Examples oriented (203 in the official repo) ● Guided learning path Documentation
  • 42. ● File system as dynamic routes (demo) ● Full custom routing by using custom server ● API Routes (demo) ● Code Splitting ● Universal routing with next-routes module Routing System
  • 44. ● Function as a Page ● Serverless mode: ○ Completely standalone files which don’t require any dependencies ○ Reduce cold start ● Hybrid rendering, pre-rendering or on-demand Serverless
  • 46. ● You use or want to use React.js to build universal applications ● High volume of content ● High frequency of updates ● Breaking news, publish in less than 5 minutes ● Server Side Rendering (SSR) ○ Need SEO ○ Performance: First Meaningful Paint (for RUM) When to use Next.js?
  • 47. Next on Drupal the boilerplate
  • 51. ● Try to resolve on GraphQL route() query first ● Deduce which page/component needs to load for the entity of that route ● Use dynamic importing for better code splitting ● Universal 404 errors, both server and browser ● Redirects (already in production) Drupal route resolver
  • 53. ● Blocks ○ Resolver by region to mount a layout ○ Each block expose a GraphQL fragment ○ Blocks can execute its own query ○ Entity reference field to blocks ● Metatags module (GraphQL) ○ Get’s Metatags from contextual entity ○ Component/Container ready to use in pages Contextual data by route (DEMO)
  • 55. ● Supports many levels of depth ● Can be used multiple times in the same page ● A Container <MenuContainer /> ready to use Menu
  • 59. ● Keep the user navigation through SPA mode ● Use <Link as=”/drupal” href=”/my-article”> to resolve an url on Drupal, both server and client ● <HtmlText> component will patch every <a> which has an internal (relative) href Internal Links
  • 62. Next on Drupal the boilerplate We need help! 🥰
  • 63. ● Suspense to get rid of static hoisting of getInitalProps() ● WebAssembly (WASM) for cross teams ○ PHP in the browser and Nodejs? ● Better serverless support The future is bright
  • 65. ● Revalidate cache on the background ● Soft purging!! please!! ● Cache-tags with soft purging ● Use a CDN (or/and Varnish) which better fits your needs ● Use Apollo’s “cache-and-network” fetch policy to maintain your user navigation fresh ● Perfect for serverless rendering on-demand Serve Stale first