SlideShare a Scribd company logo
1 of 52
A look at Edutopia.org
Decoupled Drupal + React case study
About Me
Darren Petersen
• Senior Technical Project Manager
at Lullabot
• Doing Drupal since 2008
Whooo
are you?
Things we’re about to discuss…
• Reasons to take on a decoupled project – or not
• Structured data!
• How the technology works
• Editorial modes
• Performance
• Bonus content: the problem of preview
To decouple or not to decouple…
Why build one website,
when two can do the same job?
Wait no, reverse that…
• Distribution of data to other platforms becomes
possible
• Over time, lightweight design changes are possible
without a total rebuild
• Performance turned out to be the killer app for
Edutopia
Why decoupled?
Sally Young
aka
‘Justafish’
Front-end
Express
React
Redux
Back-end
Drupal
JSONAPI
Mateu Aguilo Bosch
aka ‘e0ipso’
Author of Drupal’s
JSONAPI implementation
JSONAPI 101: What’s a JSONAPI?
• Contributed module for Drupal
• Renders pretty much any entity as JSON data
• /jsonapi/node/article/{UUID}
• /jsonapi/{entity}/{bundle}/{UUID}
• Also allows:
• lists of content
• filters by field
• inclusion of other content via entity reference
• Respects permissions in Drupal
What makes a good API?
Your API needs
structured content
Unstructured content is bad.
Structured content is good.
Matt Robison
CMS + JSONAPI
John Hannah
React/Front-end
Receive API
request and
look up data
Normalize,
and render
JSONAPI response
Handle API
Response Save data to state
Render!
Express
Redux/React
Drupal
Receive request
Parse request and
dispatch API call
Routing URLs from React to Drupal
Page Request: https://www.edutopia.org/article/when-rubric-isnt-enough
URL slug (): article/when-rubric-isnt-enough
API request: /jsonapi/node/article?filter[field_url_slug][value]=article/when-rubric-
isnt-enough
Handle API
Response Save data to state
Render!
Drupal
Redux/React
Express
Receive API
request and
look up data
Normalize,
and render
JSONAPI response
Receive request
Parse request and
dispatch API call
Express
Drupal
Redux/React
Handle API
Response Save data to state
Render!
Receive API
request and
look up data
Normalize,
and render
JSONAPI response
Receive request
Parse request and
dispatch API call
Express
Drupal
Redux/React
Handle API
Response Save data to state
Render!
Receive API
request and
look up data
Normalize,
and render
JSONAPI response
Receive request
Parse request and
dispatch API call
Attack of the 50-foot
Legacy URLs
Redux/React
Express
Drupal
Receive request
Parse request and
dispatch API call
Stock JSONAPI
endpoint
Normalize,
and render
JSONAPI response
Handle API
Response Save data to state
Render!
Quit trying so
hard and just ask
Drupal what it is.
Custom
resolver
endpoint
Outcome of hacking JSONAPI and React:
• Performance was fine
• The system worked great
• We introduced finicky maintenance issues due to non-standard ways
of using React/Redux.
• Doing things in the wrong order has a cost – but the business need
was met.
Let’s talk about editorial UX…
Structured content isn’t always user friendly.
Structured layout solutions work great for:
pages with clear, rigid design constraints
built by expert users
Less structured layout solutions are required for:
pages with more fluid design constraints
built by occasional users.
AKA, Where’s my WYSIWYG
Video of embedding an entity
Unstructured content is bad.
CMS Implementation
• media module for images, video and documents
• entity embed + inline entity form
• hidden entity ref fields that stored the media entities
referenced in the body field
• alterations to media browser modals for field
overrides
• ckeditor customizations for specific cases
Practically speaking,
this is structured data…
but it’s buried in the body field.
Body field
data
Rich text
processor
Text
block
Text
block
Image
Video
Text
block
Text
block
Image
Video
Text
block
Text
block
Image
Video
Each of these has a
corresponding entity in
the API response,
And React can
render their components
Performance!
• Code splitting reduced JS bundle sizes by ~40%
• Lazy-load of images and related content in articles improved load
times by nearly a second.
• Preloading content allows for sub-second response times within the
site.
• Sparse fieldsets
More JSONAPI: Sparse fieldsets
• Normally, relationships and includes load the WHOLE
related entity
• You can specify the data payload only contain what
you want, by listing those fields in your request.
Example: fields[bundle--type]={comma separated list of
fields}
/jsonapi/node/landing_page?_format=api_json&filter[field_url_slug][valu
e]=videos&include=related_content&fields[node--article]=
uuid,id,nid,title,field_cover_media,field_cover_media_display,field_sum
mary,field_eyebrow,field_url_slug,field_video,field_video_still,field_autho
rs,field_intro
More JSONAPI: Sparse fieldsets
Sparse fieldsets reduced the size of
API payloads by 60% or more
- as much as 90% in some cases.
• Two websites is definitely twice the work
• You’ll have to reinvent the wheel sometimes
• Everything is harder
• But you gain the capacity for multichannel publishing
• And you might have the fastest site on the block
Takeaways…
Editorial Preview
Yet another thing you can’t do
easily on a decoupled site.
Preview: Content Moderation + JSONAPI
• These two very fine modules don’t talk to each other
• We made an endpoint that serves revisions through JSONAPI
• JSONAPI respects permissions, so we can secure this out of the box.
• Hacked revisions tab and node views to render links to the preview
front-end
Preview: front-end considerations
• Separate web host for previews
• Same codebase, different config
• Routing of preview URLs triggers API request to the Preview endpoint
• Authentication support between front-end and Drupal
• Preview mode on the front-end is configurable, so that previews can’t
be rendered on prod

