<?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: kamedashe</title>
    <description>The latest articles on DEV Community by kamedashe (@kamedashe_027c394222c1f98).</description>
    <link>https://dev.to/kamedashe_027c394222c1f98</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%2F4041915%2F4baa7d30-e688-4a74-a2ac-c801c2575849.jpg</url>
      <title>DEV Community: kamedashe</title>
      <link>https://dev.to/kamedashe_027c394222c1f98</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kamedashe_027c394222c1f98"/>
    <language>en</language>
    <item>
      <title>I built an anime backlog calculator and broke my own app three different ways</title>
      <dc:creator>kamedashe</dc:creator>
      <pubDate>Wed, 22 Jul 2026 12:05:21 +0000</pubDate>
      <link>https://dev.to/kamedashe_027c394222c1f98/i-built-an-anime-backlog-calculator-and-broke-my-own-app-three-different-ways-3gk</link>
      <guid>https://dev.to/kamedashe_027c394222c1f98/i-built-an-anime-backlog-calculator-and-broke-my-own-app-three-different-ways-3gk</guid>
      <description>&lt;p&gt;I track what I watch. My backlog grew past 40 titles and I had no idea what&lt;br&gt;
that actually meant in hours. Every tracker (MyAnimeList, AniList, Shikimori)&lt;br&gt;
shows you a list — none of them multiply it out into something you can&lt;br&gt;
actually plan your week around.&lt;/p&gt;

&lt;p&gt;So I built &lt;a href="https://www.tokiwa.moe" rel="noopener noreferrer"&gt;TokiWa&lt;/a&gt; — Next.js 15, Prisma, Postgres on&lt;br&gt;
Neon. The core feature is dumb-simple: &lt;code&gt;remaining_episodes × episode_duration&lt;/code&gt;,&lt;br&gt;
shown as real hours, with a "what fits in an evening / a weekend / a&lt;br&gt;
vacation" breakdown. Nobody in the anime-tracker space does this. Turns out&lt;br&gt;
general TV trackers like MyShows had something similar years ago — readers&lt;br&gt;
on a post I wrote pointed that out, which was a good reminder that "unique"&lt;br&gt;
claims deserve a footnote.&lt;/p&gt;

&lt;p&gt;Here's what actually went wrong while building it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Postgres thinks NULL is the biggest number there is
&lt;/h2&gt;

&lt;p&gt;Sorting the catalog by score, descending:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;ts&lt;br&gt;
orderBy: { score: "desc" }&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Titles with no score yet (unreleased anime) floated to the very top of the&lt;br&gt;
homepage, ahead of a 9.1-rated classic. Postgres puts NULLs first on a&lt;br&gt;
DESC sort by default — I'd never hit this because every other sortable&lt;br&gt;
field I'd used was NOT NULL. Fix:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;ts&lt;br&gt;
orderBy: { score: { sort: "desc", nulls: "last" } }&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Same bug had picked the homepage hero title too, via a separate query.&lt;br&gt;
Grepped for every &lt;code&gt;orderBy: { score\&lt;/code&gt; in the codebase to be sure I got them&lt;br&gt;
all.&lt;/p&gt;

&lt;h2&gt;
  
  
  A sitemap can be too big to deploy
&lt;/h2&gt;

&lt;p&gt;Catalog grew to 15k+ titles. Sitemap grew with it — to 24MB. Vercel caps&lt;br&gt;
prerendered static files at 19MB. Every deploy after that point failed&lt;br&gt;
silently in a way that took a minute to diagnose. Split it into shards of&lt;br&gt;
2000 titles each via Next's &lt;code&gt;generateSitemaps()\&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;ts&lt;br&gt;
export async function generateSitemaps() {&lt;br&gt;
  const count = await prisma.title.count();&lt;br&gt;
  const shards = 1 + Math.ceil(count / TITLES_PER_SITEMAP);&lt;br&gt;
  return Array.from({ length: shards }, (_, id) =&amp;gt; ({ id }));&lt;br&gt;
}&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The sitemap index at &lt;code&gt;/sitemap.xml\&lt;/code&gt; still resolves — search consoles never&lt;br&gt;
needed re-submitting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bulk-syncing 600 pages of data exhausted the connection pool
&lt;/h2&gt;

&lt;p&gt;Backfilling the catalog from an external API meant one query per title to&lt;br&gt;
check if it already existed — fine at small scale, catastrophic at 30,000&lt;br&gt;
candidate titles over several hours. Neon's pool has a hard connection&lt;br&gt;
limit; a few hours in, everything started failing with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Timed out fetching a new connection from the connection pool.&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The fix wasn't more connections — it was fewer round trips. One&lt;br&gt;
&lt;code&gt;findMany({ where: { malId: { in: ids } } })\&lt;/code&gt; per batch of 50 instead of&lt;br&gt;
50 individual &lt;code&gt;findUnique\&lt;/code&gt; calls. Also added a retry wrapper so one flaky&lt;br&gt;
page doesn't kill a multi-hour run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\&lt;/code&gt;&lt;code&gt;ts&lt;br&gt;
async function withRetry&amp;lt;T&amp;gt;(action: () =&amp;gt; Promise&amp;lt;T&amp;gt;, attempts = 4) {&lt;br&gt;
  for (let attempt = 1; attempt &amp;lt;= attempts; attempt++) {&lt;br&gt;
    try {&lt;br&gt;
      return await action();&lt;br&gt;
    } catch (error) {&lt;br&gt;
      if (attempt === attempts) return null;&lt;br&gt;
      await new Promise((r) =&amp;gt; setTimeout(r, attempt * 3000));&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
\&lt;/code&gt;&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The data source silently started redirecting every request
&lt;/h2&gt;

&lt;p&gt;One of the external APIs I depend on switched its canonical domain and&lt;br&gt;
began 301-redirecting every single call. &lt;code&gt;fetch()\&lt;/code&gt; follows redirects&lt;br&gt;
silently, so nothing broke — it just got slower, one wasted round trip&lt;br&gt;
per request, invisible until I actually looked at response headers.&lt;br&gt;
Pointed the client straight at the new domain and moved on.&lt;/p&gt;




&lt;p&gt;TokiWa is free, no forced signup to browse, no ads. Catalog re-syncs&lt;br&gt;
itself nightly now via a cron job so it doesn't need me babysitting it.&lt;br&gt;
If you poke around and find something broken — the catalog is big enough&lt;br&gt;
that edge cases are definitely still hiding somewhere — I'd genuinely like&lt;br&gt;
to hear about it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.tokiwa.moe" rel="noopener noreferrer"&gt;https://www.tokiwa.moe&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvmj8z98ig6a47vakcbee.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvmj8z98ig6a47vakcbee.png" alt=" " width="800" height="639"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9zkgil5zr9c5v9nk7tdb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9zkgil5zr9c5v9nk7tdb.png" alt=" " width="799" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F82qapxbtfxhia42zr5nn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F82qapxbtfxhia42zr5nn.png" alt=" " width="800" height="390"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz08h5jzqj554xjf8mls8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz08h5jzqj554xjf8mls8.png" alt=" " width="800" height="398"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxcri9rklb5lchsdhqmmu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxcri9rklb5lchsdhqmmu.png" alt=" " width="799" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>nextjs</category>
      <category>postgres</category>
      <category>webdew</category>
    </item>
  </channel>
</rss>
