<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmet Arslan</title>
    <description>The latest articles on DEV Community by Ahmet Arslan (@ahmet_arslan_9f071826c3ba).</description>
    <link>https://dev.to/ahmet_arslan_9f071826c3ba</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4058988%2F2b4e2faa-c436-44c2-a64d-6695ebd818e0.png</url>
      <title>DEV Community: Ahmet Arslan</title>
      <link>https://dev.to/ahmet_arslan_9f071826c3ba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmet_arslan_9f071826c3ba"/>
    <language>en</language>
    <item>
      <title>From Vercel to a €40 Hetzner box: serving 1M+ Next.js ISR pages without melting the disk</title>
      <dc:creator>Ahmet Arslan</dc:creator>
      <pubDate>Sun, 02 Aug 2026 11:05:04 +0000</pubDate>
      <link>https://dev.to/ahmet_arslan_9f071826c3ba/from-vercel-to-a-eu40-hetzner-box-serving-1m-nextjs-isr-pages-without-melting-the-disk-10b9</link>
      <guid>https://dev.to/ahmet_arslan_9f071826c3ba/from-vercel-to-a-eu40-hetzner-box-serving-1m-nextjs-isr-pages-without-melting-the-disk-10b9</guid>
      <description>&lt;p&gt;We run &lt;a href="https://www.hizmetgo.app" rel="noopener noreferrer"&gt;Hizmetgo&lt;/a&gt;, a Turkish local-services marketplace (think Thumbtack for Türkiye). The site is programmatic-SEO heavy: ~1M+ Next.js ISR pages across 81 provinces, 970+ districts and thousands of service categories. Here's the infrastructure story of how we left Vercel, moved to a single Hetzner VPS, hit a disk-full crash at 3am, and fixed it with an in-memory cache handler.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why we left Vercel
&lt;/h2&gt;

&lt;p&gt;Vercel was excellent for shipping fast, but at our page volume the ISR invocation + bandwidth bill climbed past what a bootstrapped startup wanted to pay (~$150/mo trending up). We wanted predictable cost and control, so we moved to a Hetzner VPS with &lt;strong&gt;Coolify&lt;/strong&gt; (an open-source, self-hosted Vercel/Heroku alternative) for git-push auto-deploys, with &lt;strong&gt;Cloudflare&lt;/strong&gt; in front for caching and TLS.&lt;/p&gt;

&lt;p&gt;The migration itself was smooth: Coolify builds the Next.js app (Turbopack), a webhook auto-deploys on every push to &lt;code&gt;main&lt;/code&gt;, and Cloudflare's "Cache Everything" absorbs the bot storm on our SEO pages.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 3am disk-full crash
&lt;/h2&gt;

&lt;p&gt;A few days in, the container started crashing. &lt;code&gt;df -h&lt;/code&gt; showed the disk at 100%. The culprit was subtle: Next.js &lt;strong&gt;ISR writes each rendered page to the filesystem cache&lt;/strong&gt; — and with ~1M crawlable pages, Googlebot plus our own crawl was generating ~145GB/day of cache files &lt;strong&gt;inside the running container's writable layer&lt;/strong&gt;. &lt;code&gt;docker system prune&lt;/code&gt; couldn't reclaim it (the files belong to the &lt;em&gt;running&lt;/em&gt; container, not a stopped one), so the disk just filled until the box fell over.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: an in-memory cache handler
&lt;/h2&gt;

&lt;p&gt;Next.js lets you swap the ISR cache backend via &lt;code&gt;cacheHandler&lt;/code&gt; in &lt;code&gt;next.config&lt;/code&gt;. We pointed it at a small in-memory handler so the cache lives in &lt;strong&gt;bounded RAM&lt;/strong&gt; instead of unbounded disk:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cache-handler.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// swap for lru-cache in prod to bound memory&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CacheHandler&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lastModified&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;revalidateTag&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* clear by tag */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// next.config.js&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;cacheHandler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./cache-handler.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;cacheMaxMemorySize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// disable the default in-process cache; we manage it&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plus a &lt;code&gt;COPY cache-handler.js&lt;/code&gt; line in the Dockerfile so it ships with the standalone build. Result: even if all 1M pages get crawled in a day, the disk never fills — the cache is capped in memory, and Cloudflare handles the long-tail hit rate at the edge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other things that helped
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare edge caching&lt;/strong&gt; on the SEO path so cold long-tail TTFB stays sane.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prisma&lt;/strong&gt; &lt;code&gt;connection_limit&lt;/code&gt; tuned down for a single VPS (vs serverless fan-out) so we don't exhaust the Postgres (Supabase) pool.&lt;/li&gt;
&lt;li&gt;A dedicated read path for SEO pages so a crawl wave can't starve auth.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're self-hosting a large ISR Next.js site, watch the cache write path before it watches you. Our data pages (e.g. the &lt;a href="https://www.hizmetgo.app/fiyat-endeksi" rel="noopener noreferrer"&gt;Türkiye service price index&lt;/a&gt;) are all served this way now — 1M pages, one modest box.&lt;/p&gt;




&lt;p&gt;Stack: Next.js 16 · Prisma · Supabase (Postgres) · Expo (mobile) · Cloudflare · Hetzner + Coolify · Turbopack.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>devops</category>
      <category>selfhosting</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