More Related Content

What's hot

Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom DevelopmentGWAVA
 
Website Performance
Website PerformanceWebsite Performance
Website PerformanceHugo Fonseca
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuningJohn McCaffrey
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...
Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...
Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...Mark Roden
 
Custom Development with Novell Teaming
Custom Development with Novell TeamingCustom Development with Novell Teaming
Custom Development with Novell TeamingNovell
 
Catch 22: FLex APps
Catch 22: FLex APpsCatch 22: FLex APps
Catch 22: FLex APpsYash Mody
 
Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...AEM HUB
 
Amazon.com's Web Services Opportunity
Amazon.com's Web Services OpportunityAmazon.com's Web Services Opportunity
Amazon.com's Web Services OpportunityTim O'Reilly
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part IIEugene Lazutkin
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Wen-Tien Chang
 
Page Performance
Page PerformancePage Performance
Page Performanceatorreno
 
Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016AdobeMarketingCloud
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuningJohn McCaffrey
 
Drupal is not your Website
Drupal is not your Website Drupal is not your Website
Drupal is not your Website Phase2
 
Design mobile efficient Apis
Design mobile efficient ApisDesign mobile efficient Apis
Design mobile efficient ApisMobile Rtpl
 
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applicationsTake a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applicationsSage Computing Services
 

What's hot (20)

Web API Basics
Web API BasicsWeb API Basics
Web API Basics
 
Speed!
Speed!Speed!
Speed!
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom Development
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...
Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...
Connect 2014 - EXTJS in XPages: Modernizing IBM Notes Views Without Sacrifici...
 
Custom Development with Novell Teaming
Custom Development with Novell TeamingCustom Development with Novell Teaming
Custom Development with Novell Teaming
 
Catch 22: FLex APps
Catch 22: FLex APpsCatch 22: FLex APps
Catch 22: FLex APps
 
Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...
 
Amazon.com's Web Services Opportunity
Amazon.com's Web Services OpportunityAmazon.com's Web Services Opportunity
Amazon.com's Web Services Opportunity
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
 
Page Performance
Page PerformancePage Performance
Page Performance
 
Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
Drupal is not your Website
Drupal is not your Website Drupal is not your Website
Drupal is not your Website
 
Design mobile efficient Apis
Design mobile efficient ApisDesign mobile efficient Apis
Design mobile efficient Apis
 
Mobile APIs in Practice
Mobile APIs in PracticeMobile APIs in Practice
Mobile APIs in Practice
 
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applicationsTake a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
 

Similar to Decoupling Edutopia.org

Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Mack Hardy
 
Mtn view sql server nov 2014
Mtn view sql server nov 2014Mtn view sql server nov 2014
Mtn view sql server nov 2014EspressoLogic
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptxssuser35fdf2
 
Untangling the web11
Untangling the web11Untangling the web11
Untangling the web11Derek Jacoby
 
Untangling spring week1
Untangling spring week1Untangling spring week1
Untangling spring week1Derek Jacoby
 
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with BlackfireMarko Mitranić
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworksKirk Madera
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11Derek Jacoby
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedAlexander Makarov
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a bossFrancisco Ribeiro
 
Creating a Documentation Portal
Creating a Documentation PortalCreating a Documentation Portal
Creating a Documentation PortalSteve Anderson
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFxThomas Daly
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1Derek Jacoby
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your WebsiteAcquia
 
Picnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable applicationPicnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable applicationNick Josevski
 
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQLNoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQLAndrew Morgan
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your websitehernanibf
 

Similar to Decoupling Edutopia.org (20)

Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Mtn view sql server nov 2014
Mtn view sql server nov 2014Mtn view sql server nov 2014
Mtn view sql server nov 2014
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptx
 
Untangling the web11
Untangling the web11Untangling the web11
Untangling the web11
 
Untangling spring week1
Untangling spring week1Untangling spring week1
Untangling spring week1
 
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a boss
 
Creating a Documentation Portal
Creating a Documentation PortalCreating a Documentation Portal
Creating a Documentation Portal
 
DIWD 2011
DIWD 2011DIWD 2011
DIWD 2011
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
Picnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable applicationPicnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable application
 
Cqrs api
Cqrs apiCqrs api
Cqrs api
 
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQLNoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your website
 

Recently uploaded

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

Decoupling Edutopia.org

  • 1. A look at Edutopia.org Decoupled Drupal + React case study
  • 2. About Me Darren Petersen • Senior Technical Project Manager at Lullabot • Doing Drupal since 2008
  • 3.
  • 5. Things we’re about to discuss… • Reasons to take on a decoupled project – or not • Structured data! • How the technology works • Editorial modes • Performance • Bonus content: the problem of preview
  • 6. To decouple or not to decouple…
  • 7. Why build one website, when two can do the same job? Wait no, reverse that…
  • 8. • Distribution of data to other platforms becomes possible • Over time, lightweight design changes are possible without a total rebuild • Performance turned out to be the killer app for Edutopia Why decoupled?
  • 9.
  • 12. Mateu Aguilo Bosch aka ‘e0ipso’ Author of Drupal’s JSONAPI implementation
  • 13. JSONAPI 101: What’s a JSONAPI? • Contributed module for Drupal • Renders pretty much any entity as JSON data • /jsonapi/node/article/{UUID} • /jsonapi/{entity}/{bundle}/{UUID} • Also allows: • lists of content • filters by field • inclusion of other content via entity reference • Respects permissions in Drupal
  • 14. What makes a good API? Your API needs structured content
  • 17. Matt Robison CMS + JSONAPI John Hannah React/Front-end
  • 18. Receive API request and look up data Normalize, and render JSONAPI response Handle API Response Save data to state Render! Express Redux/React Drupal Receive request Parse request and dispatch API call
  • 19. Routing URLs from React to Drupal Page Request: https://www.edutopia.org/article/when-rubric-isnt-enough URL slug (): article/when-rubric-isnt-enough API request: /jsonapi/node/article?filter[field_url_slug][value]=article/when-rubric- isnt-enough
  • 20. Handle API Response Save data to state Render! Drupal Redux/React Express Receive API request and look up data Normalize, and render JSONAPI response Receive request Parse request and dispatch API call
  • 21.
  • 22. Express Drupal Redux/React Handle API Response Save data to state Render! Receive API request and look up data Normalize, and render JSONAPI response Receive request Parse request and dispatch API call
  • 23.
  • 24.
  • 25. Express Drupal Redux/React Handle API Response Save data to state Render! Receive API request and look up data Normalize, and render JSONAPI response Receive request Parse request and dispatch API call
  • 26. Attack of the 50-foot Legacy URLs
  • 27. Redux/React Express Drupal Receive request Parse request and dispatch API call Stock JSONAPI endpoint Normalize, and render JSONAPI response Handle API Response Save data to state Render! Quit trying so hard and just ask Drupal what it is. Custom resolver endpoint
  • 28. Outcome of hacking JSONAPI and React: • Performance was fine • The system worked great • We introduced finicky maintenance issues due to non-standard ways of using React/Redux. • Doing things in the wrong order has a cost – but the business need was met.
  • 29. Let’s talk about editorial UX…
  • 30.
  • 31.
  • 32. Structured content isn’t always user friendly.
  • 33. Structured layout solutions work great for: pages with clear, rigid design constraints built by expert users
  • 34. Less structured layout solutions are required for: pages with more fluid design constraints built by occasional users. AKA, Where’s my WYSIWYG
  • 35. Video of embedding an entity
  • 37. CMS Implementation • media module for images, video and documents • entity embed + inline entity form • hidden entity ref fields that stored the media entities referenced in the body field • alterations to media browser modals for field overrides • ckeditor customizations for specific cases
  • 38.
  • 39. Practically speaking, this is structured data… but it’s buried in the body field.
  • 41. Text block Text block Image Video Text block Text block Image Video Each of these has a corresponding entity in the API response, And React can render their components
  • 42.
  • 43.
  • 44. Performance! • Code splitting reduced JS bundle sizes by ~40% • Lazy-load of images and related content in articles improved load times by nearly a second. • Preloading content allows for sub-second response times within the site. • Sparse fieldsets
  • 45. More JSONAPI: Sparse fieldsets • Normally, relationships and includes load the WHOLE related entity • You can specify the data payload only contain what you want, by listing those fields in your request.
  • 46. Example: fields[bundle--type]={comma separated list of fields} /jsonapi/node/landing_page?_format=api_json&filter[field_url_slug][valu e]=videos&include=related_content&fields[node--article]= uuid,id,nid,title,field_cover_media,field_cover_media_display,field_sum mary,field_eyebrow,field_url_slug,field_video,field_video_still,field_autho rs,field_intro More JSONAPI: Sparse fieldsets
  • 47. Sparse fieldsets reduced the size of API payloads by 60% or more - as much as 90% in some cases.
  • 48. • Two websites is definitely twice the work • You’ll have to reinvent the wheel sometimes • Everything is harder • But you gain the capacity for multichannel publishing • And you might have the fastest site on the block Takeaways…
  • 49. Editorial Preview Yet another thing you can’t do easily on a decoupled site.
  • 50. Preview: Content Moderation + JSONAPI • These two very fine modules don’t talk to each other • We made an endpoint that serves revisions through JSONAPI • JSONAPI respects permissions, so we can secure this out of the box. • Hacked revisions tab and node views to render links to the preview front-end
  • 51.
  • 52. Preview: front-end considerations • Separate web host for previews • Same codebase, different config • Routing of preview URLs triggers API request to the Preview endpoint • Authentication support between front-end and Drupal • Preview mode on the front-end is configurable, so that previews can’t be rendered on prod

