rtCamp / wp-decoupled

Next.js app with WPGraphQL and WordPress at the backend.
wp-decoupled-git-master.rtcamp.vercel.app
MIT License
267 stars 38 forks source link
decoupled-wordpress graphql labs nextjs react research-development rtcamp-wp-decoupled woocommerce woocommerce-pwa wordpress wp-decoupled

WP Decoupled :zap:

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

This is a React theme boilerplate for WordPress, built with Next JS, Webpack, Babel, Node, Express.

Live demo site.

Live Demo

Demo :movie_camera:

Getting Started :surfer:

These instructions will get you a copy of the project up and running on your local machine for development purposes.

Installing :wrench:

  1. Clone this repo in git@github.com:rtCamp/wp-decoupled.git
  2. cd wp-decoupled
  3. nvm use
  4. npm install

Configure Backend( WordPress site ) :wrench:

1. Add GraphQl support on WordPress

  1. Clone and activate the following plugins, in your WordPress plugin directory:

  2. You can also import default wooCommerce products that come with wooCommerce Plugin for development ( if you don't have any products in your WordPress install ) WP Dashboard > Tools > WooCommerce products(CSV) : The WooCommerce default products csv file is available at wp-content/plugins/woocommerce/sample-data/sample_products.csv

2. For Authentication :lock:

a. You can use any secret token of your choice, however it would be best if you generate one using WordPress Salt generator (https://api.wordpress.org/secret-key/1.1/salt/) to generate a Secret. And just pick up any one of the token and add it in place of 'your-secret-token' below:

Define a Secret in wp-config.php of your WordPress directory:

   define( 'GRAPHQL_JWT_AUTH_SECRET_KEY', 'your-secret-token' );

b. Depending on your particular environment, you may have to research how to enable these headers, but in Apache, you can do the following in your .htaccess:

   SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Configure Front End :wrench:

SITE_URL=http://localhost:3000
NEXT_PUBLIC_WOO_SITE_URL=http://yourwocommercesite.com
WOO_CONSUMER_KEY=xxxxx
WOO_SECRET=xxxxx

Commands :computer:

Using PWA on mobile :iphone:

Branches Information :seedling:

  1. master Main React WooCommerce theme
  2. develop For testing
  3. wp-docoupled-boilerplate Boilerplate to start a new React theme project with PWA implementation ( Work in Progress )

Author

Contributors :bust_in_silhouette:

License :page_with_curl:

This project is licensed under the MIT License - see the LICENSE.md file for details

Does this interest you?

Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions