Skip to main content
@wacht/nextjs is the Next.js adapter for Wacht. You typically use it in three places:
  • UI layer: DeploymentProvider + auth components/hooks
  • Route boundary: wachtMiddleware + auth.protect()
  • Server runtime: wachtClient() for backend API calls

What this package provides

Client primitives

Components and hooks re-exported from @wacht/jsx.

Server auth

auth, getAuth, requireAuth, and permission/token-aware protection behavior.

Middleware integration

wachtMiddleware and createRouteMatcher for route-level protection and request auth flow handling.

Backend client wrappers

wachtClient and createWachtServerClient backed by @wacht/backend.

Runtime configuration split

NEXT_PUBLIC_WACHT_PUBLISHABLE_KEY=pk_test_xxx
Used for session/frontend auth context.
Frontend API URL is derived from the publishable key.