Creating Apps from the CLI
Last updated June 15, 2023
Table of Contents
The app is the fundamental unit of organization on Heroku. Each app can have its own set of provisioned add-ons.
Creating a Named App
After creating an app, you probably want to git push
to deploy and add collaborators so that others can deploy changes as well.
To create a new app named example
, install the Heroku CLI and run this command.
$ heroku create example
Creating ⬢ example... done
https://example.herokuapp.com/ | https://git.heroku.com/example.git
The command’s output shows that the app is available at http://example.herokuapp.com
. The second URL, https://git.heroku.com/example.git
, is the remote Git repository URL. By default, the heroku create
command automatically adds a git remote named heroku
that points to this URL.
heroku create
is a shorthand alias for heroku apps:create
. You can see a list of all commands with heroku help
.
Typically, you only use this command on an initialized Git repository. The command creates the application and a Git remote that you can use to push your code to Heroku.
$ mkdir example
$ cd example
$ git init
$ heroku apps:create example
Creating ⬢ example... done
https://example.herokuapp.com/ | https://git.heroku.com/example.git
Git remote heroku added
Creating an App Without a Name
The app name argument is optional. If no app name is specified, a random name is generated.
$ heroku create
Creating app... done, ⬢ mystic-wind-83
Created http://mystic-wind-83.herokuapp.com/ | git@heroku.com:mystic-wind-83.git
Because Heroku app names are in a global namespace, you can expect that common names like “blog” or “wiki” are already taken. It’s often easier to start with a default name and rename the app later.
Welcome Page
After creating your new app, Heroku displays a generic welcome message to its visitors if you haven’t deployed code yet. This page is served with HTTP status code 502 to indicate that the app isn’t yet running.