I had the pleasure of joining Doc Pop Roberts on the Torque Magazine News Drop. We spent 18 minutes discussing headless WordPress and WPGraphQL.
Give it a watch!!
Month: February 2021
-
WPGraphQL featured on Torque News Drop
-
Setting up a new developer environment to contribute to WPGraphQL..
I just announced that I am now employed by WP Engine to work on WPGraphQL.
With new employment comes a new Macbook, which I need to setup as a dev machine to continue working on WPGraphQL.
It’s always a tedious process to get a new computer setup to be an effective developer, so I thought I’d record all the steps I take, as I take them, and hopefully provide some help to others.
Local WordPress Environment
One of the first things I need to do to work on WPGraphQL, is have a local WordPress environment.
For the past 3 years or so, my preferred ways to setup WordPress locally is to use Local, a desktop application that makes it easy to setup WordPress sites with a few button clicks.
I enjoy Local so much, I even picked it as my “Sick Pick” on the Syntax.fm episode about WordPress and GraphQL!
Symlink Plugins
When working locally, I usually have a number of different WordPress sites with different environments. For example, I have a site that I use locally to test WPGraphQL with WPGraphQL for Advanced Custom Fields, and another environment where I test things with WPGraphQL and WPGraphQL for WooCommerce. Having different sites allows me to separate concerns and test different situations in isolation.
However, the constant is WPGraphQL. I want to be able to use the same version of WPGraphQL, that I’m actively making changes to, in both environments.
This is where symlinking comes in.
In the command line, I navigate to my local site’s plugins directory. For me, it’s at
/Users/jason.bahl/Local Sites/wpgraphql/app/public/wp-content/plugins
Then, with the following command, I symlink WPGraphQL to the Local WordPress site:
ln -s /Users/jason.bahl/Sites/libs/wp-graphql
This allows me to keep WPGraphQL cloned in one directory on my machine, but use it as an active plugin on many Local WordPress sites. As I create more sites using Local, I follow this same step, and repeat for additional plugins, such as WPGatsby or WPGraphQL for Advanced Custom Fields.
XDebug for PHPStorm Extension
PHPStorm is my IDE of choice, and Local provides an extension that makes it easy to get PHPStorm configured to work with XDebug. I recommend this extension if you use Local and PHPStorm.
TablePlus Extension
I used to use SequelPro, but have been transitioning to use TablePlus, and Local has a community extension that opens Local databases in TablePlus.
PHPStorm
For as long as I’ve been working on WPGraphQL, PHPStorm has been my IDE of choice. I won’t get into the weeds, and you are free to use other IDEs / Code Editors, but I find that PHPStorm makes my day to day work easier.
Pro tip: To save time configuring the IDE, export the settings from from PHPStorm on your old machine and import them on your new machine.
SourceTree
SourceTree is a free GUI tool for working with code versioned with Git. While Git is often used in the command line, sometimes I like to click buttons instead of write commands to accomplish tasks. I also find it super helpful to visualize Git trees to see the status of various branches, etc. I find the code diffs easier to read in SourceTree than in the command line too, although I like Github’s UI for code diffs the best.
In any case, I use SourceTree daily. I think it’s fantastic, and you can’t beat the price!
Note: If you try using SourceTree before using Git in the command line, it might fail. This is because you need to add github.com (or whatever git host you use) to your ssh known hosts. You can read more about this here.
MySQL
Local sets up MySQL for each site, but for running Codeception tests for WPGraphQL, I like to have a general MySQL install unassociated with any specific Local site that I can configure for Codeception to use.
I download and install MySQL v5.7.26 for macOS here.
I then ensured that I updated my
.zshrc
file to include this export, as described here, to ensure the mysqld command will work.TablePlus
I used to use SequelPro, but it’s been deprecated, so I’ve begun using TablePlus. You can download it here.
Docker Desktop
WPGraphQL ships with a Docker environment that developers can spin up locally, and the tests also have a Docker environment so they can be run in isolation.
In order to spin up the local Docker environment or run tests with Docker, Docker Desktop needs to be installed and logged into.
Homebrew
Homebrew is a package manager for MacOS (or Linux). It makes it easy to install packages that are useful for development on a Mac.
I used Homebrew to install the below packages.
Command Line Tools for XCode
This is something I seem to forget almost any time I setup a new Mac. When trying to install things from the command line, I’m always prompted to install Command Line Tools for Xcode and agree to their licensing. For me, as I was installing Homebrew, I was prompted to Download and Install this. If you want to install it separately, follow these instructions.
Git
Since WPGraphQL is maintained on Github, Git is essential to my daily work.
With Homebrew installed, I use it to install Git, which is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Having git installed locally allows me to clone repositories from Github to my local machine, make commits to code, and push code back up to Github.
In order to use Git with 2-Factor Authentication enabled, I also had to get SSH keys setup for Github.
Composer
Composer is a PHP package manager. WPGraphQL uses Composer for test dependencies, so it’s important to have Composer installed in order to run tests. I used the command
brew install composer
to install Composer.Note: I also had to make sure I was running a version of PHP that the zip module, so I followed these steps to get that working.
Node & NVM
Since I do a lot of work with JavaScript applications, such as Gatsby and the WP Engine Headless Framework, having Node installed locally is a must, and having nvm (Node Version Manager) to allow switching Node versions quickly is very helpful.
I followed this guide to get Node and NVM installed using Homebrew.
Time to contribute!
Now that I have my local environment setup and all my regular tools, I’m ready to contribute to WPGraphQL again!
-
What’s next for WPGraphQL?
On February 1, I announced that I was no longer employed at Gatsby, and stated a blog post would be coming soon.
This is that blog post.
TL;DR
I’m joining WP Engine as a Principal Software Engineer where I will continue maintaining WPGraphQL and will contribute to other projects and initiatives centered around the goal of making WordPress the best headless CMS.
Below I will expand a bit more on “Why WP Engine?”, but first, I’d like to take a moment to reflect on my time at Gatsby and acknowledge how important Gatsby is to the future of headless WordPress.
WPGraphQL and Gatsby
I am incredibly thankful for the opportunity I had to work at Gatsby to push forward WPGraphQL. Gatsby’s investment in WPGraphQL led to a lot of growth and maturation of the project
Project Growth and Maturation
I joined Gatsby in June 2019, and since then, WPGraphQL went from:
- v0.3.5 to v1.1.3 (53 releases in that time)
- ~15,000 installs reported on Packagist.org to +85,000 reported installs
- Not available on WordPress.org to available and +8,000 active installs reported
Community Growth
In addition to the growth and maturation of the core WPGraphQL plugin, the community around it has also grown.
While I believe WPGraphQL would have seen growth in the community regardless, I believe we can attribute at least some of this growth to Gatsby’s investment in WPGraphQL. Gatsby’s investment in WPGraphQL signaled that it wasn’t just a hobby project, but was solving real problems for real users, and users should have confidence using it in their projects.
When I joined Gatsby to work on WPGraphQL and collaborate with Tyler Barnes on WPGatsby and Gatsby’s new WordPress Source Plugin, the JavaScript ecosystem paid much more attention to using WordPress as a headless CMS, and the WordPress community got more comfortable using WordPress in ways they hadn’t before.
Many agencies, developers and site owners now consider WPGraphQL an essential part of their stack.
WordPress plugin developers have now created more than 30 WPGraphQL extensions, and there are now more than 1,500 people in the WPGraphQL Slack!
Agencies such as Zeek Interactive, WebDev Studios, 10up and Postlight use and recommend WPGraphQL for headless WordPress projects.
Websites such as gatsbyjs.com, qz.com, denverpost.com, diem.com, apollographql.com, bluehost.com, rudis.com and many more are using WPGraphQL in production.
So, why leave Gatsby?
Gatsby has been incredibly generous in funding open source developers to work on projects related to, but not part of Gatsby. For example, John Otander was working on MDX, Rikki Schulte was working on GraphiQL, and I was working on WPGraphQL.
I was the last remaining of these engineers working primarily on other projects that tangentially, but not directly benefit Gatsby.WordPress is only one part of Gatsby’s story. Gatsby can work well with just about any data source. Some popular non-WordPress choices are Contentful, Sanity, DatoCMS, Shopify, among many others.
The team I was part of was asking me to start transitioning to work more on other Gatsby integrations, such as Contentful and Shopify, and work less on WordPress and WPGraphQL. This doesn’t mean Gatsby was abandoning WordPress or WPGraphQL, just that I would need to spend less time on it and prioritize other things. There’s nothing wrong with this. There’s a lot of sound decision making to this when it comes to making Gatsby a sustainable business.
I feel right now is a unique time in history where more investment in WordPress as a headless CMS can change the future of WordPress. I believe WordPress is now more respected as a viable option for a headless CMS and that with the momentum of WPGraphQL, technologies like Gatsby, NextJS, and others, I need to spend more time focusing on WPGraphQL and headless WordPress, and not less time.
Fortunately for me, WP Engine is investing in the future of headless WordPress, and they see WPGraphQL as an important part of that future.
As ironic as it may sound, I believe that my departure from Gatsby will actually strengthen the WordPress + Gatsby integration.
Instead of partially focusing on the Gatsby side of the integration and partially focusing on the WordPress API side of the integration, this move will allow Gatsby to hire a backfill for my position to work specifically on the Gatsby side of integrations, and not have to worry about the WordPress server API side of things. This allows the team to narrow their focus and deliver higher quality code on the Gatsby side of the Gatsby + WP integration.
I intend to continue working with Tyler Barnes and the Gatsby Integrations and Collaborations team to ensure that users of Gatsby + WPGraphQL feel supported and productive. Gatsby + WPGraphQL will continue to play a big role in the future of Headless WordPress, and I’m here for it.
Why WP Engine?
Serendipity, at least to some degree.
Within a few weeks of having conversations about needing to start focusing less on WPGraphQL at Gatsby, I discovered that WP Engine was building a headless WordPress framework and was hiring engineers to focus on headless WordPress. The job description felt like it was describing me, almost perfectly. Serendipity.
A few years ago, prior to my time at Gatsby I was interested in a position at WP Engine. But at the time there was a hard requirement for employees to be in Austin, TX. I have so many friends and family members in Denver that I have no plans to move if I don’t absolutely have to. WP Engine no longer requires employees to be in Austin, so I could now work for WP Engine without needing to move. Serendipity.
Along with the serendipitous aligning of stars, WP Engine is a generally attractive employer.
WP Engine is a leader in the WordPress space. I’ve trusted WP Engine to host many sites I’ve worked on over the last decade, including WPGraphQL.com and jasonbahl.com.
While WP Engine’s primary business is managed WordPress hosting, it also invests in a lot of products and projects that make it easier for businesses to run their sites on WordPress.
Projects such as LocalWP (that I gave a shout out to on Syntax.fm in Jul 2019) and Genesis Blocks are thriving under WP Engine, and I believe that WPGraphQL can continue to mature and thrive with WP Engine’s support.WP Engine’s investment in headless WordPress isn’t limited to me joining to continue working on WPGraphQL and other headless WordPress projects. There will be more hires and projects aimed at reducing the friction of using WordPress as a headless CMS, and allowing businesses to get started and move faster within that context.
I believe that WP Engine’s investment in this space will allow WPGraphQL to grow and mature faster than ever before, as I will be part of a larger team working to make WordPress the best it can be.
So, does WP Engine own WPGraphQL?
Before my time at Gatsby, during my time at Gatsby and now as I transition to working at WP Engine, WPGraphQL has and will continue to be operated and maintained as a free, open-source community plugin benefitting anyone using WordPress.
WP Engine pays my salary, and in exchange I will be maintaining WPGraphQL and helping grow the headless WordPress ecosystem, reducing friction in many different ways.
What’s next for WPGraphQL?
I can’t officially commit to any of these things quite yet, but some things I have on my radar to tackle in the near future include, but are not limited to:
- Significant updates to WPGraphQL for Advanced Custom Fields
- Updates to the GraphiQL IDE that ships with WPGraphQL (testing as public and authenticated user, for example)
- Introduce new Custom Scalars (datetime, HTML, among others)
- Add Support for Image Uploads
- Update Schema surrounding Media
- Introduce a MediaItem interface and different GraphQL Types for Image, Video, etc
- New tooling to help developers move faster
- Query / error logging
- Breaking change notifications
- Persisted Queries
- Query Complexity configuration and analysis
- WPGraphQL Subscriptions (real time updates when data changes)
- Component library(s) using WPGraphQL Fragments
- More tutorials, videos, blog posts about using WPGraphQL in various contexts
I’m excited to get started at WP Engine and work on the next chapter of WPGraphQL and headless WordPress! I hope to have a more formal roadmap to discuss with the community in the near future, once I get settled as a WP Engine employee.
I’m so thankful to the community that has embraced WPGraphQL. I feel so much love and appreciation from thousands of developers that are using, contributing to, and providing feedback for WPGraphQL.
I’ve made many genuine friends from the WPGraphQL community and I am so thankful that this next chapter of my career allows me to continue working in this community.