Skip to main content
Next.js

Why Self-Host Next.js Apps?

Self-hosting modern Next.js apps is the most cost-effective and powerful way to create interactive, rich, and powerful apps.

Ruslan Gainutdinov

There are many ways to run your Next.js apps, and the most important and primary one is, of course, from the creators of Next.js, hosting it at Vercel. Running your prototype or newly created app with Vercel is very straightforward, but when you run it in production, costs and complexity quickly escalate.

For starters, the Hobby plan does not allow you to run commercial apps, and the Pro plan starts from $20/month per user. If you exceed execution or bandwidth limits, it can easily cost $60+ per month.

Vercel pricing

Serverless

Vercel advocates and implements a so-called serverless way of running Next.js apps. In practice, it means that frontend code after the build is cached globally, and backend is packaged to quickly scale as needed and run where it is close to the users (so-called edge computing).

While certainly this brings speed improvements to the properly written apps, in practice, most of the businesses, except truly global ones, do not need edge presence and can decide on one specific region where they can host their apps

But this comes at a significant cost & complexity of the app - it is challenging to run specific workloads on this infrastructure, the execution times and available memory are limited, forcing you to rely on external services or even additional backend for more feature support.

Other serverless providers

Thanks to the OpenNext initiative, other providers can also deploy your app as serverless:

However, they also suffer from the same or similar problems as Vercel. The execution is limited, and the configuration and deployment are complex.

All these serverless services exhibit the same scaling issues and yoi can get a surprise $1000+ bill because of thousands or millions of unanticipated requests, configuration error or some rogue AI bots.

Examples of surprise bills

Comparing serverless to self-hosting

Compared to serverless and self-hosting, it is a bit more complicated at the start, and has a flat pricing of renting the server from a cloud provider. In return, it gives you a fully functional platform to scale your app and run different workloads.

Feature Self-hosting Serverless (Vercel)
Next.js Support ✅ Official ✅ Vercel-first
Cold Start Performance ✅ Instant response times ✅ Instant response times
Scaling Speed 🔴 Minutes to hours 🟢 Milliseconds
Self-healing ❌ Manual recovery ✅ Built-in fault tolerance
Infrastructure Setup 🟢 Simple configuration 🔴 Complex architecture (for bigger apps)
Day-to-day Management 🟡 Minimal maintenance 🔴 Ongoing complexity
Traffic limit 🟢 1Tb-10Tb ⚠️ 100Gb - 1Tb (Vercel)
Code & Runtime Limits ✅ No restrictions ❌ Max 250Mb of code
Backend response limit ✅ No restrictions ❌ Max 4.5 Mb
API response time limit ✅ No restrictions ❌ 60s (Free) / 300s (Pro)
Multi-cloud Flexibility ✅ Deploy anywhere ❌ Vendor lock-in
Unexpected Bills 🟢 Predictable costs 🔴 Surprise charges
Resource Efficiency 🟢 Cost-effective at scale 🔴 Expensive per unit
Payment Model ❌ Pay for reserved capacity ✅ Pay per actual use
Capacity Planning ❌ Requires estimation ✅ No planning needed
True Zero Cost ❌ Always paying for servers ✅ Minimal cost when idle
Per-Developer costs 🟢 Cheap ❌ Can quickly escalate ($19/user)

Why self-hosting?

Here are some benefits to self-hosting Next.js, compared to using serverless. They are more important as your app becomes more complex, with more features and backend functionality.

Hard-capped pricing

Yes, if you get hit by the traffic or a wrongly written AI bot, your server will stop working, without costing you a thousand-dollar bill. And many traditional PaaS providers like Hetzner and Digital Ocean have much more generous traffic limits, in terabytes, not gigabytes.

