How to deploy Next.js and Express servers on two different ports concurrently on Heroku How to deploy Next.js and Express servers on two different ports concurrently on Heroku heroku heroku

How to deploy Next.js and Express servers on two different ports concurrently on Heroku


Don't do this. It's a better idea to keep the front-end and back-end (API) completely separate, on a coding point of view but also on a hosting/infrastructure point of view. Read about "monolithic vs microservices".

So you can create 2 Heroku apps, one for Next and one for Express. You will have to link each other apps by setting the correct URLs and perhaps also configure CORS on the API.