'How do I deploy a next.js app with a custom backend (express) to a VPS or Heroku

How do I deploy a next.js app with a custom backend (specifically express) to a VPS or Heroku.



Solution 1:[1]

I have the same setup.

  • server.js (express)
  • client (react app)

I used this and it works:

 "scripts": {
    "start": "node server.js",
    "heroku-postbuild": "cd client && npm install && npm run build"
  },

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 daninad