Kiroku
An anime watch tracker with a watch list, a weekly season calendar in your own time zone, collections, recommendations and viewing stats.
Kiroku is set like a ruled notebook, and every request for show data goes through one rate-limited client on the server.

- Built with
- Next.js, TypeScript, Prisma, PostgreSQL, NextAuth, TanStack Query, Vitest
- Features
- Search, Top shows, Show pages, Season calendar, Watch list, Collections, Stats, Recommendations, Discord and password sign-in, Light and dark themes
Overview
Kiroku is an anime watch tracker. You can search shows and browse the top lists, follow the current season on a weekly calendar shown in your own time zone with a countdown to each next episode, keep a watch list with status, episode progress and a rating, group shows into collections, and see stats and recommendations based on what you've logged.
I built it to keep tracking, schedules and recommendations in one place. It's a Next.js App Router app with Prisma and PostgreSQL, NextAuth for Discord or password sign-in, and TanStack Query on the client. The show data is MyAnimeList data from Tenrai, which I moved to in November 2026 after the Jikan API the app was built on shut down. In the same rebuild I fixed what an audit of the old code turned up, stored show details in Postgres, added 256 tests and redesigned every page.
Under the interface
Problems and fixes
The API I built on shut down.
I moved to Tenrai, which uses the same MyAnimeList ids, so stored data and URLs kept working. The official MyAnimeList API is the automatic fallback.
A dead API held every page for 66 seconds.
One request policy for every call: 4 seconds per attempt and 10 in total. A hanging API now fails within 8.5 seconds.
The watch list called the API once per show.
Show details are stored in Postgres and refreshed in one batch of up to 25. During an outage the stored rows are used as they are.
Air times come as a weekly slot in Japan time.
The browser converts each slot to the viewer's time zone and weekday, without a date library.
Tenrai sends no rate-limit headers.
The app paces itself at 3 requests per 1.1 seconds and 100 a minute.
A server function can run for 60 seconds.
A cold season load stops at 35 seconds and returns a partial calendar.


Outcomes
66,284–66,508 ms to 363–757 ms
Respond, the time from the start of page.goto() to DOMContentLoaded, for Top shows, Season, Search (q=fullmetal) and a show page (/anime/52991), three loads each. Before, each page then showed one line of error text; after, each showed its data.
Headless Chrome against the live site, signed in as the demo account, 15 Nov 2026: before from 10:43 to 10:56 UTC, after from 17:07 to 17:11 UTC once the rebuild was live. The after run opened a fresh tab for each load; the before run reused one tab.
16 to 0
Browser requests to the show data API during one load of the 16-entry watch list. Before, one per entry to api.jikan.moe, and every row showed "Anime #<id>" with an "N/A" poster; after, none to api.jikan.moe or api.tenrai.org, and all 16 rows showed their real title and a poster. Show data is now fetched on the server, so the browser no longer calls the API itself.
Headless Chrome against the live site with the browser cache disabled, three loads each, 15 Nov 2026: before from 10:57 to 11:00 UTC, after from 17:11 UTC.
64,307 and 64,509 ms to 1,462 and 1,416 ms
Time from clicking "Watch list" in the header until the posters reached their final state. Before, the placeholders turned into "N/A"; after, the posters in view had loaded.
Headless Chrome against the live site, two runs each, 15 Nov 2026: before at about 11:02 and 11:07 UTC, after at 16:52:58 and 16:53:14 UTC.
65,973 and 65,905 ms to 609 and 591 ms
Time from typing "frieren" in the home page search box and pressing Enter until the page showed a result. Before, the error line; after, the 4 results.
Headless Chrome against the live site, two runs each, 15 Nov 2026: before at about 11:01 and 11:05 UTC, after at 16:52:28 and 16:52:43 UTC.
504 after 300,222–300,547 ms to 200 in 561–2,329 ms
GET /api/user/stats and GET /api/user/recommendations for the 16-entry demo account, fetched in parallel from the signed-in page, three rounds each. Before, Vercel's FUNCTION_INVOCATION_TIMEOUT page every time, and the stats page fell back to its empty state after 20.2 minutes; after, JSON every time, and both pages showed their data on every load.
15 Nov 2026: before from 10:42 to 10:53 UTC, after from 16:51 UTC.
405 to 200
PATCH /api/user/password with the current password submitted as the new one. Before, an empty body, and the form still read "Updating..." 4 seconds later; after, "Password updated." in 1,075 ms, shown in the form 1,064 ms after the click.
15 Nov 2026: before at 09:57:53 UTC, after at 16:52:17 UTC.
4, 4 and 4 to 5, 4 and 5
Collection sizes on the collections overview, for collections whose real sizes from GET /api/user/lists/:id were 5, 4 and 5.
15 Nov 2026: before at 11:02:59 UTC, after at 16:52:13 UTC.
0 to 256
Automated tests, in 20 files, covering the request policy, rate scheduler, cache wrapper, season loading, broadcast times, stored-show refreshing, stats, recommendations and input validation.
Counted at commit e3535a6 on 15 Nov 2026, and npm test (Vitest) on 16 Nov 2026.
1,604.5 KB to 1,212.3 KB
Client JavaScript in the production build, 24.4% smaller (503.2 KB to 390.1 KB gzipped, 22.5% smaller). 35 files before, 42 after; KB is 1,024 bytes.
Measured at commit e3535a6 on 15 Nov 2026 and at commit 4ee6ece on 16 Nov 2026.
83.4 KB to 233.5 KB
CSS in the production build (13.6 KB to 75.1 KB gzipped). This is a real cost of self-hosting a Japanese serif: about 189 KB of the raw CSS is one file of 245 @font-face rules, one per unicode-range slice of the fonts.
Measured at commit e3535a6 on 15 Nov 2026 and at commit 4ee6ece on 16 Nov 2026.
Takeaways
- A retry policy needs a total time budget, not only a timeout per attempt. Four 15-second tries held a page for 66 seconds.
- Store what you show. One API call per watch list entry made the list, stats and recommendations only as fast as the slowest upstream reply.
- Check the values an API actually sends. The countdown compared "friday" with "Fridays", so it never appeared.
- Read a data source's terms before its docs. AniList had the best API I tested, and its terms ruled it out.

