SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Using WordPress as a
Headless CMS with
WPGraphQL
Tampere WordPress Meetup, 14.11.2019
Ari-Pekka Koponen, Vincit, ari-pekka.koponen@vincit.fi
Who am I?
Ari-Pekka Koponen, by everybody calls me A-P.
The easiest way for me to get into flow is by coding. I’ve
worked 3½ years with WordPress full-time and a total of 7½
years as a full-stack developer.
I work as Tech Director at Vincit, where I help our customers
in selecting the best possible technologies for their business
needs and create wonderful digital services.
vincit.fi
2007Founded
450+Employees
43,5 M€
Turnover 2018
4,1 M€
EBIT 2018
Tampere – Helsinki – Turku – Oulu, FInland
Palo Alto – Orange County – Santa Monica, USA
Best place to work in Europe 2016
Best place to work in Finland 2014, 2015, 2016
(Great place to work)
Specialist of service and
business design,
software development
and continuous services
Award-winning
workplace
with 100% satisfaction guarantee.
Vincit in a Nutshell
If you love web-development and would like work interesting projects, please go to https://www.vincit.fi/en/careers/ and send an application. Do it now! 🔥
IKAALISTENMATKATOIMISTO.FI
300 000+
VISITORS PER MONTH
220%
INCREASE IN
CLUB LOYALTY
28%
INCREASE IN
AVERAGE PURCHASE
Designed and developed brand new web store
and customized ERP for Finnish travel agency
including dynamic pricing and integrated
marketing solutions.
Furthermore created and implemented concepts
for e.g. recommendation rewards and loyalty
program.
Customer story
ORAL.FI
Design and development of Oral
Hammaslääkärit website, OmaOral customer
service portal and web booking. In addition
development of internally used solutions for
better efficiency and customer service.
Customer story
Bullshit Bingo Time!
Bullshit Bingo Time!
1. Go to https://bit.ly/wp-bingo
2. Concoct a nickname and a team name for yourself
3. Use the Game name Bullshit-bingo
4. Click “Join!”
5. You now have your own, hand-made bullshit bingo card!
6. Listen to this talk and mark the bullshit words you hear.
7. When you get a bingo,
a. Stand up and
b. shout “THIS IS BULLSHIT!” and
c. you will receive a handsome 20€ (!!!) cash price!
Bullshit Bingo Time!
1. Go to https://bit.ly/wp-bingo
2. Concoct a nickname and a team name for yourself
3. Use the Game name Bullshit-bingo
4. Click “Join!”
5. You now have your own, hand-made bullshit bingo card!
6. Listen to this talk and mark the bullshit words you hear.
7. When you get a bingo,
a. Stand up and
b. shout “THIS IS BULLSHIT!” and
c. you will receive a handsome 20€ (!!!) cash price
40-50€ (!!!!!!) worth of movie tickets!
What is a Headless
CMS?
Traditional CMS architecture
The frontend and backend are
rendered on the server (in
WordPress).
The backend is coupled together
with the frontend.
WordPress
Frontend / UI Backend
Browser
Headless CMS architecture
The frontend and backend
separated with an API.
The frontend runs as a JavaScript
application on the user’s browser.
WordPress
JavaScript
App
Backend
HTTP
API
Mobile
Mobile App
Popular Headless CMS options
Popular options
- WordPress REST API (Open Source)
- Contentful (SaaS)
- Prismic (SaaS)
- Drupal? (Open Source)
Maybe soon popular
- WordPress WPGraphQL (Open Source)
What is GraphQL?
What is GraphQL?
GraphQL is a query language for your API.
It is not tied to any specific database or storage engine
and can be used with any programming language or
database.
GraphQL APIs have a strongly typed Schema. The
GraphQL Schema is composed of Types, and Types are
composed of Fields.
{
bingoGames(where: {title: "Fruitbingo"}) {
edges {
node {
id
title
words
players {
title
team {
title
}
}
}
}
}
}
This is what it looks like!
What is a Graph?
NodeNodeNode Node
Node Node
Node Node Node
Look, a third Edge here!An Edge A second Edge
OMG,
Edges everywhere!
What is a graph?
Graphs consist of nodes and edges.
A node is an individual resource. For example, a Post, Page, Bingo Game or User.
Edges are the connections between nodes.
A Bingo Graph
PlayerPlayerPlayer Player
Bingo Game Bingo Game
Team Team Team
Our Bingo Graph
MichaelPamAngela Dwight
Fruitbingo
Star Wars
bingo
Team Gosu Team 1337 Team OP
Why use GraphQL instead of REST?
A single endpoint for all queries.
A single way for documenting your API, that allows introspection. This allows tools like GraphiQL to
suggest you fields and relationships.
A standardized way for returning linked objects (relationships) in a single request.
The frontend developer can query just the fields they need. This makes payloads smaller and allows
the API developer to see what data is actually used.
Any questions?
How to use GraphQL
with WordPress?
How to use GraphQL with WordPress?
WPGraphQL (https://www.wpgraphql.com/) is a free plugin that exposes WordPress data through a
GraphQL API.
Built using the GraphQL-PHP library.
It provides an executable, extendable Schema and resolvers for a WordPress site.
DIY Bingo time!
Let’s Build a Bingo App using WPGraphQL
We’ll build a Bingo app using WordPress and React.
We could use any frontend framework, a static site generator like Gatsby or Nuxt, or even build a
mobile app).
I’ll use React today, because I’m familiar with it.
[DEMO]
Any questions?
Challenges in using
GraphQL with WordPress
Challenges in using GraphQL with WordPress
WPGraphQL is quite fresh (started in 2017) and has had a few very bad security issues. The newer
versions have addressed these issues and the codebase has been audited, but still a concern.
WordPress does not have a native and performant solution for post relationships, which makes
building performant Graph APIs hard.
Thank you!

