Switch to Fullstack
Fold a standalone backend back into the frontend - one deploy, no CORS, Vercel-ready.
Mount @repo/api inside the frontend again. Do it in place - re-running the CLI regenerates packages/config/src/index.ts and .env wholesale and overwrites your edits.
Choose fullstack to consolidate hosts, drop CORS + cross-origin env, or deploy to Vercel (only fullstack runs there - separate + vercel is blocked).
Remount the API: recreate apps/web-next/app/api/[[...rest]]/route.ts:
import app from "@repo/api";
const handler = (req: Request) => app.fetch(req);
export const GET = handler;
export const POST = handler;
export const PUT = handler;
export const PATCH = handler;
export const DELETE = handler;
export const OPTIONS = handler;Promote
@repo/api - move "@repo/api": "workspace:*" from devDependencies to dependencies in apps/web-next/package.json, then pnpm install. The Hono runtime now ships with the frontend.Repoint the client - set
NEXT_PUBLIC_API_URL to the frontend's own origin + /api (http://localhost:3000/api dev). Remove TRUSTED_ORIGINS and AUTH_COOKIE_DOMAIN - same-origin cookies return to lax.Move DB ownership back - move the schema step (
pnpm -F @repo/database migrate) and DATABASE_URL onto the frontend's start/buildCommand.Silence double-logging - set
performanceMonitor.enabled: false in packages/config/src/index.ts. The framework already logs requests for the in-process mount.Stand down the backend - stop deploying
apps/backend. Leave it in the repo, dormant, so you can switch back.Deploy - one unit; Vercel now allowed. See Vercel.
| Concern | Separate | Fullstack |
|---|---|---|
| API mount | apps/backend process | frontend catch-all route |
@repo/api | devDependencies (types only) | dependencies |
NEXT_PUBLIC_API_URL | backend origin | …/api (same origin) |
| DB schema step | backend | frontend |
| Cross-origin env | TRUSTED_ORIGINS, AUTH_COOKIE_DOMAIN | - |
Verify: run the frontend alone and confirm an authenticated browser call succeeds same-origin.