The Hasura beta integration on Vercel allows for creating a new Hasura project and porting the environment variables over to an existing Vercel project. Utilizing the Github integration for both of these platforms, it's possible to achieve an elegant DX where one can migrate local development to cloud entirely through Github.
This project makes a couple of opinionated choices for integrating GraphQL with a Vercel project, but attempts to keep the overall surfafce are of additional code quite lean.
- URQL is chosen for the front-end client, which additionally means:
a. The URQL Provider pattern is implemented in
_app.jsx
b. A special client utility is utilized in thelib
directory for handling SSR/Client contexts. - GraphQL Codgen is used to scaffold types and uses the URQL plugin for getting React Hooks.
- Fork this Repo
- Create Vercel project from repo.
- Tell Vercel where the nextjs code exists (www)
- Use this integration to add a Hasura project
- On the Hasura side:
a. Create a free Heroku DB.
b. Create an
anonymous
role in the Hasura env vars. c. Apply CI/CD from hasura metadata. - Inspect vercel deploy.
- Clone this repository locally
- Start Docker Compose
docker-compose up -d
from the root directory. - Navigate one instance of terminal to the
hasura directory
and start the metadata tracking Hasura console instance. a.hasura console --admin-scret "myadminsecretkey"
b. Navigate to http:localhost:9695 (should occur automatically) - Navigate one instance of terminal to the
www
folder a. Runyarn dev
- Make changes to Hasura in the console or changes to the front-end and push them to Github.