A NextJS starter for WordPress installations with WPGraphQL, including TypeScript and dynamic type generating with graphql-codegen
- Works out of the box with any WordPress installation including WPGraphQL
- TypeScript and dynamic type generating with graphql-codegen
- Prettier, ESLint, Husky and Lint Staged
- Clone this repository to your machine
- Run
yarn install
- Rename
.env.local.example
toenv.local
file - Add your
WORDPRESS_API_URL
url to your.env.local
file - Run
yarn generate:codegen
to generate types* - Run
yarn dev
to start a local server and start developing
- *Running graphql-codegen on the WPGraphQL schema generates two invalid enum types,
2048X2048
and1536X1536
. These are invalid because they start numeric. There is currently an issue opened about this right here: dotansimha/graphql-code-generator#4834.
By running yarn generate:codegen
you can generate types right from your WPGraphQL schema and the operations defined in .src/graphql/**/*
. You can see and update the confing in the codegen.yml
file in the root of your project. The endpoint is loaded from the .env.local
file.