-
Create Hygraph project from "Cosmetics Shop" (skncre) template.
-
Clone this repo.
-
Install dependencies:
npm install
-
Update
.env
file with values from Hygraph project settings:HYGRAPH_PROJECT_ID
: Hygraph project ID.HYGRAPH_REGION
: Hygraph project region.HYGRAPH_ENVIRONMENT
: Hygraph project environment.HYGRAPH_ENDPOINT
: Hygraph content API endpoint URL.HYGRAPH_ASSET_UPLOAD_API
: Hygraph management API endpoint URL.HYGRAPH_MANAGEMENT_API
: Hygraph management API endpoint URL.HYGRAPH_MANAGEMENT_TOKEN
: Hygraph management token.
-
Open a terminal window and run Next.js dev server. This will start a local dev server on http://localhost:3000. Open it in your browser and validate that the site is working properly and renders the content from Hygraph.
npm run dev
Try updating some content in Hygraph, then reload the page to see the changes.
-
Open a 2nd terminal and create a public tunnel to your machine's 8090 port with ngrok. A public tunnel is needed to allow the local Visual Editor receive webhooks from Hygraph:
ngrok http 8090
Take a note of the public URL address created by ngrok, it should match a pattern similar to https://HASH.ngrok.app. Keep this terminal window opened.
-
Open a 3rd terminal and install
@stackbit/cli
:npm i -g @stackbit/cli
-
Start Netlify Visual Editor by running the following command. Set the
--csi-webhook-url
argument to the ngrok's public URL address with the/_stackbit/onWebhook
path.stackbit dev --csi-webhook-url https://HASH.ngrok.app/_stackbit/onWebhook
This command will print the final webhook URL in the following format:
https://HASH.ngrok.app/_stackbit/onWebhook/hygraph/HYGRAPH_PROJECT_ID
Add this webhook to your Hygraph project. In webhook's configuration, set the method to POST, and check the "Include payload" option. Leave all the other settings empty.
-
Open http://localhost:8090/_stackbit in your browser and start editing your site visually.
-
Notifications
You must be signed in to change notification settings - Fork 0
This is a demo for Netlify Visual Editor integration with Hygraph. This project is based on https://github.com/hygraph/skncre-starter-next starter
stackbit-themes/hygraph-netlify-editor-demo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
This is a demo for Netlify Visual Editor integration with Hygraph. This project is based on https://github.com/hygraph/skncre-starter-next starter
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published