Deploy a React application to Heroku

Deploying the example React App to Heroku is performed using Git commands. After setting up on Heroku, you add Heroku as a remote in your git config.

$ git remote add heroku

Git requires an SSH Key for secure communication with Heroku (see my article on Setup MacBook for node development). Deployment is then a push command. When Heroku receives the Git push command, it installs the application.

$ git push heroku master

After the website has installed, Heroku will run the postInstall command in the package.json file, which in our case will perform a Webpack production build to output minified assets.

"dist": "webpack -p",
"postinstall": "npm run dist",

Deployment to Heroku closes the loop in our JavaScript build pipeline and demonstrates how our foundation tools (Git, node.js) are leveraged by the Heroku cloud platform to provide a production environment for our application.

See the example React App running on Heroku.

Published by Mark Brownsword

I've been working as an enterprise developer for about 15 years, always using .NET platform and mostly using Oracle databases. My degree is in Business Studies, majoring in information systems, where I learnt the fundamentals of software engineering for building systems for business. In my spare time I like to play around with games programming because the emphasis is much more on pure computer science.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s