WordCamp LAX 2015 - Decoupled WordPress with the WP-API

25

Transcript of WordCamp LAX 2015 - Decoupled WordPress with the WP-API

CONTENT AS A SERVICE: DECOUPLED WORDPRESS

WITH WP-CLI

Pantheon.io 3

Speakers

Josh Koenig

Co-Founder & Head of Product

@outlandishjosh

Pantheon.io 4

Monoliths vs. Microservices

Monolith

Templates & Themes

Display Logic

Editorial UI

Admin UI

VS.

Decoupled

Pantheon.io 5

Monolithic Architecture

mon·o·lith ˈmänəәˌliTH/ noun 1.a large single upright block of stone, especially one shaped into or serving as a pillar or

monument. • synonyms: standing stone, menhir, megalith, sarsen (stone)

• "no one knows for sure who erected these monoliths and why” • a very large and characterless building. • "the 72-story monolith overlooking the waterfront” • a large block of concrete sunk in water, e.g., in the building of a dock.

2.a large and impersonal political, corporate, or social structure regarded as intractably indivisible and uniform. • "the dominance of broadcasting monoliths limits local programming"

Pantheon.io 6

The Limits of the Theme Layer as Architecture

Theme Layer

Plugins / Core

Permeable Boundary

Exciting / awkward game of chance

Pantheon.io 7

Monoliths Can Lead to Unhappy Developers

Pantheon.io 8

Strong Separation of Concerns

Client

WordPress

HTTP API

Everyone Wins

Pantheon.io 9

Use the Tools You Prefer

Pantheon.io 10

Parallel Track Progress

Pantheon.io 11

Future Proofing

Pantheon.io 12

Caveats

Pantheon.io 13

HTTP: Do you speak it?

Hur De Flur Shiffen de PUT Dur Skurf Nerf CURL we

Flu Pur OPTIONS me Skupplen de Noff

Pantheon.io 14

No, seriously… HTTP

source: https://github.com/inhabitedtype/ocaml-webmachine

Pantheon.io 15

WordPress Does a Lot of Things

Pantheon.io 16

Primary Use-Case: Custom Sites/Apps

Source: 2014 State of the Word

Pantheon.io 17

WP-API Can Grow the WP Market

MANY WAYS OF DECOUPLINGWhich is right for you?

Pantheon.io 19

Static Generator / Renderer

CMS

StaticSite

User Request

Static• Create a fast and resilient

user-facing site.

• Utilize front-end atomic design tools, minimal/elegant markup, etc.

• Read-only, but highly secure and scalabe.

Pantheon.io 20

Hybrid

CMS

StaticSite

User Request

Static• Build up a REST API on your

site to power dynamic forms/dashboards.

• Many other functions served directly from Drupal as per normal.

• Restrains the scope. Allows for particular experiences to be enhanced.

CMS

JS App

User Request

Hybrid

Pantheon.io 21

“Single Page” App

CMS

StaticSite

User Request

Static• Client side JavaScript

application runs in-browser, pulls data from CMS via API.

• May include user interactions, or be purely content oriented.

• Typically utilize a front-end framework like Angular, Backbone, or React.

CMS

SinglePage App

User Request

Single Page

Pantheon.io 22

Native Mobile App / IoT

CMS

StaticSite

User Request

Static• CMS powers embedded

applications via API.

• May also present some web functionality to users.

• Drive IOS and Android native apps, as well as “internet of things” implementations.

CMS

Native Mobile

App

User Request

Native

(optional)

Pantheon.io 23

CMS-on-CMS

CMS

StaticSite

User Request

Static• Separation of concerns, but

not technologies.

• Front-end CMS can control configuration, caching, throttling.

• Develop reusable components for a Service-Oriented / Microservices architecture.

CMS

User Request

CMS2

CMS

Pantheon.io 24

Everything Old is New Again

Pantheon.io 25

Thanks!

Thanks! Questions?

http://wclax.reviews/

@outlandishjosh