Deploy a Node.js App on Render — Free, Fast, and Simple (2026)
Deploy a Node.js App on Render — Fast & Free
Prep your Node app
Make sure your app listens on process.env.PORT and has a start script in package.json.
// example: src/index.js
const express = require('express');
const app = express();
app.get('/', (req,res) => res.send('Hello from Render!'));
const PORT = process.env.PORT || 3000;
app.listen(PORT, ()=> console.log('Listening on', PORT));
Method A — Connect Git repo to Render
- Push your repo to GitHub.
- Create a new Web Service on Render → connect your GitHub repo.
- Choose branch, set Build Command (e.g.
npm ci && npm run build) and Start Command (e.g.npm start). - Render auto-builds and gives you a URL (https://your-app.onrender.com).
Tip: Add a
render.yaml if you want reproducible infra-as-code.Method B — Docker (if your app needs it)
# Dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
EXPOSE 3000
CMD ["node","src/index.js"]
Push image to Docker Hub / registry, then create a Web Service in Render using the image URL.
Testing & environment variables
- Use Render dashboard → Environment → Add secret keys (DB_URL, API_KEY).
- Open the public URL and confirm startup logs in Render dashboard.
- Use curl or Postman to test endpoints.
Comments
Post a Comment