Javascript, APIs, and the Future of WordPress

Automattic just announced Calypso, which is a radical new interface for WordPress.com.
It replaces the old WordPress.com admin experience with a faster, more modern approach. It uses a Javascript framework called React, which was developed by Facebook. The main advantage of React is that it’s supposed to allow development of web and mobile apps using a similar codebase.
WordPress.com now uses an API to communicate with a Node server, instead of processing with PHP. The advantage of this is that it’s much faster and more interactive, and there are no page refreshes. It’s the same approach that makes many mobile and web apps tick, and it has the performance many users have come to expect these days.
This is a huge shift for WordPress.com, and it’s a major milestone for WordPress in general. Even though many sites and apps have already been taking this API driven approach, this marks a huge shift in WordPress development philosophy.
The question I’m wondering is, where is this all going? What does this shift mean for developers, products, and WordPress core?
I’ve been working with Javascript apps and WordPress APIs for over a year now, and I have a lot of thoughts on the subject.

Is WordPress going 100% Javascript?

The WordPress.com admin is now all Javascript, but it’s important to note that websites hosted on WordPress.com are still using PHP like normal. The front-end facing WordPress.com sites have not changed, but could they?
It would be super cool if WordPress sites could all be single page web apps, the same way that the new admin is. Unfortunately, it will be a very long time until that happens.
WordPress core will support an API as soon as the WP-API is fully merged, sometime next year. Posts and pages are not hard to turn into an app, it’s all the stuff added on top of core in themes and plugins.
Fun fact: Node/PHP is not an issue here, you can still run single page web apps without Node.

Themes are less important with an API

If a WordPress site is 100% API driven, a theme will not be used at all.
Themes don’t have anything to do with an API driven WordPress, you won’t even need one on your site. That’s not to say there won’t be a visual component, but it will be all javascript templating. One example of this is mobile apps created with Reactor.
That’s not to say it’s impossible to use a theme and the WordPress API, that has already been done and will continue. In this case theme developers will require an entirely new approach to the way they build themes. Instead of thinking about template tags and a functions.php file, developers will be using Javascript templating and MVC frameworks.
One interesting concept is a WordPress API theme.

WordPress API Themes

WordPress themes are dependent on PHP right now, but if you are using an API, you could build a theme out of HTML/CSS/JS.
Instead of looking like this:
[php]

9 comments

  1. Really comprehensive look at the market now and I’m the future, Scott. JavaScript first plugins are something that I think will help the WordPress world flourish as you detail here. It’s exciting to think of our community moving more towards “maker” type of modualized marketplaces. There is so much inherent open source philosophy to the core of WordPress that is helping to guide this as you mention, and that fact I think really empowers our community as a whole. Thanks for writing this great analysis!

  2. I’ve been thinking about this too.
    Just when I was starting to feel that WordPress was growing stale and stagnant something comes along truly disruptive. Exciting times!
    Time will tell however if it succeeds in reinvigorating WP though as there are still a lot of hurdles to cross.
    I do think plugins will need to move to API first development ASAP. I think that’s second ary to JS first development. As such I’m already looking for resources on how to do that. How to handle custom tables in WP while being API friendly.
    One interesting thought I had I haven’t heard discussed much is that one of WP’s _key_ features has always been WP Comments. It’s one the the suckage point of using things like Jekyll, Drupal, etc… is that for the most part you’re stuck using Disqus or something like it. There are “difficult” to implement options like HashOver that are still technically self-hosted, but nothing really compares to WP comments.
    What happens if one builds a front end in Jekyll, but powers the comments with WordPress? It’s possible now, but I haven’t seen it and it would be interesting if nothing else.

    1. That’s an interesting idea Jon, using WP along with another backend. Sounds like it might be too much CMS overhead, but for some projects it might make sense.

  3. The part I like about this change the most is: “Plugins May Include Node Modules and Javascript Templates”. Exciting times ahead! Thanks Scott 🙂

Comments are closed.