Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

Deploying Next.Js App Using Heroku Cloud Application Platform

Posted on 29/06/202430/06/2026 Temitope Odemo By Temitope Odemo No Comments on Deploying Next.Js App Using Heroku Cloud Application Platform
  1. Home
  2. Version Control System
  3. Deploying Next.Js App Using Heroku Cloud Application Platform
banner-1

In this article, I will be deploying a Next.Js app using the Heroku cloud application platform. Heroku is one of the best platforms as a service (PaaS) that many developers are using to build, run, and operate their applications fully on the cloud. Please see How to use GitHub as Source Provider for AWS CodePipeline, and how to use Command-Line on Git Bash and GitHub Desktop to PUSH local code to GitHub.

They have a free and pay-for-service plan. On this platform, you can easily deploy your application for public access in few minutes.

You can read further about, How to Deploy a React Application on Netlify, How to Create a React App with Vite, and How to Deploy GitHub Repositories to cPanel using GitHub Actions.

Deploy Next.Js on Heroku

1: Create a Next.js app on your localhost

If you don’t have the app on your localhost you can use the below command to create a Next.js app.

npx create-next-app

Follow the setup steps and when it is done start the development server by using this command npm run dev.

Deploying-Next.Js-App-Using-Heroku-Cloud-Application-Platform-NextJS

2. Update your Project Package.json

Heroku runs applications using Linux containers called dynos and when it runs a web dyno, it sets a variable called $PORT.  So we will be binding this port in order to receive incoming requests.

Open the root-level package.json and update the start script with “-p $PORT”

"scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start -p $PORT",
    "lint": "next lint"

3: Commit your code to git

The next thing to do is to use git to push your code to Heroku. First, we will commit our code to a git repo.

git init
git add .
git commit -m "First commit"

Please see Disaster Recovery Test Checklist: What to Capture Before You Start, Secure Boot 2023 Compliance Across WinPE, MDT, WDS, and ADK: Boot Chain Alignment and PXE Validation [Final Part], and Fix an error occurred while attempting to start selected VM on Hyper-V.

4: Create an account on Heroku and create an app

You need to be logged into the Heroku platform to use the CLI and run the below command to create an app.

Deploying-Next.Js-App-Using-Heroku-Cloud-Application-Platform-create-app-1

Set up your app by adding payment card details, don’t worry you will not get charged immediately as it is prorated based on what resources you used.

Deploying-Next.Js-App-Using-Heroku-Cloud-Application-Platform-setup-app

Open the CLI and enter this command heroku create ”your app name”

Please see Azure Virtual Desktop: Deploy host pools and session hosts in the Azure [Part 01], Azure Virtual Desktop: How to set Up Azure Virtual Desktop Insights Monitoring [Part 03], and Azure Virtual Desktop: Manage Azure Virtual Desktop host pools and session hosts using the Azure portal [Part 02]

5.    Push your code to Heroku Platform

After committing your code and the Heroku app created, you can then push your code to the app created on Heroku. Use this command to get this done:

git push heroku master

but if you plan to use another branch separate from the master then you can use the below command:

git push heroku [your branch name]:master

After successful deployment you will be able to view your app at

https://[YOUR_APP_NAME].herokuapp.com/

FAQs

Is Heroku still free?

Starting from November 28th, 2022 Heroku no longer offers a free tier plan, what this means is that free Heroku Dynos, Postgres and Redis servers will no longer be available on the free tier.

Does Heroku accept custom domains?

Yes. You can add a custom domain to your Heroku app. When you add a domain it does not incur extra charges.

I hope you found this blog post on Deploying Next.Js App Using Heroku Cloud Application Platform Interesting and helpful. If you have any questions do not hesitate to ask in the comment section.

5/5 - (1 vote)

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Version Control System Tags:build and deploy Next.js to Heroku, cloud hosting Next.js application, configure Procfile Next.js Heroku, continuous deployment Next.js Heroku GitHub integration, deploy full-stack Next.js Heroku app, Deploy Next.js app Heroku, deploy React Next.js app Heroku Git, deployment, fix Heroku build errors Next.js, Git, Heroku deployment Next.js guide, Heroku environment variables Next.js setup, Heroku server-side rendering Next.js config, host Next.js on Heroku cloud platform, Next.js production deployment cloud platform, Node.js Next.js Heroku deployment steps, Repository, Version Control, Windows 10

Post navigation

Previous Post: How to Secure your API key in Postman
Next Post: How to Configure and Run Performance Tests in Postman

Related Posts

  • Angular Azure
    How to deploy your Angular App to Azure from Visual Studio Code AWS/Azure/OpenShift
  • Screenshot 2022 03 20 at 20.37.16
    Setup HTTPS users using Git credentials and Pushing Code to AWS CodeCommit AWS/Azure/OpenShift
  • banner2
    How to Integrate Postman With GitHub Automation
  • Deploy Web App from GitHub
    Deploy Code from GitHub to Azure Apps Services via the Command line AWS/Azure/OpenShift
  • GitLabrunner
    Install and Register GitLab Runner on Windows Version Control System
  • DevOps
    Create an App Service Plan with Continuous Deployment to deploy a .NET Application from GitHub AWS/Azure/OpenShift

More Related Articles

Angular Azure How to deploy your Angular App to Azure from Visual Studio Code AWS/Azure/OpenShift
Screenshot 2022 03 20 at 20.37.16 Setup HTTPS users using Git credentials and Pushing Code to AWS CodeCommit AWS/Azure/OpenShift
banner2 How to Integrate Postman With GitHub Automation
Deploy Web App from GitHub Deploy Code from GitHub to Azure Apps Services via the Command line AWS/Azure/OpenShift
GitLabrunner Install and Register GitLab Runner on Windows Version Control System
DevOps Create an App Service Plan with Continuous Deployment to deploy a .NET Application from GitHub AWS/Azure/OpenShift

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • Screenshot 2020 05 13 at 19.23.25
    AWS Command-Line Interface: How to configure AWS CLI [Part 1] AWS/Azure/OpenShift
  • Performancewin10
    How Performance Monitor works in Windows 10 Windows
  • Azure Virtual Desktop: Connect to Session Hosts Using Entra ID [Part 04] AWS/Azure/OpenShift
  • PrintNightMare
    Mitigating ‘PrintNightmare’ Vulnerability: Print Spooler Solutions Security | Vulnerability Scans and Assessment
  • article 1280x720.192a2586 1
    Veles Software: MPA Tools Review and Product Details Reviews
  • Keb
    How to configure a service account for Kerberos delegation Windows Server
  • sdfgh
    Get a list of installed applications on Windows Scripts
  • screenshot 2020 04 27 at 17.34.38
    Remote Server Administration Tools: Install RSAT on Windows Windows Server

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,784 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.