Skip to main content
Mount Hookfish below /api with an optional catch-all App Router route. The handler uses the Node.js runtime so it can use the database adapters and provider SDKs included with Hookfish.

Install dependencies

Create hookfish.config.ts using the same configuration shown in the Hono guide. Use PGlite only for local development or a single persistent Node process. Use PostgreSQL for horizontally scaled or ephemeral deployments.

Create the route handler

Create app/api/[[...path]]/route.ts:
Adjust the relative config import to match your project structure.

Add authenticated application routes

Keep user authentication in normal Next.js route handlers. After validating the session and permissions, use Hookfish to call the mounted API from the server:
Place this handler at an application-owned path such as /api/integrations/connections. The browser sends its normal Next.js session to that path and never receives the broker token. Unlike Hono, Next.js does not automatically turn a thrown HookfishError into its HTTP response, so return error.getResponse() at the route boundary. See Application authentication for the complete server pattern and tenant-isolation guidance.