LEAN (I hope you’ll excuse me for only using Lean from now on) is a framework that integrates Angular and the WordPress REST API. They term it an “ecosystem” because it’s a series of integrated projects that all work nicely together.
I tested Lean to see if I could quickly get up and running, powering a local Angular app with an external WordPress website. All in all, it’s very promising, even if there are some gaps right now that make it somewhat challenging (for me at least) to get up and running. Lean offers a self-described, “opinionated workflow, aiming to spin up working websites as quickly as possible.” It also has support for specific plugins, namely Advanced Custom Fields and Gravity Forms.
There’s an entire Github account for Lean, with a variety of projects within. The two primary you need to get started are the WordPress plugin and the web app. You can use the WordPress plugin either on a live site or on a local install, and the web app has a process for running its own server. It’s worth noting that you probably need to be running PHP 5.6 or higher (my VVV caused issues running 5.5x).
Lean does not require the WordPress REST API plugin, as it runs using the infrastructure in core and has its own endpoints. It’s one of the bigger disappointments of the project to me, as it seems they could’ve had a lot of free work done for them using the plugin for endpoints, and instead their endpoints aren’t quite as well fleshed out yet. Perhaps they’ll add support for core endpoints at some point; I hope so.
Otherwise, playing with Lean is a lot of fun. I was able to get the app up and running and was starting to learn the ends and outs of templating in the Angular app before I ran out of time. One of the other things Lean could use is a more fleshed out base app and templates so that you could have a basic blog or something running quickly. The tech lead for Lean who I worked with, Adam Fenton, tells me that’s very much on the to-do list.
Once you’re setup, you can create templates in Angular to display posts, pages, and archives. And the Angular app will be able to see newly published posts in WordPress. So your structure for your website might have the Angular app deployed to example.com, and the WordPress install at something like api.example.com. They have a theme that prevents any rendering from the actual WordPress install.
The Moxie team is running Lean in production on Skaled.com, and have more in the pipeline. If you want to get a feel for using the WordPress REST API for a full headless application, but don’t know where to start, this could be a really good place — assuming the docs get fleshed out over the next few weeks. I was a bit of a crash-test dummy for them, so I think the documentation will continue to improve. But overall, Lean is very impressive and a lot of fun to play with.