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 mainStep 4: Create a New Project on PandaStack
- 1Go to [dashboard.pandastack.io](https://dashboard.pandastack.io) and sign up free
- 2Click New Project → Import from GitHub
- 3Authorize PandaStack to access your repositories
- 4Select your Node.js repo
- 5PandaStack will auto-detect it as a Node.js application
Step 5: Configure Environment Variables
In the PandaStack dashboard:
- 1Go to your project → Settings → Environment Variables
- 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:
- 1Go to Databases in the sidebar
- 2Click Create Database → Choose PostgreSQL, MySQL, or MongoDB
- 3Give it a name and click Create
- 4Copy the
DATABASE_URLconnection string - 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:
- 1Clone your repository
- 2Build the Docker image (or use buildpacks)
- 3Run health checks
- 4Assign a free
*.pandastack.appsubdomain - 5Provision SSL certificate automatically
The first deploy typically takes 2-3 minutes. Subsequent deploys average 45 seconds.
Step 8: Add a Custom Domain
- 1Go to your project → Settings → Domains
- 2Click Add Domain
- 3Enter your domain name (e.g.,
api.myapp.com) - 4Add the CNAME record shown to your DNS provider
- 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 Settings → CI/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
| Resource | Free Tier |
|---|---|
| Apps/Services | 2 |
| Database | 1 (PostgreSQL/MySQL/MongoDB) |
| Storage | 1GB |
| Bandwidth | 10GB/month |
| Custom Domains | 2 |
| 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)