Artificial Intelligence Fuels Rise of Hard-to-Detect Bots That Now Make up More Than Half of Global Internet Traffic, According to the 2025 Imperva Bad Bot Report | Business Wire
Thales, the leading global technology and security provider, today announced the release of the 2025 Imperva Bad Bot Report, a global analysis of automated bot traffic across the internet. This year’s report, the 12th annual research study, reveals that generative artificial intelligence (AI) is revolutionizing the development of bots, allowing less sophisticated actors to launch a higher volume of bot attacks with increased frequency. Today’s attackers are also leveraging AI to scrutinize their unsuccessful attempts and refine techniques to evade security measures with heightened efficiency, amidst a growing Bots-As-A-Service (BaaS) ecosystem of commercialized bot services. This press release features multimedia. View the full release here: https://www.businesswire.com/news/home/20250415432215/en/ ©Thales Automated bot traffic surpassed human-generated traffic for the first time in a decade, constituting 51% of all web traffic in 2024. This shift is largely attributed to the rise of A

Bigger traffic limits

Traffic limits comparison

Provider Free Tier Paid Plans Overage Charges Notes
Vercel 100 GB/mo Pro: $20/mo (included usage)
Enterprise: Custom
Starting at $0.15/GB $550/TB traffic pricing - very expensive at scale, risk of surprise bills, settings to limit costs
Cloudflare Pages Unlimited bandwidth Pro: $20/mo
Business: $200/mo
No bandwidth charges Unlimited but you need to use their CDN for video / large files
DigitalOcean droplets 500 GB - 1 TB free tier 1TB - 10TB depends on VPS size $0.01/GiB overage Generous bandwidth and cheap pay per use.
Netlify 100 GB/mo Starter: $19/mo (400GB)
Pro: $99/mo (1TB)
$0.55/GiB Risk of surprise bills, very expensive traffic
Hetzner Cloud 1TB minimum €4.51/mo VM
(~20TB traffic included)
$0.0012/Gib after limit 88% bandwidth reduction in US

No execution time or memory limits

When you run your app on the server, there are no inherent limits set by the framework. You can limit your execution yourself, or memory is limited only by the amount of RAM on your host, or how much you allocated memory to your app.

Also, response limit payload from the backend is not limited, as opposed to Vercel, where it is max 4.5Mb

How to allocate more memory to your app
JavaScript applications can run into memory-related issues as they scale, and understanding how to manage memory effectively is crucial for building robust applications. One of the most important concepts in Node.js memory management is the max-old-space-size parameter, which directly impacts how your application handles memory allocation. What is max-old-space-size?

Scheduled tasks support

You don't need to use an external service for task scheduling - use the cron format and ping your backend endpoint to execute the cron job.

These cron jobs can be as long running as you want, as opposed to max 60s on Hobby plan and 300s on Pro plan.

Websocket and SSE support

Websocket or SSE (server-side events) is a popular way to add interactivity to your app, for example, for AI chat, or other.

When you self-host, you don't need to do anything special (besides configuring Nginx or over a reverse proxy properly). In Vercel, you need special configuration or use a third-party, and it is not possible on CloudFlare, except using a third-party like Pusher or similar.

Queues and background jobs

You can't run background jobs in Vercel or a serverless platform, and you are forced to use a third-party service like Trigger.dev to do that.

When self-hosting, you can implement that using BullMQ Node.js library and Redis for powerful, full-featured background jobs processing.

PDF generation

Because of memory and time constraints, it can be difficult to generate a PDF on the backend. One common way to do it is to run Puppeteer on the server, but this is impossible in serverless.

If you self-host, you can just run this normally, as regular code, just make sure you have all dependencies installed.

Screenshot or website scraping

This also cannot be run with serverless or Vercel platforms, because it also requires Puppeteer or Playwright on the server, which runs Chrome (or other) browser internally to render the page.

Using a third-party is always an option, but at that moment, your app looks like a patchwork of services, not an independent project.

Running your LLMs

Large language models and your own AI need a lot of memory to run, sometimes also GPU support on the host. This is impossible with Vercel or serverless, but you can use OpenAI/Anthropic/Perplexity or Modal.com APIs.

Conclusion

Using the right tools for self-hosting makes your costs predictable and architecture simpler, as you don't need to rely much on third-party services.

Try using DollarDeploy - it makes deploying Next.js apps easy. And you can choose which hosting provider to use, and with our Digital Ocean and Hetzner integration, it is very easy to create a new server and run your Next.js app on it.

Here in 4 minutes we run our Next.js app on a newly created Hetzner server!

Try DollarDeploy now!