Guides

Framework Integration

The c15t backend exposes a single handler with the signature (request: Request) => Promise<Response>. This is the standard Fetch API, so it works with any runtime that supports it — Node.js, Bun, Deno, and Cloudflare Workers.

Bun

server.ts

Next.js (App Router)

Create a catch-all API route that forwards requests to the handler:

src/app/api/c15t/[[...path]]/route.ts

Info

Use Next.js rewrites to proxy frontend requests through the same domain and avoid ad-blocker issues. See the Next.js Quickstart for the rewrite configuration.

Hono

server.ts

Express

server.ts

Fastify

server.ts

Cloudflare Workers

worker.ts

Deno

server.ts

CORS

The backend automatically handles CORS based on the trustedOrigins you configure:

Features:

  • www variants are automatically allowed
  • Wildcard subdomain matching with *
  • localhost is allowed in development
  • Preflight OPTIONS requests are handled automatically