Skip to content
Generic filters
Exact matches only

Auto-deploy FastAPI App to Heroku via Git in these 5 Easy Steps

The Procfile specifies the commands that are executed by the app upon startup. Create a new file called Procfile (no extensions, make sure you are using the same casing).

This is the Procfile for the Iris classifier:

web: uvicorn – host= – port=${PORT:-5000}

If you are using your own FastAPI project, change the path accordingly. This is the path to the instantiated FastAPI() object.

Here is mine for reference.

Follow the instructions on the Heroku website to download the CLI:

Although we aren’t actually using the CLI at all here, the CLI makes it easy to manage the app through the terminal.

Go to and create an account. Navigate to the dashboard to create a new app.

I named my app irisclassifierfastapi. The name determines the default URL — this project will be hosted at Custom domains can be added to the app on the app’sSettings page.

Navigate to the deploy tab and click on the GitHub logo to authenticate and authorize Heroku to deploy code from your GitHub account.

Once connected, select the repository to connect to the app. From there, choose a branch and hit Enable Automatic Deploys. If you are using a CI tool, you can check the checkbox to ensure that CI passes before changes are deployed.

The next time you push changes to your master branch, the app will be deployed. Since we haven’t deployed our app yet (and have made no changes so far), we can trigger a manual deployment by scrolling to the bottom of the deployment tab.

If you installed the CLI, manual deploys can also be executed through the command line.