Back to Blog
Tutorial6 min read2025-02-01

How to Deploy a Node.js App for Free in 2025

Step-by-step guide to deploying a Node.js application completely free using PandaStack — including containers, environment variables, and a custom domain.

Deploying Node.js for Free in 2025

The death of Heroku's free tier sent shockwaves through the developer community. But in 2025, there are still excellent options for hosting Node.js applications without spending a dime — and PandaStack leads the pack with the most generous free tier available.

In this guide, you'll deploy a production-ready Node.js app with a connected database, environment variables, and a custom domain — all for free.

Prerequisites

  • A Node.js application (we'll use a simple Express API)
  • A GitHub account
  • A PandaStack account (free at [dashboard.pandastack.io](https://dashboard.pandastack.io))

Step 1: Prepare Your Node.js App

Make sure your package.json has a start script:

{
  "scripts": {
    "start": "node index.js",
    "build": "npm install"
  }
}

Your app should listen on the port provided by the PORT environment variable:

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});

Step 2: Add a Dockerfile (Optional but Recommended)

PandaStack supports both buildpack detection and Docker containers. For Node.js, you can use auto-detection, but a Dockerfile gives you more control:

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

Step 3: Push to GitHub

git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/yourusername/your-app
git push -u origin main

Step 4: Create a New Project on PandaStack

  1. 1Go to [dashboard.pandastack.io](https://dashboard.pandastack.io) and sign up free
  2. 2Click New ProjectImport from GitHub
  3. 3Authorize PandaStack to access your repositories
  4. 4Select your Node.js repo
  5. 5PandaStack will auto-detect it as a Node.js application

Step 5: Configure Environment Variables

In the PandaStack dashboard:

  1. 1Go to your project → SettingsEnvironment Variables
  2. 2Add your variables:

- NODE_ENV=production

- DATABASE_URL=... (from your managed database)

- Any API keys your app needs

PandaStack encrypts all environment variables at rest. You can also set environment-specific variables (development vs production).

Step 6: Connect a Free Database

On the free tier, you get one managed database:

  1. 1Go to Databases in the sidebar
  2. 2Click Create Database → Choose PostgreSQL, MySQL, or MongoDB
  3. 3Give it a name and click Create
  4. 4Copy the DATABASE_URL connection string
  5. 5Add it as an environment variable in your project

PandaStack automatically handles database backups, SSL certificates, and connection pooling.

Step 7: Deploy

Click Deploy and watch your app go live. PandaStack will:

  1. 1Clone your repository
  2. 2Build the Docker image (or use buildpacks)
  3. 3Run health checks
  4. 4Assign a free *.pandastack.app subdomain
  5. 5Provision SSL certificate automatically

The first deploy typically takes 2-3 minutes. Subsequent deploys average 45 seconds.

Step 8: Add a Custom Domain

  1. 1Go to your project → SettingsDomains
  2. 2Click Add Domain
  3. 3Enter your domain name (e.g., api.myapp.com)
  4. 4Add the CNAME record shown to your DNS provider
  5. 5PandaStack will automatically provision an SSL certificate via Let's Encrypt

Step 9: Enable Auto-Deploy

By default, every push to your main branch triggers a new deployment. You can configure this under SettingsCI/CD:

  • Auto-deploy branch: main
  • Deploy on push: Enabled
  • Build command: npm run build
  • Health check path: /health

You can also set up deploy previews for pull requests — each PR gets a unique URL for testing.

What's Included on the Free Tier

ResourceFree Tier
Apps/Services2
Database1 (PostgreSQL/MySQL/MongoDB)
Storage1GB
Bandwidth10GB/month
Custom Domains2
SSL Certificates✅ Automatic
CI/CD✅ Included

Common Issues and Fixes

App crashes on startup: Check that you're reading PORT from process.env.PORT.

Build fails: Check the build logs in the PandaStack dashboard. Common issues are missing dependencies or wrong Node.js version. Set engines.node in package.json to specify your required version.

Database connection fails: Make sure DATABASE_URL is set in environment variables and that your app uses SSL for database connections in production.

Next Steps

Once your app is running, explore PandaStack's other features:

  • Monitoring: Set up uptime alerts so you know the moment your app goes down
  • Rollbacks: One-click rollback to any previous deployment
  • Logs: Streaming logs and log retention
  • Scaling: Upgrade to a paid plan for more resources

[Deploy your Node.js app free on PandaStack →](https://dashboard.pandastack.io)

Ready to deploy?

Start free on PandaStack — no credit card required.

Start free on PandaStack

More in Tutorial

Browse all Tutorial articles →

See also