Next.js

Gate Next.js routes in middleware so visitors without a pass never reach your pages.

Middleware runs before your pages, so visitors without a pass never reach them, even with JavaScript disabled.

TypeScript
// middleware.ts
import { withWaitrooms } from "@waitrooms/sdk/next";

export default withWaitrooms({
  room: "your-room",
  queueUrl: "https://waitrooms.dev", // or your custom queue domain
});

export const config = { matcher: ["/checkout/:path*"] };

Passes are verified locally against cached public keys, so a check adds no network round trip. If our keys can't be fetched and none are cached, visitors are let through (failOpen, on by default).

Something unclear? Email hello@waitrooms.dev.