Skip to content
masterclass Buddy

Arcjet · Function

createMiddleware

createMiddleware adapts an Arcjet client for use as Next.js middleware. Export the returned function and use a matcher to select the requests it handles.

Last updated

Syntax

createMiddleware(aj, options?)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • arcjet
  • shield
  • detectBot
  • filter
  • ArcjetDecision
  • matcher

Source: Bot protection reference for Next.js | Arcjet Docs. Checked 2026-11-03.