This example shows how to build a simple GitHub Webhook receiver using Node.js with Express and run it on Unikraft Cloud. A webhook, also called a reverse API, is a way for a server to send real-time data to other applications when a specific event occurs. In this case, the webhook receiver listens for GitHub events, such as push events or pull request events, and logs them to the console. To run this it, follow these steps:
-
Install the
kraftCLI tool and a container runtime engine, for example Docker. -
Clone the
examplesrepository andcdinto theexamples/webhook-github-node/directory:
git clone https://github.com/unikraft-cloud/examples
cd examples/webhook-github-node/Make sure to log into Unikraft Cloud by setting your token and a metro close to you.
This guide uses fra (Frankfurt, π©πͺ):
export UKC_TOKEN=token
# Set metro to Frankfurt, DE
export UKC_METRO=fraWhen done, invoke the following command to deploy this app on Unikraft Cloud:
kraft cloud deploy -p 443:3000 -M 1Gi -e GITHUB_WEBHOOK_SECRET=your_secret_here .GITHUB_WEBHOOK_SECRET is the secret used to validate incoming webhook requests from GitHub. Set it to a string with high entropy.
The output shows the instance address and other details:
[β] Deployed successfully!
β
ββββββββ name: webhook-github-node-bzq7u
ββββββββ uuid: 8a8634f1-fc78-4cc0
58A6
-aa36-8f082d8a59f5
βββββββ metro: https://api.fra.unikraft.cloud/v1
βββββββ state: starting
ββββββ domain: https://dry-cloud-uuw0qlb6.fra.unikraft.app
βββββββ image: acioc/webhook-github-node@sha256:10974aac67ce6355148e21d91f918960bf0af29ad840fffeeb2fd01f8c905f66
ββββββ memory: 1024 MiB
βββββ service: dry-cloud-uuw0qlb6
ββ private ip: 10.0.1.205
ββββββββ args: node /app/server.js
In this case, the instance name is webhook-github-node-bzq7u and the address is https://dry-cloud-uuw0qlb6.fra.unikraft.app.
They're different for each run.
Use curl to query the Unikraft Cloud instance of the Node.js webhook server's health endpoint:
curl https://dry-cloud-uuw0qlb6.fra.unikraft.app/health{"status":"healthy","timestamp":"2025-12-17T14:55:20.953Z","uptime":0.063799807}
The uptime field is so small because the instance is scaled to zero when no connections are active.
When a request comes in, Unikraft Cloud automatically starts the instance.
To see the incoming webhook events (you set up the webhook in GitHub), you can retrieve the logs of the instance by running:
kraft cloud instance logs webhook-github-node-bzq7u --follow[2025-12-17T15:20:54.524Z] Webhook received: ping
{
"timestamp": "2025-12-17T15:20:54.524Z",
"event": "ping",
"data": {
"zen": "Accessible for all.",
...
},
"receivedAt": 1765984854525
}
...The ping event is sent by GitHub when you set up the webhook.
You can list information about the instance by running:
kraft cloud instance listNAME FQDN STATE STATUS IMAGE MEMORY VCPUS ARGS BOOT TIME
webhook-github-node-bzq7u dry-cloud-uuw0qlb6.fra.unikraft.app standby standby webhook-github-node@sha256:10974aac67ce6355148e... 1.0 GiB 1 node /app/server.js 197.47 ms
When done, you can remove the instance:
kraft cloud instance remove webhook-github-node-bzq7uTo test the GitHub webhook receiver, you must set up a webhook in a GitHub repository.
Make sure to set the payload URL to the Unikraft Cloud instance webhook, in this case https://dry-cloud-uuw0qlb6.fra.unikraft.app/webhook/github.
You should also set the content type to application/json and select the events you want to receive.
Lastly, you should set the secret to validate that the requests come from GitHub and were not tampered with.
Now, once you make changes in the repository (that you are listening to), you should see the webhook events logged in the instance logs:
kraft cloud instance logs webhook-github-node-bzq7u --follow[2025-12-17T17:28:51.136Z] Webhook received: push
{
"timestamp": "2025-12-17T17:28:51.136Z",
"event": "push",
"data": {
"ref": "refs/heads/main",
"before": "3312f99896b85e896f730d246180979553748f9d",
"after": "12b2962bbc70f92fa33e4b30c0e1a3ed5f35f9d4",
"repository": {
"id": 123456789,
"name": "your-repo",
...
},
...
},
"receivedAt": 1765992531136
}To customize the app, update the files in the repository, listed below:
server.js: The Node.js Express web server that handles GitHub webhook eventsKraftfile: the Unikraft Cloud specificationDockerfile: the Docker-specified app filesystem
Use the --help option for detailed information on using Unikraft Cloud:
kraft cloud --helpOr visit the CLI Reference.