<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AppFinder]]></title><description><![CDATA[Practical notes from building AppFinder (appfinder.tech), a software directory where organic rankings can't be bought: SEO and AI search for makers, launching a]]></description><link>https://appfinder.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6b008a72a987225d8a59568a/f35b0349-6f51-4052-9cde-7be10d3f9a03.png</url><title>AppFinder</title><link>https://appfinder.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 10:24:41 GMT</lastBuildDate><atom:link href="https://appfinder.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Self-hosting Next.js 16: a memory-only ISR cache so bots can't fill the disk]]></title><description><![CDATA[Why a self-hosted Next.js 16 site swapped the filesystem ISR cache for a gzipped, size-capped in-memory LRU, and what that costs.]]></description><link>https://appfinder.hashnode.dev/self-hosting-next-js-16-a-memory-only-isr-cache-so-bots-can-t-fill-the-disk</link><guid isPermaLink="true">https://appfinder.hashnode.dev/self-hosting-next-js-16-a-memory-only-isr-cache-so-bots-can-t-fill-the-disk</guid><category><![CDATA[Next.js]]></category><category><![CDATA["nextjs-16"]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[caching]]></category><category><![CDATA[web performance]]></category><dc:creator><![CDATA[Kunal Siyag]]></dc:creator><pubDate>Fri, 20 Nov 2026 19:01:11 GMT</pubDate><content:encoded><![CDATA[<p>AppFinder is a software directory I run. It's built with Next.js 16 (App Router) and Postgres, and it runs as a single Next.js server on one small VM. Most of its pages hang off open-ended addresses: any <code>/apps/&lt;slug&gt;</code>, any <code>/compare/&lt;a&gt;-vs-&lt;b&gt;</code>, plus alternatives and best-of pages. When I turned on ISR for those pages, the default setup had a failure mode I really didn't want to find out about in production.</p>
<h2>How the pages are built</h2>
<p>Public pages use ISR with an empty <code>generateStaticParams</code>:</p>
<pre><code class="language-ts">export const revalidate = 300;

export function generateStaticParams() {
  return []; // the build has no database: build each page on its first visit
}
</code></pre>
<p>The build has no database, so nothing is pre-rendered. A page gets rendered the first time someone asks for it, then cached, then refreshed in the background at most every five minutes.</p>
<h2>What could go wrong</h2>
<p>When you self-host, Next's default cache writes cached responses to the filesystem. That's fine for a site with a fixed set of pages. On a site where any slug is a valid address to ask for, every URL a crawler or bot requests turns into a cached response, 404s included, and every cached response turns into files on disk. A bot walking through random slugs could fill the disk, and a full disk takes the site down with it.</p>
<p>I'd much rather the worst case be "some older pages fall out of the cache" than "the server stops". So the cache moved into memory, with a hard size limit.</p>
<h2>The handler</h2>
<p>Next lets you swap in your own cache class with the <code>cacheHandler</code> option:</p>
<pre><code class="language-js">// next.config.ts
cacheHandler: path.join(process.cwd(), "src/server/cache/memory-cache-handler.mjs"),
cacheMaxMemorySize: 0, // turn off Next's own in-memory layer: one cache, not two
</code></pre>
<p>The handler itself is about 100 lines of plain JavaScript. It's an <code>.mjs</code> file on purpose, because Next loads it at runtime without transpiling it.</p>
<p>What keeps it small: a JavaScript <code>Map</code> remembers insertion order, so it can double as the LRU list. Reading an entry deletes it and puts it back at the end, which means the least recently used entry is always the first one you hit when you iterate:</p>
<pre><code class="language-js">async get(key) {
  const e = entries.get(key);
  if (!e) return null;
  // …drop it if one of its tags expired after it was stored (below)
  entries.delete(key);
  entries.set(key, e); // most recently used goes to the end
  return { lastModified: e.lastModified, value: deserialize(gunzipSync(e.blob)) };
}

