This example shows how to use Arcjet with a Next.js route handler.
-
From the root of the project, install the SDK dependencies.
npm ci
-
Enter this directory and install the example's dependencies.
cd examples/nextjs-app-dir-rate-limit npm ci
-
Rename
.env.local.example
to.env.local
and add your Arcjet key. -
Start the dev server.
npm run dev
-
Visit
http://localhost:3000/api/arcjet
. -
Refresh the page to trigger the rate limit.