Deploying a Node web app with a build-step

Hi, I’m just clueless. How do we deploy a node app with a custom build step?

We have a build-step for our client-side code that involves ESBuild and PostCSS.

I mean something like “yarn run build” to compile the client-side code, then “node ./server/index.js” to run the server-side code.

Thank you!

If you run fly launch in your node directory, it should configure your app to use Heroku’s buildpack. This buildpack detects build and start commands defined in package.json.

If your app already includes those commands, you should be good to deploy and it will probably just work!

2 Likes

Hi kurt, we’ll give that a shot. Thank you very much.

To be clear, these two entries in package.json should do the trick:

"scripts": {
  "start": "node index.js",
  "build": "bin/build"
}

The docs here give you some more pointers on using the buildpack.

2 Likes