Skip to content
Mek edited this page Jun 10, 2025 · 1 revision

I wanted to provide an update/overview about the current status of the Lenny Library-in-a-Box project as it's becoming pretty turn-key!

code: https://github.com/archivelabs/lenny

If you have docker and git then installation is pretty easy:

git clone [email protected]:ArchiveLabs/lenny.git && cd lenny && ./run.sh

  • When Lenny is composed, it creates 5 containers:
    • api The main application container that runs nginx and a FastAPI app for doing all the Lenny stuff with Lenny items
    • db a postgres server that is used to store metadata about items in Lenny
    • s3 a MinIO s3 server for storing the actual book files for an item
    • readium a service on :15080 that takes base64 encoded filepaths to books and generates manifest.json for the book that can be used by Thorium Web
    • reader is a container that runs the thorium-web as a stand-alone web application on :3000 When you start up Lenny, you have an option to preload 500+ books...

docker exec -it lenny_api python scripts/load_open_books.py

  1. Asks http://OpenLibrary.org/search.json|OpenLibrary.org/search.json for info about every standardebook it knows
  2. The script loops over these records, downloads the corresponding epubs, and uses the Lenny api's /upload to put them in s3 a. The book's path in s3 is the bucket bookshelf/ + the book's openlibrary_edition_id (as an int) + the filetype: i. e.g. 32941311.epub

Now we want to read one of our books! To read one of these books, we will use Thorium Web (i.e. our reader service). But Thorium Web only knows how to speak in "manifests" which need to be generated: This is the sole job of readium.

Once our items are uploaded to, Lenny's readium service is preconfigured w/ s3 so out-of-the-box it can generate manifests for any of its book. To do so, you need to query readium to produce a manifest.json file for a specified base64 encoded version of a full s3 filepath:

  • e.g. <http://localhost:15080/{base64(filepath)}/manifest.json> where...
    • the book's full s3 filepath is <s3://bookshelf/32941311.epub>
    • its base64(filepath) can be computed using:
  • e.g. <http:localhost:3000/read?book=http://localhost:15080/czM6Ly9ib29rc2hlbGYvMzI5NDEzMTEuZXB1Yg/manifest.json>

And there you have it!

Clone this wiki locally