{"id":1934,"date":"2026-07-22T00:06:28","date_gmt":"2026-07-21T17:06:28","guid":{"rendered":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-deploy-a-node-js-app-on-heroku-a-step-by-step-guide\/"},"modified":"2026-07-22T00:06:28","modified_gmt":"2026-07-21T17:06:28","slug":"how-to-deploy-a-node-js-app-on-heroku-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-deploy-a-node-js-app-on-heroku-a-step-by-step-guide\/","title":{"rendered":"How to Deploy a Node.js App on Heroku: A Step-by-Step Guide"},"content":{"rendered":"<h1>How to Deploy a Node.js App on Heroku: A Step-by-Step Guide<\/h1>\n<p>Heroku is a cloud platform as a service (PaaS) that lets you deploy, manage, and scale Node.js apps with minimal effort. You only need a Heroku account, Git, and the Heroku CLI installed. Follow this guide to go from local code to a live URL in minutes.<\/p>\n<p>Before you start, make sure your app has a <code>package.json<\/code> file with a <code>\"start\"<\/code> script (e.g., <code>\"start\": \"node app.js\"<\/code>). Also set the Node.js engine in <code>package.json<\/code> (optional but recommended) and create a <code>Procfile<\/code> that declares the process type: <code>web: node app.js<\/code>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/via.placeholder.com\/800x600\/4a90d9\/ffffff?text=how%20to%20deploy%20a%20Node.js%20app%20on%20Heroku\" alt=\"Article illustration\" style=\"display:block;margin:20px auto;max-width:100%;height:auto;border-radius:8px;\" \/><\/p>\n<h2>1. Initialize Git and Create the Heroku App<\/h2>\n<p>Run these commands in your project folder:<\/p>\n<ul>\n<li><code>git init<\/code><\/li>\n<li><code>heroku create your-app-name<\/code> (or omit to get a random name)<\/li>\n<li><code>git add .<\/code> and <code>git commit -m \"initial commit\"<\/code><\/li>\n<\/ul>\n<p>The <code>heroku create<\/code> command adds a remote named <code>heroku<\/code> to Git and provisions a new app on Heroku\u2019s servers.<\/p>\n<h2>2. Deploy with Git Push<\/h2>\n<p>Push your code to the heroku remote:<\/p>\n<p><code>git push heroku main<\/code><\/p>\n<p>Heroku automatically detects the Node.js buildpack, installs dependencies (<code>npm install<\/code>), and starts the web process from your <code>Procfile<\/code>. Watch the logs in your terminal to confirm success.<\/p>\n<h2>3. Configure Environment Variables<\/h2>\n<p>Set any secrets (API keys, passwords) using:<\/p>\n<p><code>heroku config:set MY_VAR=value<\/code><\/p>\n<p>Access them in your app with <code>process.env.MY_VAR<\/code>. This keeps sensitive data out of your repository.<\/p>\n<h2>4. Verify and Scale<\/h2>\n<p>Open your app with <code>heroku open<\/code> to see it live. You can scale dynos (e.g., run two web processes) using <code>heroku ps:scale web=2<\/code>. Monitor logs with <code>heroku logs --tail<\/code> for real\u2011time debugging.<\/p>\n<p>Deploying a Node.js app on Heroku is quick and requires no server management. You can now iterate with <code>git push origin main<\/code> and then <code>git push heroku main<\/code> to update your live app. For advanced needs, explore add\u2011ons like databases or caching.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Deploy a Node.js App on Heroku: A Step-by-Step Guide Heroku is a cloud platform as a service (PaaS) that lets you deploy, manage, and scale Node.js apps with minimal effort. You only need a Heroku account, Git, and the Heroku CLI installed. Follow this guide to go from local code to a live &hellip; <\/p>\n","protected":false},"author":2716,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-1934","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/1934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/users\/2716"}],"replies":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1934"}],"version-history":[{"count":0,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/1934\/revisions"}],"wp:attachment":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}