---
title: "tanaki: a tiny Komga-compatible server for CBZ files"
url: https://mangaki.app/tanaki/
description: "tanaki serves a folder of CBZ files over the Komga API. A 4 MB static binary that idles at 12 MB of RAM and indexes 25,000 books in under 5 seconds. MIT."
---

# 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.

[tanaki on GitHub](https://github.com/jutsustudio/tanaki) Quickstart

**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.

| | tanaki | Komga |
| --- | --- | --- |
| Formats | CBZ | CBZ, CBR, PDF, EPUB |
| Web interface | None | Yes |
| Users | One, with Basic auth | Several |
| OPDS | No | Yes |
| Runtime | One static binary, about 4 MB | Java (JVM) |
| Memory | 12–13 MB at idle | A few hundred megabytes |
| Reading progress | Not stored; the app keeps it | Stored on the server |

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.

| Test | Result |
| --- | --- |
| Cold scan | 4.7–4.9 s |
| Rescan, nothing changed | 54–98 ms |
| Rescan after adding one book | 245 ms |
| Index size | 71 MB, about 2.8 KB per book |
| Series list | 29,500–32,000 req/s, p50 2.0 ms |
| Books of a series | 18,800–19,500 req/s, p50 3.2 ms |
| Page images | 39,300–48,800 req/s, p50 1.1–1.3 ms |
| Memory at idle | 12–13 MB |
| Memory after a cold scan | 27 MB |
| Memory under load | 13–37 MB |
| Binary | 3.6 MB (aarch64), 4.1 MB (static musl), 4.2 MB Docker image |

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

| Variable | Default | Meaning |
| --- | --- | --- |
| `TANAKI_LIBRARY` | required | Library root folder |
| `TANAKI_USER` | required | Basic-auth user name |
| `TANAKI_PASSWORD` | required | Basic-auth password |
| `TANAKI_DATA` | `./data` | Folder for tanaki.db, the index and thumbnails |
| `TANAKI_BIND` | `0.0.0.0:25600` | Listen address |
| `TANAKI_LIBRARY_NAME` | library folder name | Library name shown to clients |
| `TANAKI_PUBLIC_URL` | none | Address phones reach tanaki at, used by tanaki connect |

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.

| Method | Path | Notes |
| --- | --- | --- |
| GET | `/api/v1/libraries` | The single library, also at /api/v1/libraries/{id} |
| POST | `/api/v1/libraries/{id}/scan` | Starts a rescan and answers 202 |
| GET | `/api/v1/series` | page, size (default 20, max 2000), unpaged, search, sort |
| GET | `/api/v1/series/{id}` | One series |
| GET | `/api/v1/series/{id}/thumbnail` | JPEG cover with ETag and 304 |
| GET | `/api/v1/series/{id}/books` | page, size, unpaged, sort by chapter number |
| GET | `/api/v1/books/{id}` | One book, which is one chapter |
| GET | `/api/v1/books/{id}/pages` | Page 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 your library on iPhone and iPad

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

 [About Mangaki](https://mangaki.app/)

Guides

## How tanaki compares

- ### Komga vs Kavita: which manga server should you self-host?
 Komga, Kavita, Ubooquity and tanaki compared on Docker image size, formats, web reader, OPDS and users, with sources for every number.
 [Komga vs Kavita: which manga server should you self-host?](https://mangaki.app/blog/komga-vs-kavita-vs-tanaki/)
- ### What is the best Komga client for iOS?
 KMReader, Komic, Panels, Paperback and Mangaki compared from their App Store listings and source: price, minimum iOS, offline downloads, progress sync and how each connects to Komga.
 [What is the best Komga client for iOS?](https://mangaki.app/blog/best-komga-client-ios/)
- ### How do I read manga offline on iPhone?
 Which apps download chapters from a Komga server without a subscription, how to download in Mangaki, mobile data settings and the 5 GB download cap.
 [How do I read manga offline on iPhone?](https://mangaki.app/blog/read-manga-offline-iphone/)

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.
