Giter VIP home page Giter VIP logo

rtcamp / wp-decoupled Goto Github PK

View Code? Open in Web Editor NEW
262.0 43.0 37.0 8.4 MB

Next.js app with WPGraphQL and WordPress at the backend.

Home Page: wp-decoupled-git-master.rtcamp.vercel.app

License: MIT License

JavaScript 92.31% CSS 1.49% Shell 0.12% SCSS 6.07%
wordpress graphql wp-decoupled decoupled-wordpress nextjs react rtcamp-wp-decoupled woocommerce woocommerce-pwa research-development

wp-decoupled's Introduction

WP Decoupled โšก

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 ๐ŸŽฅ

Getting Started ๐Ÿ„

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

Installing ๐Ÿ”ง

  1. Clone this repo in [email protected]:rtCamp/wp-decoupled.git
  2. cd wp-decoupled
  3. nvm use
  4. npm install

Configure Backend( WordPress site ) ๐Ÿ”ง

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 ๐Ÿ”’

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 ๐Ÿ”ง

  • Rename .env.example to .env and update your details
SITE_URL=http://localhost:3000
NEXT_PUBLIC_WOO_SITE_URL=http://yourwocommercesite.com
WOO_CONSUMER_KEY=xxxxx
WOO_SECRET=xxxxx

Commands ๐Ÿ’ป

  • npm run dev Runs the node server in development mode
  • npm run dev:inspect Runs the dev server with Inspector
  • npm run server Runs the NEXT produciton server
  • npm run lint Runs the linter
  • npm run format Runs the formatter
  • npm run build Creates the NEXT build

Using PWA on mobile ๐Ÿ“ฑ

  • Open the site in Chrome on your mobile and then click on add to home screen.
  • It will be downloaded and saved as a Progressive Web App on your mobile.
  • Once added Look WP Decoupled app on your mobile.
  • This PWA will work even when you are offline.

Branches Information ๐ŸŒฑ

  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 ๐Ÿ‘ค

License ๐Ÿ“ƒ

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

wp-decoupled's People

Contributors

abder avatar biloustrike avatar dependabot[bot] avatar divyarajmasani avatar imranhsayed avatar kirtangajjar avatar m-muhsin avatar maitreyie-chavan avatar mohdsayed avatar nicestrudeguy avatar pradeep910 avatar rahul286 avatar vijayaraghavanm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-decoupled's Issues

PWA - Offline Sync Test Case

  1. User opens the website in the browser. Enough to register the service worker.
  2. User closes website tab
  3. The site publishes new content
  4. Content gets sync in the background
  5. User open site when not connected to the Internet
  6. User should be able to read synced content

Add the storefront theme

Add the storefront theme to WP

Use the menu name( location ) registered by storefront theme in the frontend GraphQL query.

Create a WordPress Theme called wp-decoupled-theme

Create a WordPress Theme called wp-decoupled-theme

  • The styles and design of this theme will be similar to the next.js theme
  • We can register menus here.

Note:
We redirect the user to WordPress site after he/she fills up the checkout form then add a back to home button on the WordPress Order complete page. That way we can support all the WP WooCommerce payment gateway options, because it is handled by WordPress.
So when the user is redirect to WordPress because the design of the WP theme and Next.js theme will be the same, it will give a uniform experience to the user.

Cant install is there is some special node/npm version needed?

Hi there!

I am on windows
node v16.14.0
npm 8.19.1

Why run "nvm use"? Is this for special version of node? Which one?

Cloned the repo and when do "npm install" there a bunch of warning about depricated vesriosn and an Error:

npm ERR! code 1
npm ERR! path D:\wp-decoupled\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: E:\Program Files\nodejs\node.exe D:\wp-decoupled\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'E:\Program Files\nodejs\node.exe',
npm ERR! gyp verb cli 'D:\wp-decoupled\node_modules\node-gyp\bin\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb which failed Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (D:\wp-decoupled\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (D:\wp-decoupled\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (D:\wp-decoupled\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at D:\wp-decoupled\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at D:\wp-decoupled\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at D:\wp-decoupled\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb which failed python2 Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (D:\wp-decoupled\node_modules\which\which.js:13:12)
npm ERR! gyp verb which failed at F (D:\wp-decoupled\node_modules\which\which.js:68:19)
npm ERR! gyp verb which failed at E (D:\wp-decoupled\node_modules\which\which.js:80:29)
npm ERR! gyp verb which failed at D:\wp-decoupled\node_modules\which\which.js:89:16
npm ERR! gyp verb which failed at D:\wp-decoupled\node_modules\isexe\index.js:42:5
npm ERR! gyp verb which failed at D:\wp-decoupled\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb which failed code: 'ENOENT'
npm ERR! gyp verb which failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb which succeeded python C:\Program Files (x86)\SVP 4\mpv64\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Program Files (x86)\SVP 4\mpv64\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:399:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "E:\Program Files\nodejs\node.exe" "D:\wp-decoupled\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\wp-decoupled\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

May be its because "Error: not found: python2" i have on wondows only python...

Add Gutenberg Style packages in Next.js

Add Gutenberg Style packages in Next.js

@import "~@wordpress/base-styles/colors";
@import "~@wordpress/base-styles/variables";
@import "~@wordpress/base-styles/mixins";
@import "~@wordpress/base-styles/breakpoints";
@import "~@wordpress/base-styles/animations";
@import "~@wordpress/base-styles/z-index";

@import '~@wordpress/block-library/src/style.scss';
@import '~@wordpress/block-library/src/theme.scss';

Create Single Image Component to be reused

Create a single image component that can be reused everywhere, so any updates can be made at one place and is reflected everywhere. Use Next.js Image Component inside of it

Single product pages don't work

I am getting "An unexpected error has occurred."

Then if I try to refresh I get a "500 Internal Server Error."

Checking the browser console I see:

Error: "GraphQL error: Cannot query field "productBy" on type "RootQuery". Did you mean "product", "products", "productTag", "productType", or "postBy"?"

Live example

Would it be possible to get this up and running somewhere so that you take it for a test drive?

Create design for the wp-decoupled

We need designs for the following pages:

  1. Landing Page
  2. Products page with pagination and filters.
  3. Single Product Page
  4. Blogs page with pagination
  5. Single Blog page with sidebar containing related blogs and category lists.
  6. Checkout page
  7. Cart Page
  8. Login
  9. Register

Update Apollo Client package

  • Update Apollo Client package to the latest version.
  • Make the necessary changes in the apollo client as per the updates

Update NPM packages

It's been long since the repository has been updated, hence it's better that before anything we update all the packages.

Can not run dev server

When I start the dev server, the terminal shows the following error message :

The static directory has been deprecated in favor of the public directory. https://err.sh/vercel/next.js/static-dir-deprecated
(node:95482) ExperimentalWarning: The fs.promises API is experimental
Defining routes from exportPathMap
Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
See here for more info: https://err.sh/next.js/built-in-css-disabled

(node:95482) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined

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.