Frameworks

Next.js

Mount the Clivly tick and auth-verify routes as App Router route handlers.

The docs work better when framework-specific scaffolding is on its own route instead of being buried in one huge page.

Every framework wraps the same createClivlyHandler(), and every route resolves to the same public URL: /api/clivly/tick. In Next.js, clivly init scaffolds App Router handlers at app/api/clivly/tick/route.ts (or src/app/…).

These examples match the current scaffolded route shapes and SDK guidance.

Next.js

app/api/clivly/tick/route.ts
import clivly from "../../../../clivly.config";

const handler = clivly.createClivlyHandler();

export const POST = (request: Request) => handler(request);
app/api/clivly/auth/verify/route.ts
import clivly from "../../../../../clivly.config";
import { auth } from "@/auth";

const handler = clivly.createAuthVerifyHandler(async (request) => {
const session = await auth.api.getSession({ headers: request.headers });
return session?.user
  ? {
      id: session.user.id,
      email: session.user.email,
      name: session.user.name ?? undefined,
    }
  : null;
});

export const POST = (request: Request) => handler(request);
  • /clivly/auth/verify is optional today and only belongs in your app if you explicitly configure verifyToken.
  • Without verifyToken, createAuthVerifyHandler() fails closed with HTTP 503 rather than exposing host sessions.