MangakiApp Store

tanaki: A tiny, fast server for a folder of CBZ files that speaks Komga’s API.

  • 4 MB binary
  • Komga API
  • MIT

tanaki is an open-source server that shares a folder of CBZ files with Mangaki and other Komga clients. It is a 4 MB static binary that idles at 12 MB of RAM and indexes 25,000 books in under 5 seconds, so it fits on a NAS or a spare computer next to your library.

4 MB
static binary, 4.2 MB as a Docker image
12 MB
of RAM at idle
<5 s
to index 25,001 books from scratch
48k
page requests per second at best, p50 1.1 ms

Highlights

What tanaki does, and what it leaves out

Komga’s JSON, exactly

SeriesDto, BookDto, PageDto and Spring’s page envelope, checked against Komga’s source and pinned by golden tests. Komga clients work unchanged.

Pages without copying

Uncompressed CBZ entries are served with one pread at a precomputed offset. Every image has an ETag, so a repeat request costs a 304.

Incremental scans

A series is rebuilt only when its files change. Rescanning 25,000 unchanged books takes under 100 ms, and file watching picks up new chapters.

Stable IDs

Renaming a folder or a chapter file keeps its ID, so reading progress in the app survives.

Safe by default

Wrong-password lockout, slow-client timeouts, a cap of 1,024 connections, and an index that survives an unmounted disk.

Small on purpose

No web UI, no OPDS, one user, no TLS, CBZ only. Put it behind a reverse proxy or Tailscale for access from outside.

Compared

tanaki and Komga

Komga is a full media server with a web interface. tanaki implements only the part of its API that reading apps use, so a phone or tablet can read a CBZ folder from a very small process.

tanakiKomga
FormatsCBZCBZ, CBR, PDF, EPUB
Web interfaceNoneYes
UsersOne, with Basic authSeveral
OPDSNoYes
RuntimeOne static binary, about 4 MBJava (JVM)
Memory12–13 MB at idleA few hundred megabytes
Reading progressNot stored; the app keeps itStored on the server
The Komga column follows tanaki’s README. Komga’s own documentation is at komga.org.

Benchmarks

Measured on 25,001 books

A library of 500 series, 25,001 books and 1,000,040 pages on an Apple M4 with 10 cores and 16 GB of memory, measured on 2026-11-12.

TestResult
Cold scan4.7–4.9 s
Rescan, nothing changed54–98 ms
Rescan after adding one book245 ms
Index size71 MB, about 2.8 KB per book
Series list29,500–32,000 req/s, p50 2.0 ms
Books of a series18,800–19,500 req/s, p50 3.2 ms
Page images39,300–48,800 req/s, p50 1.1–1.3 ms
Memory at idle12–13 MB
Memory after a cold scan27 MB
Memory under load13–37 MB
Binary3.6 MB (aarch64), 4.1 MB (static musl), 4.2 MB Docker image
HTTP figures from oha -z 8s -c 64; ranges cover repeated runs. Method and raw numbers: PERF.md.

Quickstart

Run tanaki in three steps

You need Docker with Compose, or a Rust toolchain to build the binary yourself.

1. Lay out the library

One folder per series, one CBZ per chapter. tanaki only reads the library.

library/
  Neon Koi/
    series.json         optional metadata
    cover.jpg           optional, also .png or .webp
    0001.cbz            one book = one chapter
    0010.5.cbz
    .0011.cbz.part      dot-files and *.part are ignored

2. Start it

Set the user and password in secrets.env before the last line.

git clone https://github.com/jutsustudio/tanaki.git && cd tanaki
cp .env.example secrets.env && chmod 600 secrets.env
mkdir -p data && sudo chown 65534 data
LIBRARY_DIR=/srv/manga docker compose up -d --build

3. Connect Mangaki

Scan the QR code with the iPhone camera; Mangaki opens with the server filled in.

docker compose exec -e TANAKI_PUBLIC_URL=http://<host>:25600 tanaki /tanaki connect

Without Docker, build with cargo build --release and run it under systemd. The README has a unit file with DynamicUser and ProtectSystem=strict.

Configuration

Seven environment variables

VariableDefaultMeaning
TANAKI_LIBRARYrequiredLibrary root folder
TANAKI_USERrequiredBasic-auth user name
TANAKI_PASSWORDrequiredBasic-auth password
TANAKI_DATA./dataFolder for tanaki.db, the index and thumbnails
TANAKI_BIND0.0.0.0:25600Listen address
TANAKI_LIBRARY_NAMElibrary folder nameLibrary name shown to clients
TANAKI_PUBLIC_URLnoneAddress phones reach tanaki at, used by tanaki connect
tanaki connect prints the Mangaki QR code and link; tanaki healthcheck exits 0 when the server answers. Deleting tanaki.db only forces a full rescan.

API

Nine Komga endpoints

Every endpoint needs Basic auth. Ten different wrong passwords from one address within a minute lock it out for a minute with a 429. Idle or slow connections close after 10 seconds.

MethodPathNotes
GET/api/v1/librariesThe single library, also at /api/v1/libraries/{id}
POST/api/v1/libraries/{id}/scanStarts a rescan and answers 202
GET/api/v1/seriespage, size (default 20, max 2000), unpaged, search, sort
GET/api/v1/series/{id}One series
GET/api/v1/series/{id}/thumbnailJPEG cover with ETag and 304
GET/api/v1/series/{id}/bookspage, size, unpaged, sort by chapter number
GET/api/v1/books/{id}One book, which is one chapter
GET/api/v1/books/{id}/pagesPage list with file name, media type and size
GET/api/v1/books/{id}/pages/{n}Raw page image, 1-based, with ETag and 304
Read progress, collections and locks are not implemented; their fields are present with neutral values.

Read your library on iPhone and iPad

Mangaki connects to tanaki with one QR code and downloads chapters for offline reading.

About Mangaki

Guides

How tanaki compares

FAQ

Questions about tanaki

Is tanaki a replacement for Komga?

Only if all you need is a folder of CBZ files served to reading apps. tanaki has no web UI, no OPDS, one user and reads CBZ only. Komga does all of that and more, on a JVM with a few hundred megabytes of RAM.

Which apps work with tanaki?

Apps that speak the Komga API, including Mangaki for iPhone and iPad. tanaki returns Komga’s JSON field for field, so a Komga client connects with the server address, user and password.

Does tanaki read CBR, PDF or EPUB?

No, CBZ only, with one CBZ per chapter. Pages stored uncompressed (zip -0) are served with a single read; compressed pages work but are inflated on each request.

How do I reach tanaki from outside my home network?

tanaki does not do TLS. Put it behind a reverse proxy with HTTPS or reach it over a VPN such as Tailscale instead of exposing port 25600 to the internet.

How much memory does tanaki use?

In the 2026-11-12 benchmark with 25,001 books it used 12–13 MB at idle, 27 MB after a cold scan and 13–37 MB under load.

Is tanaki affiliated with Komga?

No. tanaki is an independent project that implements the parts of the Komga API that reading apps use. Komga lives at komga.org.