# Deploying on Render or Railway

> Deploy long-running Node.js servers, background workers and PostgreSQL on a platform-as-a-service from a Git repo or Dockerfile. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/full-stack/render
Last updated: 2026-11-28

Deploy long-running Node.js servers, background workers and PostgreSQL on a platform-as-a-service from a Git repo or Dockerfile.

Intermediate · about 3 hours · difficulty 2/5

Learn first: [Environments, Config and Secrets](https://www.internhack.in/roadmaps/tracks/full-stack/environment-and-config), [Node.js Runtime Essentials](https://www.internhack.in/roadmaps/tracks/full-stack/nodejs-runtime)

Platforms like **Render** and Railway run your app as a long-lived server process rather than serverless functions. This suits Express or Fastify APIs, WebSockets and background workers.

### What you deploy

- A **web service** from a Git repo (build and start commands) or a Dockerfile.
- A **background worker** for queues and scheduled jobs.
- A **managed PostgreSQL** and Redis instance in the same region.
- **Cron jobs** for periodic tasks like sending deadline reminders.

### Doing it properly

- Bind to the PORT environment variable provided by the platform.
- Add a **health check** endpoint so the platform knows when your app is ready.
- Run migrations in a pre-deploy command.
- Use an infrastructure file (render.yaml) to describe services in code.

### Trade-offs

Long-running servers have no cold-start function limits and can hold WebSocket connections. Free tiers often sleep after inactivity, so the first request is slow; paid instances stay warm. Choose a region close to your users (Singapore or Mumbai where available).

### Pitfalls

- Hard-coding port 3000.
- Running the free sleeping tier for a demo you show to recruiters without warming it first.
- Storing uploaded files on the server's local disk, which is lost on redeploy.

You are ready to move on when your Express or Fastify API, a worker and PostgreSQL are deployed from Git with health checks, pre-deploy migrations and environment-specific config.

## Key concepts

- **Web services from Git or Docker**
- **Background workers**
- **Managed PostgreSQL and Redis**
- **Health checks**
- **Pre-deploy migrations**
- **Infrastructure as code (render.yaml)**
- **Railway or Fly.io**

## Other options for this step

- [Deploying on Vercel](https://www.internhack.in/roadmaps/tracks/full-stack/vercel): Deploy a Next.js app with Git-based deploys, preview URLs per pull request, environment variables and edge caching.

## Mini project

Deploy your Express or Fastify API with a background worker and managed PostgreSQL on Render, using a health check endpoint, pre-deploy migrations and a render.yaml blueprint.

## Check yourself

Why would you lose student resume uploads after a redeploy if you saved them to the server's disk, and where should they go instead?

## Free resources

- [Render Documentation](https://render.com/docs) (Render)
- [Railway Docs](https://docs.railway.com/) (Railway)
- [Fly.io Docs](https://fly.io/docs/) (Fly.io)

Previous: [Deploying on Vercel](https://www.internhack.in/roadmaps/tracks/full-stack/vercel) · Next: [Managed Databases, Domains and HTTPS](https://www.internhack.in/roadmaps/tracks/full-stack/managed-postgres-and-domains)

## More in Configuration, Containers and Deployment

- [Environments, Config and Secrets](https://www.internhack.in/roadmaps/tracks/full-stack/environment-and-config)
- [Docker for Full-Stack Apps](https://www.internhack.in/roadmaps/tracks/full-stack/docker)
- [Deploying on Vercel](https://www.internhack.in/roadmaps/tracks/full-stack/vercel)
- [Deploying on Render or Railway](https://www.internhack.in/roadmaps/tracks/full-stack/render)
- [Managed Databases, Domains and HTTPS](https://www.internhack.in/roadmaps/tracks/full-stack/managed-postgres-and-domains)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Full-Stack Developer Roadmap](https://www.internhack.in/roadmaps/tracks/full-stack)
