Dynamic IP based ratelimiting.
This a starter AdonisJS application which implements rate limiting with Unkey Ratelimit feature. There are two endpoints, a public one and a protected one that is limited to two request per 30 seconds.
Clone the repository:
1git clone https://github.com/Ionfinisher/unkey-adonisjs-ratelimit.git
Navigate to the project directory:
1cd <project-directory>
Install the dependencies:
1npm install
Change the .env.example to .env file and add the following:
1UNKEY_ROOT_KEY=your-root-key
Get the root key from https://app.unkey.com/settings/root-keys
Start the server
1cd to the root of the project directory2node ace serve --watch
curl the unprotected route
1 curl http://127.0.0.1:3333/api/v1/public
It should return Heeyaaa!! Touchdown to the public and unlimited endpoint!!
curl the protected route
1 curl http://127.0.0.1:3333/api/v1/protected
It should return Woohoo!! Touchdown to the protected endpoint!! But after two requests in 30 seconds it should return WoW! Try again later.
This project is licensed under the MIT License.
For further information, go to unkey.
2500 verifications and 100K successful rate‑limited requests per month. No CC required.