How to Configure Dev, QA, UAT, and Prod Environments?

I’m working on a multisite Next.js app hosted on Vercel, with a Headless CMS as the backend. Both frontend and backend have four environments — Dev, QA, UAT, and Prod.
Since Vercel supports custom environments, what’s the recommended setup for managing these environments?
->Create separate Vercel projects for each environment (Dev, QA, UAT, Prod), or
->Use a single Vercel project with multiple custom environments configured?
I’m looking for guidance based on best practices for deployment workflow, environment variables, and
multisite management.

The domain troubleshooting guide can help with most custom domain configuration issues. You might be able to use that guide to solve it before a human is available to help you. Then you can come back here and share the answer for bonus points.

You can also use v0 to narrow down the possibilities.

Hi @alok-q-kumar, welcome to the Vercel Community!

If your Next.js app is both the backend and frontend for the product then one Vercel project with 4 environments should be the way to go.

Usually the goal for different environments is to have different DB_URL or secrets of some kind. I think Vercel Environments are good for this use case.

If you have different build steps for each environment then I think you may need to go for the 4 separate projects for your app. But, honestly that might be an overkill.

Hi @anshumanb ,

Thanks for your response.

I have the following scenarios. Could you confirm whether a single Vercel project would work well for all of them?

  1. I have four environments and each environment have their own environment specific variables/secrets configured in vercel. Based on these App
    fetch the data from backend and render.
  2. I have limitation to deploy the my from main branch only to all environment. How can I deploy my code to different environments separately.
  3. Due to organization policy, I can not provide the Repo access to Vercel. So I am using Vercel CLI for deployment.
  4. It is a multisite setup so my environments will have multiple domains such as for Dev environment domains can be “dev.example-1.com” and “dev.example-2.com”.

Can you also please share the pros and cons of using Single vs Multiple projects?

Thanks,
Alok Kumar

Hi @alok-q-kumar, yes, this should be quite possible and a good approach to keep same project. I’d approach it as follows:

In your deployment pipeline, you can pull the environment vercel env pull --environment=ENV_NAME. Then use deploy#target option to deploy your code to a specific environment, as follows: vercel deploy --target=ENV_NAME.

I hope this helps.