Get in touch
Engineering

Postlight’s WordPress + React Starter Kit: Now Version 2.0!

Spin up a headless WordPress CMS powering a modern JavaScript app in one step.

We’re thrilled to release version 2.0 of Postlight’s WordPress + React Starter Kit, a major update that includes one-step startup, user authentication, and a greatly-improved developer experience.

Who This Is For

For engineers and publishers shopping for a “headless” CMS—a way to enter content into a free, off-the-shelf backend system decoupled from a custom JavaScript frontend app—WordPress and React are fantastic options. Postlight’s Starter Kit spins up the WordPress admin talking to sample React apps in one step, so you can start tinkering and testing for your own potential use. (Read more about the business case for this stack in our launch announcement.)

Get the WordPress + React Starter Kit for free here on GitHub:

postlight/headless-wp-starter

🔪 WordPress + React Starter Kit. Contribute to postlight/headless-wp-starter development by creating an account on GitHub.

When we released the kit back in the fall of 2017, it was a few installer scripts that worked really well on Mac OS X, and a REST API-powered sample frontend—and that drew thousands of stars, hundreds of forks, and over a dozen contributors on GitHub.

What’s New

This release makes the kit more modern, portable, and developer-friendly than ever, introducing tools and standards like GraphQL, Docker, and JSON Web Tokens.

Here what’s new in version 2.0:

  • All-new GraphQL-powered React frontend. In addition to the original REST-powered Next.js frontend, the starter kit now includes a GraphQL-powered sample app to try as well. (See it in the frontend-graphql folder.) That means you get to choose which API standard you work with for your purposes.
  • User authentication with JWT. Now WordPress users can log in not only via the CMS backend, but using the JavaScript frontend, thanks to JSON Web Tokens. All you do is define your secret key in the WordPress config file, and go. (Check out the screencast below of user sign-in in action.)
  • One-step startup using Docker containers that work everywhere. With a single Docker Compose command, on any operating system, the starter kit spins up 4 containers: the database container, the WordPress container, the REST JavaScript frontend, and the GraphQL frontend. Each one of these environments is available for you to tail logs, run SQL queries, and access at the command line for easy debugging.
  • Better developer tools, including continuous integration and better code linting. Pull requests now automatically build on Travis CI, and in addition to PHP Code Sniffer for WordPress theme development, Prettier and ESLint are configured to keep JavaScript code consistent on both frontend apps.

Here’s what user authentication looks like in action in the sample frontend:

Huge thanks to Postlight engineers Alexi Akl and Ryan Williams for turning a year of “Wouldn’t it be great if we—” conversations into beautiful, working code for this new release.

Pull Requests Welcome

Give the starter kit a try, fork and clone the repository and experiment with it, file an issue with your feature request and questions, and send us a pull request with your suggestions—we’d love to hear what you think and how you’re using it.

Gina Trapani is a Managing Partner at Postlight. If you want to talk about headless content management systems, drop me a note: [email protected].