WPGraphQL.com is a Next.js site that uses WordPress as the CMS.
This repository contains the Next.js code to source data from WordPress and create pages using WordPress data.
-
Install dependencies from the monorepo root:
npm install
-
Create
websites/wpgraphql.com/.env.localand fill in the environment variables listed under Environment Variables. -
Run the development server:
npm run dev -w @wpgraphql/wpgraphql-com
To build the website:
npm run build -w @wpgraphql/wpgraphql-comTo test that the build works when possibleTypes.json is missing (simulating Vercel deployment):
npm run test:build-without-possibletypes -w @wpgraphql/wpgraphql-comThis script will:
- Backup the existing
possibleTypes.jsonfile (if it exists) - Delete the file to simulate the Vercel scenario
- Run the build without the prebuild hook
- Restore the file after testing
If the build succeeds, the fix is working correctly.
Set these in websites/wpgraphql.com/.env.local for local development, and in
the hosting environment for deployed builds.
Required:
NEXT_PUBLIC_SITE_URL- The public URL of this site. Used for the feeds and their<link rel="alternate">tags, the WordPress sitemap route, and theX-RadiQL-Origin-Hostheader the GraphQL client sends so server-side requests are attributed to this app.WPGRAPHQL_URL- The GraphQL endpoint to source content from, including the/graphqlpath.NEXT_PUBLIC_WPGRAPHQL_URLtakes precedence if both are set.NEXT_PUBLIC_WORDPRESS_URL- The WordPress backend's site URL (for examplehttps://contentwpgraphql.wpcomstaging.com), not the/graphqlendpoint and not a caching proxy sitting in front of it.next.config.jsreads it for one purpose: allowlisting that hostname fornext/image. Note that a backend behind Jetpack's Site Accelerator serves media fromi0.wp.comrather than its own hostname, whichnext.config.jsallowlists separately.WPGRAPHQL_REVALIDATE_SECRET- Shared secret for the on-demand ISR endpoint at/api/revalidate. The endpoint rejects every request when this is unset.
Optional:
GITHUB_TOKEN- Raises the GitHub API rate limit when docs are fetched from the monorepo at build time.NEXT_PUBLIC_GA_ID- Google Analytics measurement ID. Note that_app.jsloads the analytics scripts unconditionally, so leaving this unset does not disable them, it reports against anundefinedID.WPGRAPHQL_CLIENT_DEBUG- Set to1to force GraphQL client debug logging on, or0to force it off. Defaults to on outside production.
The extension landing pages (/extensions/*) and the site's theming use the
WPGraphQL product-family "sibling brand" system — a shared navy foundation with a
per-product accent (violet for IDE, emerald for ACF, rose for Smart Cache),
applied via scoped .theme-* classes in src/styles/globals.css. Logo
components live in src/components/<Product>/ and the shared section building
blocks in src/components/extensions/.
The source-of-truth brand guides, tokens, and the WordPress.org asset generators
live in the monorepo's design/brand/ directory.
If you're adding or restyling a sibling-brand page or asset, start there.