This example shows how to use Arcjet with a Node.js Express server.
-
From the root of the project, install the SDK dependencies.
npm ci
-
Enter this directory and install the example's dependencies.
cd examples/nodejs-express-rate-limit npm ci
-
Rename
.env.local.example
to.env.local
and add your Arcjet key. -
Start the server.
npm start
This assumes you're using Node.js 20 or later because the
start
script loads a local environment file with--env-file
. If you're using an older version of Node.js, you can use a package like dotenv to load the environment file. -
Visit
http://localhost:3000/
. -
Refresh the page to trigger the rate limit.