WordPress As An Application Framework
I want to use WordPress as an application framework. I like the user-friendly admin, easy install, low maintenance, and rich set of plugins. I can use it for content heavy applications that need some sort of human data entry on the back-end. I want to expose the data in WordPress via an API to a consumer application (mobile app, client side web app)
But it has some limitations:
- Custom meta fields are serialized in one table (post_meta)
- Slow performance because of PHP load time and WordPress bootstrap on every request
- Inefficient SQL queries
Flat data structure
My solution:Add MongoDB interface to WordPress store custom meta fields, in key/value pair format
- Create Node.JS/MongoDB middleware between client and WordPress for caching
- Skip wp bootstrap calls on every request
- Create UI for creating nested JSON structures. Map custom fields back to JSON upon data retrieval.
The first step would be to create a developer UI that provides an easy interface for generating models as custom posts. It will look like most custom post type plugins, where form controls can be drag/dropped into metaboxes. The developer will specify the JSON data type for each of these fields, set up validation rules and create a mapping to a JSON file structure. Then the developer will configure which RESTful interfaces/endpoints will be available for the model and any authentication rules.
After creating the custom post type, the developer can set up notification services to update the cache. The cache will selectively update and version changes to the models.
A queue of add/remove/update operations will be maintained by the immediate database layer. When transactions are committed, they will be relayed to WordPress via the JSON API.
This is not ideal for applications that use real time data. It is great for content heavy applications like place directories, news feeds, information apps, sports apps…
Why?
There is no easy way to manage application content right now. I have looked at Cloud CMS, Contentful…, but they do not offer the convenience and intuitive interface that WordPress provides.
If I make any progress on this, I will post updates.