All Projects β†’ imranhsayed β†’ Nextjs Headless Wordpress

imranhsayed / Nextjs Headless Wordpress

Licence: gpl-3.0
πŸ”₯ Nextjs Headless WordPress

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Nextjs Headless Wordpress

Headless Wp Starter
πŸ”ͺ WordPress + React Starter Kit: Spin up a WordPress-powered React app in one step
Stars: ✭ 4,144 (+3667.27%)
Mutual labels:  wordpress, headless-cms, nextjs
Nextjs Wordpress Starter
WebDevStudios Next.js WordPress Starter
Stars: ✭ 104 (-5.45%)
Mutual labels:  apollo-client, wordpress, nextjs
Pizzaql
πŸ• Modern OSS Order Management System for Pizza Restaurants
Stars: ✭ 631 (+473.64%)
Mutual labels:  graphql, nextjs, authentication
Gatsby Woocommerce Themes
⚑ A Gatsby Theme for WooCommerce E-commerce site Gatsby WooCommerce WordPress
Stars: ✭ 306 (+178.18%)
Mutual labels:  graphql, hacktoberfest, wordpress
Wordpress Api Nextjs Theme
A workshop on creating a WordPress theme with React and Next.js for WordCamp Montreal
Stars: ✭ 36 (-67.27%)
Mutual labels:  wordpress, nextjs, seo
Woo Next
πŸš€ React WooCommerce theme, built with Next JS, Webpack, Babel, Node, Express, using GraphQL and Apollo Client
Stars: ✭ 342 (+210.91%)
Mutual labels:  graphql, wordpress, nextjs
Strapi
πŸš€ Open source Node.js Headless CMS to easily build customisable APIs
Stars: ✭ 41,786 (+37887.27%)
Mutual labels:  graphql, hacktoberfest, headless-cms
Wp Decoupled
Next.js app with WPGraphQL and WordPress at the backend.
Stars: ✭ 197 (+79.09%)
Mutual labels:  graphql, wordpress, nextjs
Hasura Backend Plus
πŸ”‘Auth and πŸ“¦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.
Stars: ✭ 776 (+605.45%)
Mutual labels:  graphql, authentication, jwt
Naperg
Fullstack Boilerplate GraphQL. Made with React & Prisma + authentication & roles
Stars: ✭ 661 (+500.91%)
Mutual labels:  apollo-client, authentication, jwt
Graphql Wp
GraphQL endpoint for WordPress
Stars: ✭ 303 (+175.45%)
Mutual labels:  graphql, wordpress, headless-cms
Graphql Apollo Next.js
A server-rendering GraphQL client with Apollo Client and Next.js
Stars: ✭ 59 (-46.36%)
Mutual labels:  graphql, apollo-client, nextjs
Wp Graphql
πŸš€ GraphQL API for WordPress
Stars: ✭ 3,097 (+2715.45%)
Mutual labels:  graphql, hacktoberfest, wordpress
Wp Graphql Acf
WPGraphQL for Advanced Custom Fields
Stars: ✭ 358 (+225.45%)
Mutual labels:  graphql, hacktoberfest, wordpress
Express Graphql Boilerplate
Express GraphQL API with JWT Authentication and support for sqlite, mysql, and postgresql
Stars: ✭ 201 (+82.73%)
Mutual labels:  graphql, authentication, jwt
Next Auth
Authentication for Next.js
Stars: ✭ 8,362 (+7501.82%)
Mutual labels:  nextjs, authentication, jwt
Next Apollo Auth
Authentication Boilerplate with Next.js and Apollo GraphQL
Stars: ✭ 159 (+44.55%)
Mutual labels:  graphql, nextjs, authentication
Pop
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder
Stars: ✭ 160 (+45.45%)
Mutual labels:  graphql, wordpress, headless-cms
Django Graphql Jwt
JSON Web Token (JWT) authentication for Graphene Django
Stars: ✭ 649 (+490%)
Mutual labels:  graphql, authentication, jwt
Crypto Grommet
Crypto and equities app
Stars: ✭ 39 (-64.55%)
Mutual labels:  graphql, apollo-client, nextjs

