I built a full-stack MERN project and previously deployed the frontend and backend as two separate deployments. After recently updating the project, the frontend deployed normally, but the backend failed even though I had not changed its code. I deleted the old backend deployment and tried importing it again, but the setup now seemed to treat the entire repository as one project. Does Vercel still support separate frontend and backend deployments from the same repository? If so, what is the correct setup, and how should I configure environment variables for each part?
3 Answers
The deployment failure is probably unrelated to Vercel changing the repository import flow. Check the backend deployment log and find the first real error rather than the later follow-up messages. Also check which Node.js version the project is using; a default runtime change can break an otherwise unchanged backend, so pinning the version your app supports may help. If you are deploying Express, make sure the app uses a supported entry file or export format.
Yes, you can still create two separate Vercel projects from the same repository. For example, if the repo contains /frontend and /backend, create one project with its Root Directory set to frontend and another with its Root Directory set to backend. Each project keeps its own deployment settings, domain, and environment variables. Importing the repository does not force both folders into one deployment.
Keep backend secrets such as MONGODB_URI and JWT_SECRET only in the backend project's environment variables. The frontend should receive only the backend's public URL, using the appropriate public-variable format for your frontend tool, such as VITE_API_URL with Vite. Set variables separately for Production and Preview when needed, and redeploy after changing them because existing deployments do not automatically pick up new values.
Remember that environment variables are scoped to each Vercel project. Splitting the app means you have to maintain the frontend and backend variables separately.

Vercel also has a newer multi-service option, but you do not need that for a normal frontend/backend split. Two projects using different root directories is still the straightforward setup.