'How to deploy to Heroku if my client and servers are in separate folders?

I have a repo with 2 folders - 1 for the server, 1 for the client, and each folder has its own package.json file.

I am trying to deploy the server to Heroku, but I get a "No default language could be detected for this app" error because the package.json is not in the root folder of the repo.

I created a new repo with just the server files inside it to test, and I am able to deploy to Heroku like this. But I do not want to do this, I'd like to keep the repo as is with the 2 separate folders.

Is there any way to do this without creating a new repo for the server?



Solution 1:[1]

You can simly create a docker-compose file that will spin up your client and server. Then after that, in heroku you need to choose the Docker in the deployment page.

More information about using docker and node: https://blog.logrocket.com/node-js-docker-improve-dx/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fernando Callata