How to use the Procfile generator
- In Processes, write one line per process type: the name, a colon, then the command, for example
worker: node dist/worker.js. - Use letters, digits, hyphens or underscores for names.
webis the only type that receives HTTP requests. - Make the
webcommand use$PORT, or make sure your app reads the PORT variable itself. - Read the warnings under the output, fix the lines they mention, and save the result as
Procfilein the app root.
What it does and when to use it
A Procfile tells Heroku, and tools that copy its approach, which processes to start for your app. Each line becomes a separate process type that you can scale on its own: more web dynos for traffic, more workers for a job queue. The format is simple, but a typo in a name or a server bound to a fixed port causes failed deploys that are hard to read in the logs.
The .env example generator documents the variables those processes need, and the Makefile generator gives developers the same commands locally. If you deploy with containers instead, the Dockerfile generator plays the same role.
How it works
Each line is split at its first colon into a type and a command, so commands may contain more colons, such as app:app or 0.0.0.0:$PORT. Lines starting with # are skipped. The tool then checks:
- the type uses only letters, digits,
-and_, otherwise the line is dropped with a warning; - the command is not empty, otherwise the line is dropped;
- a
webcommand mentions$PORTor${PORT}; - no type appears twice.
The format is described in Heroku’s Procfile documentation.
Worked examples
The Node sample:
web: node dist/server.js --port $PORT
worker: node dist/worker.js
release: npx prisma migrate deploy
Two common mistakes. web: npm start and bad type: x give a file with only web: npm start, plus two warnings: “The web process must listen on the port in $PORT” (fine if your app reads PORT itself) and that “bad type” is not a valid process type.
A Python app. web: gunicorn app:app --bind 0.0.0.0:$PORT, two worker lines and an empty clock:. The gunicorn line passes, clock is dropped because it has no command, and the tool warns that “worker” appears more than once.
Empty input returns “Add at least one “type: command” line, e.g. web: npm start”.
Limits and tips
- When a type appears twice, only the last line is kept in the output (here
worker: rq worker). If you need both processes, give them different names (for exampleworker-mail). - The tool cannot tell whether a command works. Run it locally with the same environment first.
- Keep secrets out of the Procfile; set them as config variables on the platform.
Frequently asked questions
What should the file be called?
Which process type receives web traffic?
What is the release process for?
Can I use the same Procfile locally?
Do other platforms read Procfiles?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.