Arcjet - JS SDK
[Arcjet][arcjet] is the runtime security platform that ships in your AI code. Detect prompt injection, authorize agent tool calls, redact sensitive data, and block bots and abuse. Real-time security building blocks you call inside your app, before an action happens.
This is the monorepo containing various [Arcjet][arcjet] open source packages for JS.
Why Arcjet?
Your app's AI features and agents take real actions, calling tools, reading data, hitting APIs. Arcjet runs inside that code and lets you enforce security on each action in real time, then audit what happened
Which package do I need?
Arcjet protects two types of entry points. Pick the right path for your use case:
| Entry point | When to use | Package |
|---|---|---|
| Request protection | HTTP route handlers, API endpoints, middleware — anything with an incoming Request object. |
@arcjet/next, @arcjet/node, @arcjet/bun, etc. |
| Guard protection | AI agent tool calls, MCP server handlers, queue workers, background jobs — anything without an HTTP request. | @arcjet/guard |
Not sure? If you have an HTTP request, use a framework SDK. If you
don't, use @arcjet/guard. You can use both in the
same project.
Getting started
The fastest way to get started is with an AI coding agent. Log in, install a skill, and let your agent handle the rest.
Step 1: Log in with the CLI
npx @arcjet/cli auth login
You can also sign up and manage keys at
app.arcjet.com, or connect
the Arcjet MCP server to your AI
assistant.
Step 2: Install a skill
Skills give your agent the documentation to detect your framework, install the SDK, and wire up request or guard protection rules.
npx @tanstack/intent@latest install
This discovers @arcjet/skills (and @arcjet/guard if installed) from
node_modules without executing package code. Add an allowlist in your app
package.json so only those packages can surface skills:
{
"intent": {
"skills": ["@arcjet/skills", "@arcjet/guard"]
}
}
Load only the skill for the current task, for example
npx @tanstack/intent@latest load @arcjet/skills#protect. Editor hooks from
intent hooks install are convenience, not a security boundary.
The standalone marketplace install (npx skills add arcjet/skills) still
works from arcjet/skills. Prefer the
versioned package when you want skills that match the SDK in node_modules.
You can also use the Arcjet plugin for Claude Code and Cursor, which bundles skills, MCP, and coding rules.
Step 3: Install the package
[!WARNING] When a platform-provided client IP is unavailable, Arcjet may use forwarding headers such as
X-Forwarded-For. Clients can spoof these headers if they can reach your application directly or your proxy preserves client-supplied values. Arcjet continues protecting the request, but logs one warning for the lifetime of each Arcjet client instance and marks the source asunverified-headerin theclient_ip_provenancedebug facet.In production, make the application reachable only through a proxy that overwrites or safely appends forwarding headers, and list every trusted hop in
proxies. Use a proxy-service helper such ascloudflare()where available. Invalid proxy entries and non-empty malformedipSrcvalues are rejected (ipSrc: ""remains equivalent to omitting the option); trusting0.0.0.0/0or::/0emits a configuration warning. Inspect the selection withclient.clientIpDetails(request)in@arcjet/node, orfindIpDetails()/resolveClientIp()from@arcjet/ipin other adapters. If your application determines the address itself, pass that validated value asipSrcto both the debugging API andprotect().
For request protection — pick the SDK for your framework:
| Framework | Package | Install |
|---|---|---|
| Next.js | @arcjet/next |
npm i @arcjet/next |
| Node.js | @arcjet/node |
npm i @arcjet/node |
| Bun | @arcjet/bun |
bun add @arcjet/bun |
| Deno | @arcjet/deno |
deno add npm:@arcjet/deno |
| Express | @arcjet/node |
npm i @arcjet/node |
| Fastify | @arcjet/fastify |
npm i @arcjet/fastify |
| Hono | @arcjet/node or @arcjet/bun |
npm i @arcjet/node |
| NestJS | @arcjet/nest |
npm i @arcjet/nest |
| Nuxt | @arcjet/nuxt |
npm i @arcjet/nuxt |
| Remix | @arcjet/remix |
npm i @arcjet/remix |
| React Router | @arcjet/react-router |
npm i @arcjet/react-router |
| SvelteKit | @arcjet/sveltekit |
npm i @arcjet/sveltekit |
| Astro | @arcjet/astro |
npm i @arcjet/astro |
For guard protection:
npm i @arcjet/guard
Step 4: Tell your agent what to protect
Ask your coding agent to implement protection. The skill you installed in Step 2 gives it everything it needs. For example:
"Add Arcjet bot protection and rate limiting to my /api/chat route"
"Add Arcjet guard with prompt injection detection to my MCP tool handler"
The agent will install the right package, configure rules, and wire up
protect() or guard() calls — or see the full list of protections
below.
Get help
[Join our Discord server][discord-invite] or [reach out for support][support].
- Documentation — full reference and guides
- Example apps — working starter projects for every framework
- Blueprints — recipes for common security patterns
Features
| Feature | Request SDKs | Guard |
|---|---|---|
| 🛑 Rate Limiting — token bucket, fixed window, sliding window | ✅ | ✅ |
| 🔒 Prompt Injection Detection — block attacks before they reach your LLM | ✅ | ✅ |
| 🕵️ Sensitive Information Detection — block PII, credit cards, custom patterns | ✅ | ✅ |
| 🤖 Bot Protection — stop scrapers, credential stuffers, AI crawlers | ✅ | — |
| 🛡️ Shield WAF — protect against SQL injection, XSS, OWASP Top 10 | ✅ | — |
| 📧 Email Validation — block disposable, invalid, undeliverable addresses | ✅ | — |
| 📝 [Signup Form Protection][feature-signup-protection] — bot + email + rate limiting combined | ✅ | — |
| 🎯 Request Filters — expression-based rules on IP, path, headers | ✅ | — |
| 🌐 IP Analysis — geolocation, ASN, VPN, proxy, Tor, hosting detection | ✅ | — |
| 🔧 Custom Rules — define your own local evaluation logic | — | ✅ |
Request SDKs = @arcjet/next, @arcjet/node, @arcjet/bun, etc. — for HTTP routes.
Guard = `@arcjet/guar