- Github App
- Github Personal Access Token
- Clone this repository
- Run
pnpm install - Copy
app/.env.exampletoapp/.env, we will get the values in the following steps.
Create a new Github App in your organization. This will allow users to authorize access to post comments on their behalve.
- Go to
Developer settings->Github appsin your personal account or organization and create a new Github App. - Enter a name, eg
My Comments - Enter a Homepage URL, eg
https://my-comments.com - Enter a callback URL, eg for development
http://localhost:9991/auth/cookie/callback/github - Uncheck
Expire user authorization tokens, refresh tokens are not supported yet - Create the app.
After creating the app, copy the App ID and Client ID and paste it into the .env file.
Create a new secret and paste the Client Secret into the .env file.
Head to your Github settings and create a new (classic) personal access token and select the following permissions:
repo
This token is needed to access the Github GraphQL API. Copy the token and paste it into the .env file.
Run pnpm dev:app to start the WunderGraph app and Vite build process. Open http://localhost:9991 in your browser and you should see the WunderGraph app running.
Once you have the app running, you can start the website to test the comment functionality by running pnpm dev:web. Open http://localhost:3000 in your browser and you should see the website running.
- Github App
- Github Personal Access Token
- CDN to host widget.js
- WunderGraph Cloud account
If you haven't cloned the repository yet, you can clone and create a new WunderGraph project here:
Otherwise head to https://cloud.wundergraph.com/wundergraph/new to create a new project and select the repository you have cloned.
After creating the project, head to the Settings to configure your environment variables. Use the values from the steps above or create a new Github App and Personal Access Token for production.
GITHUB_APP_ID: The Github App IDGITHUB_CLIENT_ID: The Github App Client IDGITHUB_CLIENT_SECRET: The Github App Client SecretGITHUB_TOKEN: The Github Personal Access TokenJWT_SECRET: A random string to sign the JWT tokens
After updating the environment variables, head to the Deployments tab and create a new deployment by clicking Redeploy. After the deployment has finished, your app should be available at https://<deployment-name>.wundergraph.dev.
Make sure you update the Callback url to point to your production environment, eg open-previews.wundergraph.dev.
The widget is a javascript file that can be hosted on any CDN. The build requires the following environment variables:
WG_NODE_URL: The WunderGraph Node URL, eghttps://open-previews.wundergraph.devGITHUB_APP_ID: The Github App IDGITHUB_CLIENT_ID: The Github App Client IDGITHUB_CLIENT_SECRET: The Github App Client SecretGITHUB_TOKEN: The Github Personal Access TokenJWT_SECRET: A random string to sign the JWT tokens
- Run
pnpm buildto build the widget - Copy
widget/dist/widget.jsto your CDN