Safeguard your API endpoints while maintaining optimal performance.
This Nuxt.js application implements a robust rate-limiting solution for API routes using the Unkey Rate Limit API. By leveraging Unkey's powerful rate-limiting capabilities, this app ensures efficient control over API requests, preventing abuse and ensuring fair usage among clients. With minimal configuration, you can safeguard your API endpoints while maintaining optimal performance.
create_key
read_key
encrypt_key
decrypt_key
Clone the repository to your local machine:
1git clone git@github.com:unrenamed/unkey-nuxt-ratelimit2cd unkey-nuxt-ratelimit
Create a .env
file in the root directory and populate it with the following environment variables:
1UNKEY_ROOT_KEY=your-unkey-root-key2UNKEY_NAMESPACE=your-unkey-namespace
Ensure you replace your-unkey-*
with your actual Unkey credentials.
Start the server:
1pnpm dev
The server will start and listen on the 3000
port.
To test the API route, use the command:
1curl http://localhost:3000/api/hello-world -H "x-forwarded-for: <any IP address>"
and repeatedly execute it to trigger a 429 Too Many Requests response when the rate limit is exceeded.
2500 verifications and 100K successful rate‑limited requests per month. No CC required.