GenerateSaaS

Switch to Separate

Move a fullstack project to a standalone backend in place - unmount the API route, repoint the client, and move DB ownership, with no CLI re-run.

Fullstack ships apps/backend dormant. Activating it is an in-place rewiring you do by hand - re-running the CLI regenerates packages/config/src/index.ts and .env wholesale and overwrites your edits.

The backend needs a long-running host - Docker on Render, Fly.io, Railway, Coolify, Dokploy, or a VPS. separate + vercel is blocked. The frontend can stay on Vercel.

Unmount the API - delete apps/web/app/api/[[...rest]]/route.ts, plus apps/web/instrumentation.ts and its tests/instrumentation.test.ts. The frontend stops serving @repo/api; apps/backend/src/index.ts now owns it. That boot check only guards the in-process mount - the standalone backend reads the connection peer. See Client IP.
Run the backend in pnpm dev - drop --filter=!backend from the root dev script so apps/backend runs alongside the frontend.
Demote @repo/api - move "@repo/api": "workspace:*" from dependencies to devDependencies in apps/web/package.json, then pnpm install. Only the AppType type stays; the Hono runtime leaves the frontend bundle.
Repoint the client - set NEXT_PUBLIC_API_URL to the backend origin (http://localhost:3010 dev, https://api.yourdomain.com prod). This one value re-derives apiBasePath, auth baseURL, CORS, and SSR rewrites - no source edits.
Set backend env - API_PORT=3010, TRUSTED_ORIGINS=<every frontend origin>, plus AUTH_COOKIE_DOMAIN for cross-subdomain cookies. See Separate backend.
Move DB ownership - move the schema step (pnpm -F @repo/database run deploy) and DATABASE_URL off the frontend's start / buildCommand onto apps/backend, keeping DATABASE_URL out of the frontend host.
Deploy and proxy - deploy apps/backend (its Dockerfile is ready) and front both apps by host or path. See Reverse proxy.
Optional - set performanceMonitor.enabled: true in packages/config/src/index.ts. Fullstack disables it to avoid double-logging the in-process mount; standalone, the API should log its own requests.
ConcernFullstackSeparate
API mountFrontend catch-all routeapps/backend process
@repo/apidependenciesdevDependencies (types only)
NEXT_PUBLIC_API_URL…/api (same origin)Backend origin
DB schema stepFrontendBackend
Cross-origin env-TRUSTED_ORIGINS, AUTH_COOKIE_DOMAIN

Verify: run both apps and confirm an authenticated browser call succeeds cross-origin.