Weitere ähnliche Inhalte

Ähnlich wie Using WordPress as a Headless CMS with WPGraphQL

RPiUsersGuide.pdf
RPiUsersGuide.pdfRPiUsersGuide.pdf
RPiUsersGuide.pdf
mohan s
 
Chico UI - Retreat 2011
Chico UI - Retreat 2011Chico UI - Retreat 2011
Chico UI - Retreat 2011
Guillermo Paz
 

Ähnlich wie Using WordPress as a Headless CMS with WPGraphQL (20)

RPiUsersGuide.pdf
RPiUsersGuide.pdfRPiUsersGuide.pdf
RPiUsersGuide.pdf
 
Chico UI - Retreat 2011
Chico UI - Retreat 2011Chico UI - Retreat 2011
Chico UI - Retreat 2011
 
Why we are still writing?
Why we are still writing?Why we are still writing?
Why we are still writing?
 
Securing The Studio: How Netflix Protects Productions From Pitch To Play
Securing The Studio: How Netflix Protects Productions From Pitch To PlaySecuring The Studio: How Netflix Protects Productions From Pitch To Play
Securing The Studio: How Netflix Protects Productions From Pitch To Play
 
Alexandra Deschamps Sonsino - So you want to quit your dayjob to build a conn...
Alexandra Deschamps Sonsino - So you want to quit your dayjob to build a conn...Alexandra Deschamps Sonsino - So you want to quit your dayjob to build a conn...
Alexandra Deschamps Sonsino - So you want to quit your dayjob to build a conn...
 
So you want to quit your day job and make a connected product
So you want to quit your day job and make a connected productSo you want to quit your day job and make a connected product
So you want to quit your day job and make a connected product
 
Ink AI Review.pdf
Ink AI Review.pdfInk AI Review.pdf
Ink AI Review.pdf
 
Bradfield, Chris - Godot engine game development projects_ build five cross-p...
Bradfield, Chris - Godot engine game development projects_ build five cross-p...Bradfield, Chris - Godot engine game development projects_ build five cross-p...
Bradfield, Chris - Godot engine game development projects_ build five cross-p...
 
iOS development made easy
iOS development made easyiOS development made easy
iOS development made easy
 
Kanoon Technology Web design - All designers
Kanoon Technology Web design - All designersKanoon Technology Web design - All designers
Kanoon Technology Web design - All designers
 
Portland Splunk User Group May 2020
Portland Splunk User Group May 2020 Portland Splunk User Group May 2020
Portland Splunk User Group May 2020
 
Build Own Website
Build Own WebsiteBuild Own Website
Build Own Website
 
Building Droids with JavaScript
Building Droids with JavaScriptBuilding Droids with JavaScript
Building Droids with JavaScript
 
Spark core intro
Spark core introSpark core intro
Spark core intro
 
ChatGpt like-Brain Box.pdf
ChatGpt like-Brain Box.pdfChatGpt like-Brain Box.pdf
ChatGpt like-Brain Box.pdf
 
Bot that chats with sap
Bot that chats with sapBot that chats with sap
Bot that chats with sap
 
Introjs10.5.17SD
Introjs10.5.17SDIntrojs10.5.17SD
Introjs10.5.17SD
 
Intro to JavaScript - LA - July
Intro to JavaScript - LA - JulyIntro to JavaScript - LA - July
Intro to JavaScript - LA - July
 
How ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in PopularityHow ChatGPT led OpenAPI's Recent Spike in Popularity
How ChatGPT led OpenAPI's Recent Spike in Popularity
 
