Global API auth with Unkey and Koyeb
Overview
Koyeb is a developer-friendly serverless platform to deploy apps globally. Koyeb offers a fully managed environment to deploy any apps in seconds without managing any infrastructure. Koyeb supports any programming languages, frameworks, and tools to build your apps.
This example shows how to build an API using bun, secure it with unkey, and deploy it globally on Koyeb.
Requirements
- Bun installed
- An Unkey account
- A Koyeb account
Install
Develop locally
Test
curl http://localhost:8000 -H "Authorization: Bearer <KEY>"
Deploy on Koyeb

Replace the environment variable placeholders with real values from your Unkey dashboard.
Then hit the
Deploy
button.
Koyeb will deploy your app in your selected regions and provide a unique URL to access it, or you can configure your own custom domain.
Now that your app is deployed, you can test it:
curl -XPOST https://<YOUR_APP_NAME>-<YOUR_KOYEB_ORG>.koyeb.app -H "Authorization: Bearer <UNKEY_API_KEY>"
It should return a
200
status code and at least the following response, depending on your key settings:
Manual configuration:
- Create a new project on Koyeb.
- Under the advanced section, add your
UNKEY_ROOT_KEY
and UNKEY_API_ID
environment variables. You can find those in the Unkey dashboard.
- Click on the
Deploy
button
References