This document discusses WordPress as part of a hybrid architecture. It provides a case study of Caldera Forms Pro which uses WordPress for content and ecommerce while building additional functionality as separate microservices. This allows each component to scale independently and reduces security risks. The document outlines how Caldera Forms Pro uses WordPress and separate services for ecommerce, user login/authentication, form submissions, error logging, and an admin interface. It also discusses other ways WordPress can be part of a hybrid architecture.
2. @Josh412
CalderaLabs.org
Hi I'm Josh
Lead Developer: Caldera Labs
Caldera Forms and Caldera Forms Pro
Caldera Learn
2 books about WordPress development
Core contributor to WordPress
Member of The WPCrowd
15. @Josh412
“
CalderaLabs.org
A monolithic application built as a single unit. The
server-side application will handle HTTP requests,
execute domain logic, retrieve and update data from
the database, and select and populate HTML views to
be sent to the browser.
- Martin Fowler
17. @Josh412
“
CalderaLabs.org
The microservice architectural style is an approach
to developing a single application as a suite of small
services, each running in its own process and
communicating with lightweight mechanisms, often
an HTTP resource API.
- Martin Fowler
18. @Josh412
“
CalderaLabs.org
[in microservice architecture] there is a bare
minimum of centralized management of these
services, which may be written in different
programming languages and use different data
storage technologies.
- Martin Fowler
19. @Josh412
One server for:
PHP
Database (MySQL/MariaDB/Percona)
Webserver (nGinx/Apache)
Object Cache (Memcached/ Redis)
Email and other tasks not suited to WordPress
WordPress Is Monolithic By Default
20. @Josh412
We Are Already Moving To Services
Transactional Email Services
Task Runners For WP-Cron
Separate Database Servers(s)
Media Library on s3
CDNs
Decoupled front-ends via REST API
Containerized Hosting Architecture
28. @Josh412
Business Needs
Case Study:
Caldera Forms Pro
Solve the WordPress contact form email
problem.
WordPress shouldn’t be used for emails.
Improve support
Stop asking questions about errors
Control our platform
Deliver all in one solutions.
38. @Josh412
APirate
Plugin to limit access to WordPress REST API
routes
Optional eCommerce via Easy Digital
Downloads
Could work with other eCommerce platforms
Pronounced “API Rate” or “A Pirate”
Gitlab.com/caldera-lab/apirtate
40. @Josh412
Transaction
(new
subscription
or update)
Find Account
CF Pro
Account
Exists?
Find by
wp_id
Create Key
Create
Account
Update Key
Update
Account
Store App Account
ID as wp_post_meta
CF Pro App
WordPress
(Taco)
WordPress
(EDD/Core/Etc)
APirate
Color Key
NO Yes
Plan One: eCommerce
43. @Josh412
Shortcomings Of Plan One
All requests go through WordPress
Double-blocking POST requests
Scaling challenges
No isolation
Crash one site, crash them all
44. @Josh412
Plan Two: Towards Microservices
WordPress
eCommerce
App Login
Marketing Automation
Docs
Main App
API Key Authentication
UI
SendGrid Proxy
PDF Generation
Resource Management (via s3)
47. @Josh412
Main App: Laravel
Laravel Blade to serve one view for SPA
Some additional ugly screens for admin
API for:
Key auth
Account management
Message handling (SendGrid proxy)
Taco
Assets to s3
48. @Josh412
App Front-end : VueJS
Single page web app
Webpack
Vuetify
Vue Router
Uses API Keys To Authenticate vs App
Cookies used to store key/token
49. @Josh412
Logging App
Connects to client plugin
Key auth via main app
Saves logs from client via Monolog and s3
No database
Unless you count Redis...
50. @Josh412
Client Plugin
Connects to Caldera Forms via Plugins API
Connects to main app via key auth
Connects to log app via key auth
Admin page uses VueJS and WordPress REST
API
51. @Josh412
CalderaLabs.org
App: eCommerce
CF Pro App
WordPress
(Taco)
WordPress
(EDD/Core/Etc)
Client Plugin
Color Key
Logging App
Transaction (new subscription or
update)
Find Account
CF Pro
Account Exists?
Find by wp_id
Create Account Update Account
Store App Account ID as wp_post_meta
52. @Josh412
CalderaLabs.org
App: Login
CF Pro App
WordPress
(Taco)
WordPress
(EDD/Core/Etc)
Client Plugin
Color Key
Logging App
Login wp-json
Get CF Pro
Account ID
Load App
JWT Auth
Plugin