Getting started with Raspberry Pi - By Ibrahim
Getting started with Raspberry Pi - By IbrahimGetting started with Raspberry Pi - By Ibrahim
Getting started with Raspberry Pi - By Ibrahim
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Using WordPress as a Headless CMS with WPGraphQL

  • 1. Using WordPress as a Headless CMS with WPGraphQL Tampere WordPress Meetup, 14.11.2019 Ari-Pekka Koponen, Vincit, ari-pekka.koponen@vincit.fi
  • 2. Who am I? Ari-Pekka Koponen, by everybody calls me A-P. The easiest way for me to get into flow is by coding. I’ve worked 3½ years with WordPress full-time and a total of 7½ years as a full-stack developer. I work as Tech Director at Vincit, where I help our customers in selecting the best possible technologies for their business needs and create wonderful digital services.
  • 4. 2007Founded 450+Employees 43,5 M€ Turnover 2018 4,1 M€ EBIT 2018 Tampere – Helsinki – Turku – Oulu, FInland Palo Alto – Orange County – Santa Monica, USA Best place to work in Europe 2016 Best place to work in Finland 2014, 2015, 2016 (Great place to work) Specialist of service and business design, software development and continuous services Award-winning workplace with 100% satisfaction guarantee. Vincit in a Nutshell If you love web-development and would like work interesting projects, please go to https://www.vincit.fi/en/careers/ and send an application. Do it now! 🔥
  • 5. IKAALISTENMATKATOIMISTO.FI 300 000+ VISITORS PER MONTH 220% INCREASE IN CLUB LOYALTY 28% INCREASE IN AVERAGE PURCHASE Designed and developed brand new web store and customized ERP for Finnish travel agency including dynamic pricing and integrated marketing solutions. Furthermore created and implemented concepts for e.g. recommendation rewards and loyalty program. Customer story
  • 6. ORAL.FI Design and development of Oral Hammaslääkärit website, OmaOral customer service portal and web booking. In addition development of internally used solutions for better efficiency and customer service. Customer story
  • 8. Bullshit Bingo Time! 1. Go to https://bit.ly/wp-bingo 2. Concoct a nickname and a team name for yourself 3. Use the Game name Bullshit-bingo 4. Click “Join!” 5. You now have your own, hand-made bullshit bingo card! 6. Listen to this talk and mark the bullshit words you hear. 7. When you get a bingo, a. Stand up and b. shout “THIS IS BULLSHIT!” and c. you will receive a handsome 20€ (!!!) cash price!
  • 9. Bullshit Bingo Time! 1. Go to https://bit.ly/wp-bingo 2. Concoct a nickname and a team name for yourself 3. Use the Game name Bullshit-bingo 4. Click “Join!” 5. You now have your own, hand-made bullshit bingo card! 6. Listen to this talk and mark the bullshit words you hear. 7. When you get a bingo, a. Stand up and b. shout “THIS IS BULLSHIT!” and c. you will receive a handsome 20€ (!!!) cash price 40-50€ (!!!!!!) worth of movie tickets!
  • 10. What is a Headless CMS?
  • 11. Traditional CMS architecture The frontend and backend are rendered on the server (in WordPress). The backend is coupled together with the frontend. WordPress Frontend / UI Backend
  • 12. Browser Headless CMS architecture The frontend and backend separated with an API. The frontend runs as a JavaScript application on the user’s browser. WordPress JavaScript App Backend HTTP API Mobile Mobile App
  • 13. Popular Headless CMS options Popular options - WordPress REST API (Open Source) - Contentful (SaaS) - Prismic (SaaS) - Drupal? (Open Source) Maybe soon popular - WordPress WPGraphQL (Open Source)
  • 15. What is GraphQL? GraphQL is a query language for your API. It is not tied to any specific database or storage engine and can be used with any programming language or database. GraphQL APIs have a strongly typed Schema. The GraphQL Schema is composed of Types, and Types are composed of Fields. { bingoGames(where: {title: "Fruitbingo"}) { edges { node { id title words players { title team { title } } } } } } This is what it looks like!
  • 16. What is a Graph? NodeNodeNode Node Node Node Node Node Node Look, a third Edge here!An Edge A second Edge OMG, Edges everywhere!
  • 17. What is a graph? Graphs consist of nodes and edges. A node is an individual resource. For example, a Post, Page, Bingo Game or User. Edges are the connections between nodes.
  • 18. A Bingo Graph PlayerPlayerPlayer Player Bingo Game Bingo Game Team Team Team
  • 19. Our Bingo Graph MichaelPamAngela Dwight Fruitbingo Star Wars bingo Team Gosu Team 1337 Team OP
  • 20. Why use GraphQL instead of REST? A single endpoint for all queries. A single way for documenting your API, that allows introspection. This allows tools like GraphiQL to suggest you fields and relationships. A standardized way for returning linked objects (relationships) in a single request. The frontend developer can query just the fields they need. This makes payloads smaller and allows the API developer to see what data is actually used.
  • 22. How to use GraphQL with WordPress?
  • 23. How to use GraphQL with WordPress? WPGraphQL (https://www.wpgraphql.com/) is a free plugin that exposes WordPress data through a GraphQL API. Built using the GraphQL-PHP library. It provides an executable, extendable Schema and resolvers for a WordPress site.
  • 25. Let’s Build a Bingo App using WPGraphQL We’ll build a Bingo app using WordPress and React. We could use any frontend framework, a static site generator like Gatsby or Nuxt, or even build a mobile app). I’ll use React today, because I’m familiar with it.
  • 28. Challenges in using GraphQL with WordPress
  • 29. Challenges in using GraphQL with WordPress WPGraphQL is quite fresh (started in 2017) and has had a few very bad security issues. The newer versions have addressed these issues and the codebase has been audited, but still a concern. WordPress does not have a native and performant solution for post relationships, which makes building performant Graph APIs hard.