Skip to content

ragudesign/kb-nextjs

Repository files navigation


Logo

WordPress WPGraphQL NextJS App

This Next.js app connects to a WordPress WPGraphQL endpoint

Deploy with Vercel

Report Bug · Request Feature · WordPress Plugin



👋 About The Project

I started this project to learn more about Next.js and how i can use WordPress headless by exposing the data via WPGraphQL plugin. I created a small app which gets the posts from a custom post type and a search that uses a local json file so it's super quick which is generated on build.

image

🚀 Getting Started

Prerequisites

Setup a WordPress installation and add the following plugins:

  • Install Knowledge Base WP Plugin

    https://github.com/ragudesign/kb-wp
  • Install WPGraphQL Plugin

    https://www.wpgraphql.com/

Installation

  1. Clone the repo
yarn create next-app -e https://github.com/ragudesign/kb-nextjs
# or
npx create-next-app -e https://github.com/ragudesign/kb-nextjs
  1. Add a .env file to the root with the following:
WORDPRESS_GRAPHQL_ENDPOINT=http://wordpressite.com/graphql

Development

To start the project locally, run:

yarn dev
# or
npm run dev

🐸 License

Distributed under the MIT License. See LICENSE for more information.