Self-Host Next.js on a $6 Droplet vs. Serverless — The Honest Breakdown
Disclosure: Some links in this guide are affiliate links. If you sign up for DigitalOcean through them, ToolsHubKit earns a small commission — at no cost to you.
Next.js runs in two fundamentally different models: always-on VPS (you rent a server, it runs 24/7) and serverless/edge (functions spin up per-request, you pay only for compute consumed). Neither is universally better. The right choice depends on your traffic pattern, budget, and operational preferences.
This guide gives you:
- A working Next.js deploy on a $6 DigitalOcean Droplet with PM2 and Nginx
- A fair comparison of costs at 0, 10k, and 100k requests/month
- A decision matrix so you can pick the right model for your project
The Two Models
Always-on VPS (self-hosted on DigitalOcean)
You provision a server, deploy Next.js, and the Node.js process runs continuously. Requests are handled by the running process with no startup latency.
Key characteristics:
- Fixed monthly cost regardless of traffic
- Zero cold starts — the process is always warm
- Full control over Node.js version, environment, caching
- You manage OS updates, disk, monitoring
- Background jobs and long-running operations work natively
Serverless / Edge (Vercel, Netlify, Cloudflare Pages)
Functions spin up on demand, run for the duration of the request, and shut down. Static assets are served from a CDN edge.
Key characteristics:
- Cost scales with usage (can be free at low traffic)
- Cold start latency on first invocation (50–500ms depending on runtime)
- Zero infrastructure management
- Limits on function execution time, bundle size, and memory
- Background jobs require external services (Inngest, Trigger.dev, Upstash QStash)
Deploying Next.js on a $6 DigitalOcean Droplet
The $6 Basic Droplet (1 vCPU, 1 GB RAM, 25 GB SSD) handles small to medium Next.js apps comfortably. Create your Droplet here — new accounts get $200 in free credits.
1. Provision the Droplet
Create a new Droplet:
- Image: Ubuntu 24.04 LTS
- Size: Basic $6/mo (1 GB RAM, 1 vCPU)
- Authentication: SSH key (no password auth)
- Region: Closest to your users
SSH in after creation:
ssh root@YOUR_DROPLET_IP
2. Server setup
Create a deploy user and install Node.js:
# Create deploy user
adduser deploy && usermod -aG sudo deploy
rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy
# Disable root login
sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
systemctl reload sshd
# Install Node.js 22 LTS via NodeSource
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
apt-get install -y nodejs
# Install PM2 globally
npm install -g pm2
# Configure firewall
ufw allow OpenSSH && ufw allow 80 && ufw allow 443 && ufw enable
3. Build with standalone output
Next.js's standalone output copies only the required files and dependencies into .next/standalone, dramatically reducing the deployment footprint (no full node_modules on the server).
In next.config.js (or next.config.ts):
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
};
module.exports = nextConfig;
Build locally and transfer:
# Local
npm run build
rsync -avz .next/standalone/ deploy@YOUR_DROPLET_IP:/opt/myapp/
rsync -avz .next/static/ deploy@YOUR_DROPLET_IP:/opt/myapp/.next/static/
rsync -avz public/ deploy@YOUR_DROPLET_IP:/opt/myapp/public/
4. Run with PM2
On the server:
cd /opt/myapp
pm2 start server.js --name myapp -i 1 \
--env production \
-- --hostname 127.0.0.1 --port 3000
pm2 save
pm2 startup # generates the systemd unit to auto-start PM2 on boot
The server.js file is in .next/standalone/ — it's the minimal Next.js production server.
Use pm2 logs myapp to tail logs and pm2 monit for real-time CPU/memory.
5. Nginx reverse proxy + HTTPS
apt install -y nginx certbot python3-certbot-nginx
/etc/nginx/sites-available/myapp:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
# Serve Next.js static assets directly — bypasses Node.js entirely
location /_next/static/ {
alias /opt/myapp/.next/static/;
expires 1y;
add_header Cache-Control "public, immutable";
}
location /public/ {
alias /opt/myapp/public/;
expires 1y;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
certbot --nginx -d yourdomain.com -d www.yourdomain.com
Your Next.js app is now live with HTTPS.
Cost Comparison
At 0 requests/month (idle project, staging environment)
| Platform | Cost |
|---|---|
| DigitalOcean $6 Droplet | $6/mo |
| Vercel Free (Hobby) | $0 |
| Vercel Pro | $20/mo |
Vercel Hobby wins for dormant projects and personal apps.
At 10,000 requests/month
Assuming a typical Next.js app: ~40% SSR routes averaging 200ms, ~60% static or cached, responses averaging 50 KB.
| Platform | Estimated cost |
|---|---|
| DigitalOcean $6 Droplet | $6/mo (idle headroom — 10k req/mo is light) |
| Vercel Pro | $20/mo (base) + usage within included limits |
| Vercel Hobby | $0, but no SLA, no team features, no analytics |
At 10k requests, both serverless options are either free or $20+. The Droplet wins on cost if you need features that require the Pro plan (no build time limits, password protection, team access).
At 100,000 requests/month
| Platform | Estimated cost |
|---|---|
| DigitalOcean 2 GB Droplet | ~$12–18/mo (with Nginx static asset caching, the Node process rarely spikes) |
| Vercel Pro | $20/mo + potential usage overages on serverless function invocations |
| Self-managed with CDN | $6–12/mo Droplet + ~$0–5 CDN egress |
At 100k requests, the Droplet becomes clearly cheaper — but the management overhead cost is real.
Cold Starts, Background Jobs, and Long-Running Work
Cold starts
On a VPS, there are no cold starts. The Node.js process is always running, so the first request to your server has the same latency as the thousandth.
On Vercel's serverless runtime, cold starts range from 50ms to 300ms for typical Next.js functions. With Edge Runtime they're sub-50ms. Cold starts matter for latency-sensitive pages (checkout, search) — for a marketing site, they're invisible.
Background jobs
This is the biggest gap. On a VPS, you can run Node.js child processes, cron jobs, long-polling loops, and WebSocket servers natively.
On serverless, function execution is time-limited (Vercel Pro allows 300s max on Serverless, 30s on Edge). Long-running jobs — video processing, report generation, bulk data operations — need an external job queue service. This adds complexity and cost.
Verdict on background jobs: VPS wins if you have any meaningful background processing. Serverless requires architectural changes.
Long-running connections (WebSockets, SSE)
WebSockets and Server-Sent Events work natively on a VPS. On Vercel, you need an external service (Ably, Pusher, Liveblocks) because serverless functions can't hold persistent connections.
When Self-Hosting Wins
Choose a DigitalOcean Droplet when:
- Your traffic is predictable and moderate (fixed cost beats per-request billing)
- You need background jobs, cron tasks, or long-running processes
- You care deeply about privacy — your data never leaves your server
- You're running multiple projects on one server (Nginx can route to many Node.js apps)
- You need WebSocket or SSE support without a third-party service
ToolsHubKit's own angle: All tools run client-side for privacy reasons. The server only serves static assets and SSR-rendered metadata. A $6 Droplet handles that workload effortlessly at a fraction of the cost of managed hosting.
When Serverless Wins
Choose Vercel/Netlify when:
- You want zero ops overhead and don't want to think about servers
- Your traffic is spiky (scales to zero between spikes, scales up for bursts without provisioning)
- You need Vercel-specific features (ISR with revalidation, Edge Middleware, Image Optimization)
- You're a team and need branch previews and deploy comments
Recommendation Matrix
| Project type | Recommended |
|---|---|
| Personal portfolio / blog | Vercel Hobby (free) |
| Startup MVP, early stage | Vercel Pro (no ops overhead) |
| Established SaaS with predictable traffic | DigitalOcean Droplet ($6–24/mo) |
| App with background jobs or WebSockets | DigitalOcean Droplet |
| Privacy-first app (data stays on your server) | DigitalOcean Droplet |
| Global CDN-heavy content site | Vercel or Cloudflare Pages |
| Multiple apps on one server | DigitalOcean Droplet (Nginx multi-app) |
Related Guides
- Running a JVM app on a Droplet instead? → — the Spring Boot guide covers the same VPS approach end-to-end: systemd instead of PM2, but the same Nginx + Certbot setup. Good reference for the operational layer.
- Prefer a container-first workflow? → — the Laravel Docker guide covers multi-stage builds and App Platform deploys. The Dockerfile patterns apply equally to a Next.js standalone image.
Resources
| Resource | Link |
|---|---|
| Start with $200 free DigitalOcean credits | Claim credits → |
| Build cron expressions for your scheduled jobs | Cron Generator |
| Generate Dockerfiles for containerized Next.js | Dockerfile Generator |
| Next.js standalone output docs | https://nextjs.org/docs/app/api-reference/next-config-js/output |
| PM2 documentation | https://pm2.keymetrics.io/docs/ |