async set(key, data, ctx) {
  remove(key);
  if (data == null) return;
  const blob = gzipSync(serialize(data), { level: 6 });
  if (blob.length &gt; MAX_ENTRY_BYTES) return; // 8 MB: don't cache giants
  entries.set(key, { blob, lastModified: Date.now(), seq: ++seq, tags: tagsOf(data, ctx) });
  totalBytes += blob.length;
  for (const oldest of entries.keys()) {
    if (totalBytes &lt;= MAX_BYTES) break;
    remove(oldest); // evict until under the cap
  }
}
</code></pre>
<p>Serialization is the first thing to get right. Entries go through <code>v8.serialize</code> instead of <code>JSON.stringify</code>, because cached values contain <code>Buffer</code>s and <code>Map</code>s (RSC payloads and segment data) that JSON would mangle. Then they're gzipped. HTML and RSC compress well (the handler assumes roughly 10:1), so the default 192 MB cap holds a few thousand pages, and <code>PAGE_CACHE_MAX_MB</code> changes it.</p>
<p>Invalidation is lazy. <code>revalidateTag</code> doesn't scan the cache; it just records when each tag expired, and <code>get</code> throws away any entry that was stored before one of its tags expired. The tags come from the context Next passes to <code>set</code> and from the <code>x-next-cache-tags</code> header on cached responses.</p>
<p>"Before" is decided by a counter, not a clock. Two events can land in the same millisecond, so <code>Date.now()</code> can't tell a store and an expiry apart, and a sequence number can.</p>
<p>And broken entries just become misses. If an entry can't be decompressed or deserialized, it gets removed and <code>get</code> returns nothing, so Next renders the page again.</p>
<h2>Making pages cacheable in the first place</h2>
<p>A cached page can't know who's looking at it. In production, a page that's supposed to be cached but reads <code>cookies()</code> or <code>headers()</code> while it renders fails with <code>DYNAMIC_SERVER_USAGE</code>, and that includes anything in the shared header or footer. So everything personal moved to the browser: the account menu asks <code>/api/session</code>, your own upvotes come from <code>/api/me/upvotes</code>, and the owner tools load from <code>/api/me/profile</code>. The server renders one page for everyone, and the browser fills in the rest.</p>
<p>Page views moved too. A small beacon with a signed token counts them now, instead of the server. Nice side effect: crawlers that don't run JavaScript stopped counting as views.</p>
<h2>The trade-offs</h2>
<p>It's one cache per process. Next's own self-hosting guide says a production handler should keep entries somewhere every instance can reach, like Redis or S3, because an in-process <code>Map</code> gives each instance its own copy. With one server that's fine. The day there's a second one, this becomes a Redis handler.</p>
<p>Restarts start cold. A deploy empties the cache, so the first visit to each page after a deploy renders it again. For a directory that's cheap; for a slow page it might not be.</p>
<p>And memory is the budget now. The cap has to fit next to the app on a small VM, which is why it's a setting and not a constant.</p>
<p>It's running in production on <a href="https://appfinder.tech">appfinder.tech</a>: every app profile and comparison there is built on its first visit and served from this cache after that.</p>
<hr />
<p><em>I run AppFinder, and the code above is trimmed from its source. I used an AI assistant to help write this up; the details are checked against the actual code.</em></p>
]]></content:encoded></item><item><title><![CDATA[How I built a dofollow link checker (and what it can't see)]]></title><description><![CDATA[How a dofollow link checker reads rel values, robots meta, canonicals and redirect links from raw HTML, and how it fetches pasted URLs safely.]]></description><link>https://appfinder.hashnode.dev/how-i-built-a-dofollow-link-checker-and-what-it-can-t-see</link><guid isPermaLink="true">https://appfinder.hashnode.dev/how-i-built-a-dofollow-link-checker-and-what-it-can-t-see</guid><category><![CDATA[SEO]]></category><category><![CDATA[SEO for Developers]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Kunal Siyag]]></dc:creator><pubDate>Fri, 20 Nov 2026 18:56:57 GMT</pubDate><content:encoded><![CDATA[<p>If you've ever submitted a product to a directory for the backlink, there's a decent chance you never checked what you actually got. "Is it followed?" sounds like a yes-or-no question, but it's really four. Is the link marked nofollow, ugc or sponsored? Does the page tell search engines not to follow anything on it? Does the page say its real copy lives at another URL? And does it even link to your site, or to a redirect on the directory's own domain?</p>
<p>I built a checker for this as a free tool on AppFinder, the software directory I run. It also does a job for AppFinder itself: our link to a maker's site is followed while their site shows our badge, so something has to go and read their page. Same code for both. Here's how it works, and where it falls short.</p>
<h2>It reads the HTML, not the page</h2>
<p>The checker downloads the page once and scans the raw HTML. There's no headless browser.</p>
<p>That keeps it cheap and fast, and it shows you what a crawler gets on its first request, which is what you actually care about. The catch is that anything JavaScript adds after the page loads is invisible to it. Google does render JavaScript, but as a separate, later step, and plenty of crawlers don't render at all. So when the checker can't find a link, it doesn't call it "not followed". It says this instead:</p>
<blockquote>
<p>No link to <code>example.com</code> in this page's HTML. It may be added by JavaScript after the page loads, which search engines don't always see.</p>
</blockquote>
<p>The parsing is a handful of regular expressions over <code>&lt;a&gt;</code>, <code>&lt;meta&gt;</code> and <code>&lt;link&gt;</code> tags. I know, regex and HTML. But it only needs to pull attributes out of server-rendered markup, and that saves a dependency.</p>
<h2>Sorting the links</h2>
<p>Every <code>&lt;a href&gt;</code> is resolved against the page URL, so relative links work, and only the ones pointing at your domain (or one of its subdomains) are kept. Then <code>rel</code> decides what kind of link it is:</p>
<pre><code class="language-ts">function kindOf(rel: string): LinkKind {
  const tokens = rel.toLowerCase().split(/\s+/);
  if (tokens.includes("sponsored")) return "sponsored";
  if (tokens.includes("ugc")) return "ugc";
  if (tokens.includes("nofollow")) return "nofollow";
  return "followed";
}
</code></pre>
<p>The order only changes the label. <code>rel="nofollow sponsored"</code> shows up as sponsored because it's the more specific of the two, and either way it isn't followed. Even "not followed" really means "probably passes nothing": Google has treated all three values as hints rather than hard rules since 2019–2020.</p>
<p>If a page links to you three times (a logo, a button and a text link), you see all three, plus one verdict: followed, not followed or mixed.</p>
<h2>The page can overrule the link</h2>
<p>A perfectly clean <code>&lt;a&gt;</code> tag can still be worth nothing:</p>
<pre><code class="language-ts">// content of every &lt;meta name="robots"&gt; and &lt;meta name="googlebot"&gt;, joined
const pageNoindex = /\b(noindex|none)\b/.test(directives);
const pageNofollow = /\b(nofollow|none)\b/.test(directives);
</code></pre>
<p>A page-level <code>nofollow</code> (or <code>none</code>) cancels every link on the page. A <code>noindex</code> means the page may drop out of the index and take your link with it. This isn't hypothetical: one of the launch sites I checked puts <code>noindex</code> on its free listings.</p>
<p>Canonicals are the third trap. If the page points to another URL as its canonical copy, search engines pool the signals there, so the checker flags it. Your link needs to be on that page too.</p>
<p>One thing it doesn't look at yet is the <code>X-Robots-Tag</code> response header, which can say <code>noindex</code> or <code>nofollow</code> without touching the HTML. If a result looks too good to be true, check the headers yourself:</p>
<pre><code class="language-bash">curl -sI https://directory.example/tools/your-app | grep -i x-robots-tag
</code></pre>
<h2>Redirect links</h2>
<p>Plenty of directories don't link to you at all. They link to themselves, on a path that bounces to your site and counts the click:</p>
<pre><code class="language-ts">const REDIRECT_PATH = /^\/(?:go|out|visit|redirect|r|click|link|outbound)(?:\/|$)/i;
</code></pre>
<p>If the checker finds no direct link but some of these, it tells you how many, and that they pass visitors but usually not search credit. Usually, because it depends on how the redirect is built: a plain server redirect can pass signals, while one that's blocked in robots.txt or marked nofollow can't. The checker doesn't follow them, so it reports what it saw instead of guessing.</p>
<h2>Fetching URLs that strangers paste</h2>
<p>This is the part that matters most for security. A tool that fetches whatever URL a visitor types is a textbook SSRF hole: someone pastes <code>http://169.254.169.254/</code> or an internal hostname, and now your server is making requests on their behalf. So the checker goes through the same locked-down fetch as AppFinder's crawler.</p>
<p>It only connects to public addresses, and it checks that in the socket's <code>lookup</code> hook at connect time, so the address it vetted is the address it dials. That closes the DNS rebinding trick, where a name resolves to something harmless during the check and to something internal a moment later. Every request gets a fresh connection, so a pooled socket can't sneak around the check. Redirects are followed by hand, each target is checked again, only a few hops are allowed, and by default they have to stay on the same site. The body is capped at 1.5 MB, and a single deadline covers everything from DNS to the last byte.</p>
<h2>Asking robots.txt first</h2>
<p>The checker introduces itself as <code>AppFinderBot/1.0</code> with a contact URL and reads robots.txt before anything else:</p>
<pre><code class="language-ts">if (status === null) return { kind: "unreachable" };            // no answer: don't fetch
if (status &gt;= 200 &amp;&amp; status &lt; 300) return { kind: "rules", robots: robotsParser(robotsUrl, body) };
if (status === 429 || status &gt;= 500) return { kind: "unreachable" };
if (status &gt;= 400) return { kind: "allow_all" };               // no robots.txt at all
</code></pre>
<p>That's the split RFC 9309 describes: no robots.txt (a 4xx) means you're free to crawl, while a server error or no answer at all means stay away. If a site says no, the checker tells you so instead of reading the page anyway. Nothing gets stored. The page is read once, you get your answer, and requests are rate-limited.</p>
<h2>We run it on ourselves</h2>
<p>Every AppFinder listing links straight to the maker's site. That link is followed while their site shows the AppFinder badge and nofollow when it doesn't. A background job reads their page with this same checker and looks for a followed link to their AppFinder profile, on a page that isn't marked nofollow. The listing itself never depends on the badge, only the <code>rel</code> on that one link.</p>
<p>We don't trust a badge image being loaded from their domain, either. The <code>Referer</code> header that would show it can be faked, so it's a hint at most. The decision comes from reading the page.</p>
<p>I like that the checker has to give the same answer about our own badge that it gives about anyone else's directory. It keeps us honest.</p>
<h2>Try it on your own listings</h2>
<p>If you've listed a product somewhere, paste the listing page and your domain into the <a href="https://appfinder.tech/tools/link-check">link checker</a>. And if you're working out where to list next, I did these checks by hand on 31 launch sites. The results, with the date of each check, are <a href="https://appfinder.tech/launch-sites">here</a>.</p>
<hr />
<p><em>I run AppFinder, and the code above is trimmed from its source. I used an AI assistant to help write this up; the details are checked against the actual code.</em></p>
]]></content:encoded></item></channel></rss>