Project 1 โ€บ 13 Configure env vars on RenderGitHub โ†—
๐Ÿค– AI Prompt โ€” stuck? paste this

โ€œShow me how to set environment variables and secrets in Render's dashboard for my Dockerized service, and how the app reads them.โ€

13 โ€” [Optional] Configure env vars on Render

Category: Hosting & Deploy ยท Priority: Low ยท Optional

Never commit .env to git. Add all required env vars directly in Render's Environment section.

โš ๏ธ OPTIONAL โ€” Only needed if deploying to Render.

๐ŸŽฏ What is this task?

Your app reads config from environment variables (like PORT and NODE_ENV). On your computer these come from .env. On Render, you set them directly in their dashboard โ€” never by uploading your .env file.

๐Ÿ“‹ Step-by-step

Step 1 โ€” Go to your Render service dashboard

Click on your Web Service โ†’ click the "Environment" tab in the left sidebar.

Step 2 โ€” Add each variable

Click "Add Environment Variable" for each one:

KeyValue
PORT3000
NODE_ENVproduction

If you added Postgres later, also add DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD.

Step 3 โ€” Save and redeploy

After adding all variables, click "Save Changes". Render will automatically trigger a new deployment.

โœ… Done when

  • All environment variables are set in the Render dashboard
  • No .env file was ever committed to GitHub
  • Render redeploys successfully after saving env vars

๐Ÿ“ Quiz

Answer all 1 questions correctly to complete this lesson.

1. Where do you set production secrets on Render?
โ† PreviousPass the quiz to completeNext โ†’