Skip to content

findlay-hannam/heroku-nextjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Next.js on Heroku

Deploy React-based universal web apps on Heroku.

Demo deployment from this repo:
https://nextjs.herokuapp.com

A custom Node/Express server is supported. Use it to:

  • combine a Node API with a Next/React UI
  • implement custom URL routes

▶️ Next with custom Express server

Requires

Production deployment

Once you have a Next app working locally, you may deploy it for public access.

  1. Add the heroku-postbuild hook to automatically build the Next app on each deployment:

    Merge this entry into package.json:

    {
      "scripts": {
        "heroku-postbuild": "next build"
      }
    }

    🌈 In February 2017, Next was fixed, so the Heroku build adapter is no longer required.

  2. Ensure the app is a git repo, ignoring local-only directories:

    git init
    (echo node_modules/ && echo .next/) >> .gitignore
  3. Create the Heroku app:

    heroku create $APP_NAME
  4. 🚀 Deploy:

    git add .
    git commit -m 'Next.js app on Heroku'
    git push heroku master
  5. ♻️ Deploy changes: add, commit, & push again.

About

Deploy Next.js universal web apps to Heroku

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%