Migrating from Vercel/Netlify to your own VPS: NextJS standalone

calendar_month May 08, 2026 schedule 7 min read visibility 15 views
person
Valebyte Team
Migrating from Vercel/Netlify to your own VPS: NextJS standalone

To migrate from Vercel to your own VPS, it is optimal to use NextJS standalone mode, which allows you to pack the application into a lightweight Docker container and run it on a server costing from $10-20 per month, completely eliminating overpayments for Edge Functions, bandwidth, and image optimization.

Migration Economics: Why a Vercel alternative VPS is becoming a necessity

Vercel and Netlify are magnificent tools for a quick start, but their business model is built on a "success tax." As soon as your project starts generating significant traffic or actively using server functions, the bills grow exponentially. The main reason to look for a vercel alternative vps is the non-transparent pricing beyond the Pro plan limits.

A typical case: a NextJS project with 500,000 unique visitors per month. On Vercel, you will start paying not only $20 per developer but also for exceeding limits on the following items:

  • Bandwidth: $40 for every additional 100 GB. On your own VPS, traffic is often either unlimited or costs 10-20 times less.
  • Edge Functions: Payment for execution time and number of calls. Complex logic in Middleware can raise the bill by $200-500 per month.
  • Image Optimization: $5 for every 1000 additional optimized images.
Parameter Vercel (Pro + Overages) Valebyte VPS (High Frequency) Savings
Resource Cost $200 - $1500+ $20 - $80 up to 95%
Bandwidth $40 / 100GB 10TB included ($0.01/GB overage) 40 times cheaper
CPU / RAM Shared (limited) Dedicated cores, 8-16GB RAM Full control
Function Timeouts 10-60 seconds No limits Architectural freedom

When you realize you have nothing to pay Vercel for, moving to your own infrastructure becomes a logical step. Using an AWS EC2 alternative for backend in the form of a high-performance VPS allows you not only to save money but also to get predictable Fixed Billing.

Self host NextJS: Understanding standalone mode

The main difficulty that PaaS proponents use to scare users is environment configuration. However, starting from version 12, NextJS supports output: 'standalone' mode. This is a killer feature for those planning to self host nextjs.

In this mode, NextJS automatically collects only the files necessary for production operation, including a minimal version of node_modules. The build result is a single server.js file that replaces the massive project folder. This allows you to reduce the Docker image size from 1.5 GB to 150-200 MB.

How to enable standalone mode

In your next.config.js file, add the following setting:

module.exports = {
  output: 'standalone',
}

After running the next build command, the .next/standalone folder will contain everything needed to start the server. You no longer need to copy the entire source code to the VPS, making the vercel to vps process as clean and professional as possible.

Looking for a reliable server for your projects?

VPS from $10/mo and dedicated servers from $9/mo with NVMe, DDoS protection, and 24/7 support.

View offers →

Vercel to VPS: A step-by-step guide to containerization

For a reliable deployment, it is best to use Docker. This guarantees that the application will work the same on your machine and on the Valebyte server. Below is an optimized Dockerfile for a NextJS application.

FROM node:20-alpine AS base

# Install dependencies
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN npm ci

# Build the project
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

# Final image
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]

This Dockerfile implements a multi-stage build, which is critical for performance. If you are looking for a DigitalOcean alternative, pay attention to our plans with NVMe drives — the image build speed on them will be 2-3 times higher due to the absence of strict IOPS limits.

Docker Compose Configuration

To manage the container and associated services (e.g., Redis for ISR caching), use docker-compose.yml:

version: '3.8'
services:
  nextjs:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=${DATABASE_URL}
      - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
    restart: always

When there's nothing to pay Vercel for: Setting up the server environment

Once the container is ready, you need to configure the frontend part: the web server, SSL certificates, and protection against attacks. In Vercel, this is "magic" under the hood; on a VPS, it's 10 minutes of Nginx configuration.

Installing Nginx as a Reverse Proxy

Nginx will accept requests on ports 80/443 and forward them to your Docker container. Configuration example:

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

To automate obtaining SSL certificates, use Certbot. It's free and updates automatically, unlike the paid options from some providers. If you are planning a large-scale move, check out our guide: moving from AWS Lightsail/EC2 to dedicated, which details the nuances of setting up the network stack for high loads.

Netlify alternative: Hosting statics and SSR on your own hardware

Many choose Netlify for its convenience with static files (SSG). However, NextJS on a VPS handles this perfectly as well. When using next export, you get a set of HTML/CSS/JS files that Nginx can serve at incredible speeds without the involvement of a Node.js process.

Advantages of VPS as a netlify alternative:

  1. No limits on forms: On Netlify, forms are paid after 100 submissions. On your own server, you can set up a simple microservice in Go or Python.
  2. Custom Headers: Full control over Cache-Control, Security Headers, and CORS without editing the platform's YAML configs.
  3. DB Proximity: If your database is in the same data center (for example, at Valebyte), the latency during SSR will be <1ms, whereas Vercel functions might be in a different region.

For those accustomed to Managed solutions, there is a Managed hosting alternative that combines the convenience of a control panel with the low cost of server rental.

Security and Scaling: Cloudflare Tunnel and Load Balancing

When switching to a vercel alternative vps, it's important not to forget about security. In PaaS solutions, you are protected by their infrastructure. On your own server, you are in control.

Cloudflare Tunnel: Hiding the server from prying eyes

Instead of opening ports 80 and 443 to the whole world, you can use cloudflared. This creates a tunnel between your VPS and the Cloudflare network. Pros:

  • The server does not have a public IP accessible to port scanners.
  • Free DDoS protection.
  • Automatic SSL "out of the box."

Scaling NextJS applications

If one server becomes insufficient, NextJS standalone allows for easy horizontal scaling. You can run 5 identical VPS and place a Load Balancer in front of them. Since sessions in NextJS are usually stored in JWT or an external Redis, there will be no state issues.

Deployment Automation: CI/CD without extra costs

The main argument against VPS is "on Vercel, I just do a git push." On your own server, you can set up a similar process in 15 minutes using GitHub Actions.

Example workflow for automatic deployment:

name: Deploy to VPS
on:
  push:
    branches: [ main ]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Build and push Docker image
        run: |
          docker build -t my-next-app .
          docker save my-next-app | ssh user@vps "docker load"
      - name: Restart container
        run: |
          ssh user@vps "docker-compose up -d"

This approach ensures Zero Downtime Deployment. While the new container is being built and started, the old one continues to serve traffic. This makes self host nextjs just as convenient as using expensive cloud platforms.

Performance Optimization: Caching and Sharp

One of Vercel's hidden costs is Image Optimization. On your own VPS, you need to ensure that the sharp library is installed correctly. NextJS uses it to compress images on the fly.

The Dockerfile must have sharp installed to avoid using the slow JS fallback solution. This allows you to process thousands of images per second, loading your server's CPU instead of your wallet.

It is also important to configure caching for ISR (Incremental Static Regeneration). By default, NextJS stores the cache in the file system. In a distributed environment, it's better to use a plugin for Redis so that all application instances see the current page cache.

Conclusion

Switching from Vercel or Netlify to your own VPS is a mature decision for a project that has moved past the MVP stage, allowing you to reduce hosting costs by 10-15 times. For a successful migration, it is enough to use NextJS in standalone mode, pack it into Docker, and set up automatic deployment via GitHub Actions to reliable Valebyte servers.

Ready to choose a server?

VPS and dedicated servers in 72+ countries with instant activation and full root access.

Start Now →

Share this post:

support_agent
Valebyte Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.