🎨 Next.js Headless WordPress

Project Status: Active. Stars Forks Contributors Follow

  • Headless WordPress, using Decoupled Architecture in Next.js
  • Backend in WordPress using WPGraphQL
  • Front end in React.

Features

  1. Home Page, Blog Page, Post Page
  2. Post Preview
  3. Post Pagination.
  4. Load More Posts.
  5. SEO Component fetching data Yoast SEO with schema
  6. Cypress for tests, Eslint for linting.
  7. Apollo Client with GraphQL
  8. Api endpoints.
  9. Header and Footer in Next.js fetching from WordPress Menu items.
  10. WordPress Widgets displayed on Next.js frontend.
  11. Site title, tagline, copyright text, sourced from WordPress.
  12. Next.js Image component, that has image optimization at request time.
  13. Authentication with JWT and Http Only Cookie implementation.
  14. Login feature for WP Post Preview in Next.js
  15. Incremental Static (Re)generation and automatic creation of New Static post pages without having to re-build next.js the application.
  16. Gutenberg styles support

Tutorial Course

Code for the tutorial is in the Tutorial Branch

Live Demo Link

https://nextjs-headless-wordpress-demo.vercel.app/

Setup

First clone/fork the repo and cd into it.

git clone https://github.com/imranhsayed/nextjs-headless-wordpress.git
cd nextjs-headless-wordpress

It's very simple to setup the project with just one command and this ./nxtwp configure

One command project setup

The below command is going to set up the project in the interactive mode. It creates an .env file for front-end next.js project and setsup up frontend and/or backend. Run this from the root of the project.

./nxtwp configure

It's going to ask you a few of questions.

Q1. Do you already have a WordPress setup that you want to continue with? [y/n]:

Answer

y: If you would like to use this project's WordPress Docker setup ( In which case make sure to install and active all plugins from [backend/plugins-collection]) n: If you want to use your own WordPress setup.

Q2. ✍️  What is your WP backend URL? (defaults to http://localhost:8020): 

Leave it blank if you would like to use this project's WordPress Docker setup, else enter your own WordPress site URL.

✍️  What is your frontend next js URL? (defaults to http://localhost:3000):

Leave this blank for development, as it will be the same as default for next.js

✍️  What is your Disqus comments shortname? (leave blank if you are not using): 

Leave this blank if you are not going to use the Disqus comments, else enter your Disqus comments shortname.

This is going to automatically:

  • Creates the .env file in the frontend directory.
  • Setup WordPress backend with all the plugins via composer (if you chose y for the first question)
  • Install npm packages for next.js frontend and start development server.

WordPress Backend will be available on http://localhost:8020 Next.js Backend will be available on port http://localhost:3000

  • Make sure to activate all plugins that it has installed via composer.
  • Update block registry by going to WordPress Dashboard > GraphQL Gutenberg.
  • Update the permalink by going to Settings > Permalinks > Post name > Save
  • Copy the backend/wordpress/.htaccess file content into your WordPress .htaccess
  • For more information checkout the project Wiki

That's it!

During development

Useful commands: To be run from the root of the project.

./nxtwp configure       # Sets up backend and frontend and creates an .env file
./nxtwp start-all       # Creates and starts docker environment for WP and runs Next JS server
./nxtwp start-backend   # Creates and starts docker environment
./nxtwp start-frontend  # Installs all packages and Runs Next JS server
./nxtwp stop            # Stops the WordPress docker containers

Debugging

  1. If you get 404 on frontend for graphql request, check to see that the .htaccess file in wordpress directory has the rules
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
  1. If front-end is throwing some other error.
  • Check if all the required WordPress plugins form backend/plugins-collection are active.
  • Ensure you have updated the block registry from WordPress backend > GraphQL Gutenberg
  • Ensure that .env file has correct env variables and their values in frontend/.env

References for Docker Images.

  1. phpMyAdmin
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].