Inkwell, Inkling & OLGF
I read a lot of comics on my iPad. In fact I have a small collection of over 500 comics, and that has caused problems. Storage.
I have an iPad Air from 2020, and it only has 64 gigabytes of storage. The overwhelming majority of the storage is taken up by comics. In response, I turned to OPDS. A basic XML feed that allows a reader to fetch books from a server. Officially it doesn't support streaming, but there is an unofficial extension called PSE. This is vital for comic readers to keep space usage down.
There are very few OPDS servers that support PSE, and even fewer that are lightweight. So I wrote my own. Inkwell is written in Go, and serves an OPDS feed based on a folder of CBZ files that contain a ComicInfo.xml file. It's fairly simple but effective.
However I've grown to be frustrated with OPDS and it's limitations.
- XML is incredibly verbose. A simple feed of a few hundred books can be multiple megabytes. Yes, I am aware that OPDS 2.0 uses JSON instead, but that doesn't solve the other problems.
- Bad searching. The search function of OPDS is complicated, and is based on OpenSearch. This is dumb is complicates things where it could be a simple REST API.
- Lacking metadata. OPDS only supports a handful of metadata tags so readers are fairly limited on what they can show to their viewers. No support for right to left reading, no support for whether this comic is black and white.
OPDS is clearly a standard built for an older era of computing.
Enter the Open Library GraphQL Feed. OLGF. This is a work in progress schema for serving a similar role to OPDS, but designed to be more informative, flexible, and efficient.
GraphQL was the choice because while it's more complicated to implement, it offers so many benefits.
- No over/underfetching. Since clients control what data is requested, they can limit their requests to just what they need and not the whole API.
- Strong typing is great. It reduced the potential for datatype mix ups even in weakly typed languages like Javascript and Python.
- Subscriptions! No longer does the client need to constantly refresh data from the server, instead it can subscribe and the client will be notified when there is new data to fetch.
This is how APIs should have always been. OLGF will essentially merge ComicInfo.xml and OPDS 2.0 into a new standard that should easily handle even the largest library.
As powerful as GraphQL is for serving an API, it cannot serve data from a file, so a separate file server will need to exist to handle that. In order to support streaming, it'll also need to be able to open, read, and serve files from CBZ archives.
Right now I'm working on the schema. Following that is the first rough rewrite of Inkwell to support the new format. This rewrite is not going to be the most efficient, but should act more as a proof of concept. Once that has been verified to work, then the real work begins. Writing Inkwell from scratch to support OLGF, no legacy code, all written in clean and simple Go.
The server should be simple enough to implement. Maybe a few weeks to months to iron everything out.
Now onto Inkling. This is going to be the front-end. I'm planning to write it in Dart and Flutter to make a cross platform reader. Ideally this means one code-base for web, desktop, and mobile.
This is probably the part that will take the longest as I am not very familiar with Dart or Flutter. Front-end development hasn't been my focus for a while.
So yeah. That's the plan. All the source code will be publicly available as always, and hopefully this turns into enough of a success that other readers adopt OLGF.