WP GraphQL Documentation Site

The beginning of the Documentation site for WP GraphQL is now up.  I am very excited to have this running.  To contribute to the documentation please head over to the WP GraphQL documentation repo, it is synced to the GitBook.  Feel free to open any issues if you have questions about the documentation or about WP GraphQL

GitBook

Currently, WP GraphQL will be using GitBook for the documentation site. I think GitBook is a sensible choice for right now.  Eventually, the goal is to have the documentation site running on WordPress (maybe even powered by WP GraphQL!). For now GitBook is quick and easy to set up, but lacks some extensibility power.

If you are interested in learning about GitBook, check it out!

Documentation Goals

The next step for vastly improving the documentation will be to have a cookbook for common WordPress related GraphQL queries. The cookbook queries and tutorials will go straight into the Gitbook for easy access.

Another priority for this project is to create a reference WordPress site running WP GraphQL with some demo data for people to mess around with.  This will involve purchasing a decent domain name, setting up WordPress with dummy data, and possibly running an Express server alongside it for GraphiQL support. The reference site will use the GraphQL introspection system to enable automatic viewing of WP GraphQL’s type system.

Contributing

I am really excited about this project and hope you will be too.  Let me know what you think of the documentation site so far, and what could be better!

WordPress GraphQL

Hi everyone! Love WordPress? Interested in GraphQL?

There are many projects starting to creep up to push GraphQL support forward for WordPress.  I will be throwing my hat into the ring as well, because I feel it will greatly expand interest in WordPress and provide some awesome functionality to it.  Today I started up a plugin that will provide a GraphQL API for WordPress.  Head over to GitHub to check out WP GraphQL!  I am incredibly excited about this project and hope you will be too. Hopefully, we can build something amazing together!  If you are interested in contributing, go to the GitHub repository linked above and comment on this issue and introduce yourself; feel free to post any questions you might have as well.  I will get back to you as soon as I can.

What is GraphQL and why does it matter?

GraphQL is a new specification, created by Facebook, that can be used to create an easy way to reason about your application. One of its biggest strengths lies in the ability to specify exactly what you want client side and have it be taken care of in one request! This makes matching data to what you need in your UI much, much easier. Lets look at a made up example.  Imagine we are going to make a single post view for a WordPress site. A GraphQL query might look like this:

{
  post(id: 7) {
    title,
    content,
    author {
      name
      gravatar
    },
    comments {
      content
      author {
        name
        avatar
      }
    }
  }
}

You would send this as a string to the GraphQL API endpoint, and in return you would get JSON data giving you the post title, content, author name and gravatar for post number 7. You would also get back a list of comments for the post each with their matching content and author’s name and avatar. It is probably more clear why potential GraphQL queries are so powerful. You can declare what you want client side and bring the JSON data you need into whatever language you want to use. When work on WP GraphQL is further along, I plan to use it for a lot of JavaScript based projects!

More to come in the future!

I am just overwhelmed with excitement about this project and hope that you will feel the same.  Don’t be intimidated by something new. I strongly encourage you to try and contribute to this project. I will personally try to help as much as I can.  We will both be learning GraphQL alongside each other as we go; which should be awesome!

Let me know if you are excited about bringing GraphQL to WordPress as I am!  If you are having trouble installing the plugin open an issue on the WP GraphQL github repository.