This is a NextJS project that uses hygraph to create all the pages for this website.
This project uses PNPM to handle dependencies. run
pnpm install
to get all dependencies installed.
Create a .env
in the project's root folder with the following keys:
SITE_URL=???
HYGRAPH_BASE_URL=???
HYGRAPH_TOKEN=???
make sure you replace the ???
values with the real values for this project.
This project uses Codegen to automatically handle types in your graphQL queries. When running
pnpm dev
the NextJS server and the Codegen watcher will start executing. The local version will be available in http://localhost:3000
and whenever you make a change in your graphQL queries Codegen will update the types.
When making changes in the Hygraph Schema you'll need to rerun the Codegen command to get the updated types from Hygraph. To do so just run:
pnpm codegen
and your types will be automatically updated.
This project uses React Testing Library with Jest for testing. To run the tests execute the command:
pnpm test
If you want to update the Snapshot tests run:
pnpm test -- -u
This project statically generates the pages for the URLs defined in Hygraph. There's a webhook configured in Hygraph that automatically regenerates the pages when a page is edited by calling the api/webhook/revalidate
with a POST
method.