Editor's Notes

  1. Tech vs. Business stakeholders? Interested newcomers? Explored React, Angular or similar JS frameworks? How many of you have built decoupled projects?
  2. 50 or so ‘bots across N. America and Europe Fully distributed Work for government, finance, and media companies doing large-scale digital publishing Syfy.com, NYU School of medicine.
  3. Tech vs. Business stakeholders? Interested newcomers? Explored React, Angular or similar JS frameworks? How many of you have built decoupled projects? Thanks for that background – So what are we going to do today?
  4. Our discovery process @lullabot always asks this… because decoupled isn’t for everyone. reinventing the wheel … error handling, logging, authentication, preview retool your development team… At least twice the effort guaranteed So what’s the upside?
  5. If you’re not looking to do multichannel publishing, don’t have extreme performance needs Or a wish to burn lots of money on bleeding edge tech Then you don’t need a decoupled site. Yet. One of these days, ‘fast’ will be normal.
  6. publishes practical content for teachers, improve quality of education D7 site – 10-15 years of content Originally D6, migrated to D7, headed for D8 Lullabot engaged to do a discovery, come up with a future plan for Edutopia.
  7. Sally is one of our lullabot API/JS experts, and was on the discovery team. JavaScript Modernization Initiative… Multiple article content types, Design system and social…
  8. After all the discussion, to build a new Edutopia.org using a decoupled D8/React architecture Talk front-end, then back-end, Now, a word about JSONAPI…
  9. Run the list… This makes an API work out of the box… But you have to be serving up high-quality data for any of this to matter…
  10. If you can’t break your data down into discrete bits, you’re not going to have a successful decoupled experience. Content modeling is super important, all the way down to what you allow in the body field.
  11. HTML lacks the necessary structure for use in a decoupled project. It’s essentially one long string of text, which you have to render to the screen all at once. In this example, we don’t have much freedom to alter or remix the data, cause it’s all been rendered to markup already.
  12. Content modeling and structuring your data is essential. But… We can take each bit of data here and mix them up anyway we want in our React components. JSONAPI handles this for us in Drupal – except when we might bury important data inside other fields
  13. Talk through request lifecycle… Among the many problems you have to solve, there has to be some planning about the URLs your front-end will handle. This is commonly called routing. When you receive a request, how do you know what data to call from the API?
  14. The URL fragment shown above (/article/* ) is passed through. The Front-end has to inspect and figure out what api call to make. This is called routing. JSONAPI module provides entity/bundle endpoints for pretty much anything in the Drupal CMS – nodes, terms, users, custom entity types.
  15. Talk through request lifecycle… Among the many problems you have to solve, there has to be some planning about the URLs your front-end will handle. This is commonly called routing. When you receive a request, how do you know what data to call from the API?
  16. Two of the pieces that sit behind a page on Edutopia.org are the API data we called from Drupal… And the component (template) in react that we shove that data into… You’ll note that all our data is sitting under that attributes key, in name-value pairs…
  17. Talk through request lifecycle… Among the many problems you have to solve, there has to be some planning about the URLs your front-end will handle. This is commonly called routing. When you receive a request, how do you know what data to call from the API?
  18. The URL fragment shown above (/article/* ) is passed through. The Front-end has to inspect and figure out what api call to make. This is called routing. JSONAPI module provides entity/bundle endpoints for pretty much anything in the Drupal CMS – nodes, terms, users, custom entity types. That URL slug gave us enough of a clue that we could call the data and it would render, like this: So what’s behind this rendered page?
  19. Talk through request lifecycle… Among the many problems you have to solve, there has to be some planning about the URLs your front-end will handle. This is commonly called routing. When you receive a request, how do you know what data to call from the API?
  20. Our routing example from earlier was straightforward, but it’s not the whole story. Real websites have years of urls to handle – they change format over time, have to be kept up for SEO or social media reasons… Edutopia wanted to keep that haystack of URLs. This meant an url slugs like article/* might not really point to articles, and we can’t establish clear rules. Solution: add api endpoint that takes a url, looks it up, and then pipes it through the JSONAPI stack to render whatever JSON response is needed. Front-end then has to have logic to parse the type of response and hand off to the right rendering components. (get better words here)
  21. So we couldn’t expect the front-end to know anything certain about the url slugs that were being requested. So eventually we gave up and asked Drupal Instead of the stock jsonapi endpoint, we wrote a ‘resolver’ that looked up content by url alias Then we returned that data using the JSONAPI layer, and react had to make sense of it and do the right thing to render it. This added complexity, and we can’t recommend doing this… but it was performant, and allowed us to satisfy the requirement.
  22. Tour of the home page
  23. Node form for landing page –
  24. Editors don’t always like this structured data stuff. Too many fields, not enough visual feedback Abstraction is great for software, but hard for humans.
  25. For trained users who know what to expect… this works great.
  26. For users who just want to get the work done… Edutoipa needed more freedom to embed things into the body.
  27. Video: editing process But you said the body field was bad!
  28. Remember this slide? Yeah – you can’t make good choices on the front end if you’re already rendering markup from Drupal.
  29. Solution in Drupal: Media entities + entity embed + customizations to entity browser Hidden entity-ref field was important – cause it won’t show in the API unless it’s in a field. Here’s what it looked like:
  30. Yikes. This is that drupal entity, embedded in the body of the article. Data attributes keep things structured… But you have to extract that out of the body the hard way.
  31. Yikes. This is that drupal entity, embedded in the body of the article. Data attributes keep things structured… But you have to extract that out of the body the hard way.
  32. Our RichText component in React has to scan the body and break it into chunks (PITA, fragile) Chunks get rendered through React components as needed.
  33. And the editors loved it.
  34. Images render markup through react components, based on API data. The Editors can do their thing, and embed media into their articles, and everyone is happy…
  35. Except for the front-enders. They cry. It’s fincky regular expressions for days. But when they’re done, it’s great. Let’s switch gears and talk about performance…
  36. It’s troublesome to juggle these early in the dev process, when your content model is still in flux. But when it’s stable, and before you’re really in the front-end dev game, start using them. Also useful to clearly document page components and their related fields, so you can easily refer back and keep things clean.
  37. Problem: Authoring content in Drupal doesn't leave you with a sense of what the content will really look like when rendered. Back-end solution: Custom endpoint taking revision IDs, look up revision, render through JSONAPI stack, Front-end solution: set up additional host using end to serve revisions, with config to enable previews, basic auth token being passed, auth to preview system.
  38. To take it back to our example for the Edutopia homepage, here’s what the related content would look like:
  39. The actual JSONAPI response is a little messy – the component entity consists of some metadata and then a list of UUIDs, which are references to data objects elsewhere in the data. Our code works through all that and stores it in Redux, which triggers the render of the corresponding React component.
  40. The actual JSONAPI response is messy – the component entity consists of some metadata and then a list of UUIDs, which are references to data objects elsewhere in the data. Our code has to work through all that and store it in Redux, which triggers the render of the corresponding React component.
  41. EOL implementations - 3+ article-style content types - New design system engagement and SEO increasingly affected by performance Decoupled or not?