8

Question about deploying back end to Vercel from a monorepo from where front end has already been deployed.

I'm working on a full stack project (my first one) in a monorepo. The repo contains client and server directories, like so:

project
¦   README.md and other general stuff
¦   
+---client
¦       src and other client stuff
+---server
¦       src and other server stuff

I have deployed the client using Vercel's git integration, i. e. I provided them with a URL to the repository and specified the optional root directory in which they should look to find the source. That points to /client and it works fine. Deployments happen automatically as I push to master.

Now I'm starting to build a GraphQL back end and I have the first version ready to be deployed to verify everything works. I was planning to do this by creating a new project on Vercel the same way I did with the front end, and then just specify the root directory to be /server instead of /client. Problem is, as I do it I get redirected to the front end's deployment and a message saying "The project already exists", because the GitHub repository URL I entered already exists in their system.

Is there a way I can deploy my back end on Vercel from the same repository or should I deploy it with some other provider like Netlify or Heroku?

jka
  • 337
  • 5
  • 15

1 Answers1

5

You may want to follow the Monorepo example (#3547) issue in the Vercel repo. It looks like they're getting close to releasing initial support for deploying from monorepos. In the interim, I've deployed my Next.js apps that are in Yarn workspaces to Netlify where monorepos are already supported and seem to work well.

Cory
  • 860
  • 8
  • 10
  • Great! This seems to be the solution I've been looking for. Here's the short and official answer to it: https://vercel.com/blog/monorepos. – Harshit Gupta Feb 24 '22 at 19:38