GithubHelp home page GithubHelp logo

jmo-jr / headless-wp-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from postlight/headless-wp-starter

0.0 2.0 0.0 2.46 MB

๐Ÿ”ช WordPress + React: a starter kit

PHP 64.35% JavaScript 29.66% CSS 5.99% ApacheConf 0.01%

headless-wp-starter's Introduction

WordPress + React Starter Kit

Postlight's Headless WordPress + React Starter Kit is an automated toolset that will spin up two things:

  1. A WordPress backend that serves its data via the WP REST API.
  2. A server-side rendered React frontend using Next.js.

What's inside:

  • Installer script which bootstraps a clean, default core WordPress installation plus all the plugins you need to set up custom post types and custom fields and expose them in the WP REST API (Advanced Custom Fields Pro, Custom Post Type UI, and ACF to WP API).
  • All the starter theme code, fixes, and settings you need for building and running headless WordPress, including pretty permalinks, CORS Allow headers, and useful logging functions for easy debugging.
  • A mechanism for easily importing data from an existing WordPress installation anywhere on the web using WP Migrate DB Pro and its accompanying plugins (license required).
  • A Docker container and scripts to manage it, for easily running the frontend React app locally or deploying it to any hosting provider with Docker support.

Let's get started.

WordPress Backend

The following setup will get WordPress running locally on your machine, along with the WordPress plugins you'll need to create and serve custom data via the WP REST API.

Note: This environment has only been tested under OS X. It requires Homebrew and Yarn.

To install and start WordPress, run the following command:

> yarn install && yarn start

When that completes successfully, the WordPress REST API will be available at http://localhost:8080.

Import Data (Optional)

To import data and media from a live WordPress install locally, use Migrate DB Pro. In the robo.yml file, set the plugin license and source install. Then, run robo wordpress:import to pull in the data.

Extend the WordPress API

At this point you can start setting up custom fields, and if necessary, creating custom REST API endpoints in the Postlight Headless WordPress Starter theme. When you do, be sure to use WordPress coding standards.

React Frontend

To spin up the frontend client app, run the following commands:

> cd frontend && yarn install && yarn run dev

The Next.js app will be running on http://localhost:3000.

Docker

This project uses a Docker container, which can be run locally or deployed to a hosting provider with Docker support like AWS Elastic Beanstalk.

Once you have Docker installed on your computer, you can run the container locally using this command:

# Build and run the container
> yarn run deploy

Made with โค๏ธ by Postlight. Happy coding!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.