Skip to content
generated from arcjet/example-nextjs

An example Next.js application showing a dynamic Arcjet rate limit based on the authenticated user.

License

Notifications You must be signed in to change notification settings

arcjet/example-nextjs-prisma

Repository files navigation

Arcjet Logo

Arcjet dynamic rate limit example

Arcjet helps developers protect their apps in just a few lines of code. This is an example application demonstrating the use of dynamic rate limits with user configuration in a database.

This is forked from the main Arcjet example app.

Video walkthrough

Watch the video walkthrough of this example on YouTube.

Features

  • Rate limiting shows the use of different rate limit configurations depending on the authenticated user.
  • Dynamic rate limits using the value set in a SQLite database for each user.

Run locally

  1. Register for a free Arcjet account.

  2. Install dependencies:

npm ci
  1. Rename .env.example to .env and add your Arcjet key. Add an Auth.js secret and create a GitHub OAuth app.

  2. Bootstrap the database:

npm exec prisma migrate dev
  1. Start the dev server
npm run dev
  1. Open http://localhost:3000 in your browser.

Stack