Most beginner tutorials end right before the hard part: getting the thing live. Here's the short version of what I'd do for a first Node + Postgres deploy.

  1. Add a /health route first, so you can tell the app is up.
  2. Read all config from environment variables. Commit .env.example, never .env.
  3. Containerize it:

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
CMD ["node","server.js"]

  1. Use a managed Postgres and set DATABASE_URL on your host.
  2. Run CI on every push, and deploy only from main.
  3. Write down your rollback step before you need it.

What part of deploying trips you up most? Tell me in the comments and I'll answer.

I put this into a full handbook with an API checklist, boilerplate snippets, cheat sheets and deployment checklists. It's a founding-member edition, so buyers get updates as it grows: https://modern-full-stack-survival-handbook.whop.site