We are currently working on a new version of the documentation.

Next.js

Mount the vs3 request handler in Next.js App Router route handlers.

vs3 provides toNextJsRouteHandler to map your storage.handler to Next.js route exports. Use it in an App Router route and mount it at the same path your client calls (default: /api/storage).

Basic Setup

app/api/storage/[...all]/route.ts

import { toNextJsRouteHandler } from "vs3/integrations/next-js";
import { storage } from "@/server/storage";

export const { GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS } =
  toNextJsRouteHandler({ handler: storage.handler });

Why This Works

storage.handler is a standard Web handler: (req: Request) => Promise<Response>.

Next.js route handlers use the same Request/Response model, so the integration is a direct mapping.

Next Steps