Prerequisites
- Created your Unkey account
- Created an Unkey root key with
ratelimit.*.create_namespace
andratelimit.*.limit
permissions.
Creating a bun server protected by Unkey
1
Create a new Bun project
First we need a bun project, so create a new directory and init bun.
2
Install
Now install the
@unkey/ratelimit
package3
Add Root Key to env
Add your root key to your
.env
file4
Modify the server
Open up the file called
index.ts
and add the following codeindex.ts
5
Running the server
6