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.
clivly.createClivlyHandler()
clivly.config.ts
mounted as
Next.js
app/api/clivly/tick/route.tsTanStack Start
src/routes/api/clivly/tick.tsSvelteKit
src/routes/api/clivly/tick/+server.tsRemix
app/routes/api.clivly.tick.tsNuxt
server/api/clivly/tick.tsall resolve to
/api/clivly/tick
what Clivly calls
This is why `syncTrigger.path` is a single constant rather than a per-framework setting.
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/verifyis optional today and only belongs in your app if you explicitly configureverifyToken.- Without
verifyToken,createAuthVerifyHandler()fails closed with HTTP 503 rather than exposing host sessions.