DEV Community

Arhan Khan
Arhan Khan

Posted on

Heroku for Beginners: Deploy Your First App Without Touching a Server

You have built an app that works on your computer. Now you want the world to see it. Heroku is a platform that takes your code and puts it on the internet — no server setup, no Linux commands, no firewall rules.

What Heroku actually does

You push your code to Heroku with Git, and Heroku does the rest: it detects your language, installs your dependencies, starts your app, and gives you a public URL. Your app runs in a lightweight container called a dyno. You do not manage the machine the dyno runs on.

# Log in once
heroku login

# Create the app
heroku create my-first-app

# Deploy it
git push heroku main

# Open it in the browser
heroku open
Enter fullscreen mode Exit fullscreen mode

Four commands, and your app is live. That is the whole point of Heroku: deployment should not be the hard part.

The three ideas that matter

  1. Dynos — the containers your app runs in. A small app needs one. If traffic grows, you add more.
  2. Add-ons — managed services you attach in one click: a Postgres database, Redis, logging, monitoring. You do not install or maintain any of them.
  3. Config vars — environment variables you set in the dashboard instead of hard-coding secrets in your code.
// Never hard-code secrets. Read them from the environment.
const dbUrl = process.env.DATABASE_URL;
const port = process.env.PORT || 3000;
app.listen(port);
Enter fullscreen mode Exit fullscreen mode

Heroku sets PORT for you, so your app must listen on that value instead of a fixed number. That is the most common beginner mistake — hard-coding port 3000 and wondering why the app crashes on deploy.

When to use Heroku, and when not to

Heroku is great for learning, side projects, MVPs, and small production apps. You pay for simplicity: it costs more than a raw server, but you get your time back. For very large apps, or apps that need unusual infrastructure, a cloud provider like AWS or DigitalOcean gives you more control for less money.

The one thing to remember

Deployment is a skill, and Heroku lets you learn it without learning server administration first. Ship something small today. You can always move it later.

Top comments (0)