A self-hosted, open source digital library for ebook lending. Lenny lets a library keep its EPUB collection on its own server, lend each copy to one patron at a time (controlled digital lending), and publish the catalog as an OPDS feed. Patrons read in the browser through Readium and Thorium Web.
Website · Install · Admin guide · Configuration · API · Issues
Most libraries lend ebooks through a vendor's platform, on the vendor's terms. Lenny is the other option: the library runs the server, keeps the files and sets the loan rules. Lenny is made by Archive Labs and is free software under the AGPL.
- Lending. Each copy goes to one patron at a time. Loans return themselves after a set number of days. You set the per-patron loan limit and loan length in the admin UI.
- Reading in the browser. Patrons read in Thorium Web, served by your own node. Lenny never offers a download link.
- Three access modes. A book is open to anyone, borrowable with a loan, or members-only for the paying members of a Ghost site, who read straight from a post or newsletter without a Lenny account. See Members-only books with Ghost.
- OPDS 2.0 catalog at
/v1/api/opds, with search and incremental harvesting, for reading apps and aggregators such as Open Library. - A catalog site at
/where patrons browse, sign in and borrow. - Admin UI at
/admin: a dashboard, books, bulk import, loans, Ghost members and reading stats, staff accounts, lending and sign-in settings. - Patron sign-in through Open Library one-time passwords, your own OIDC provider (Keycloak, Auth0, Okta and others), or Internet Archive keys.
- OAuth 2.0 server, so other apps (Open Library, reader.archive.org) can borrow on a patron's behalf.
- Metadata from Open Library. Every book is keyed to an Open Library edition.
- One-command updates with prebaked images for amd64 and arm64, and a database backup before each update.
You need Linux or macOS, Docker with Compose v2, git, make and bc. See Install for details.
git clone https://github.com/ArchiveLabs/lenny.git
cd lenny
make startmake start writes the config files with fresh secrets, pulls the images and starts the stack. Then:
| Open | For |
|---|---|
| http://localhost:8080/ | the catalog patrons use |
| http://localhost:8080/admin | the admin UI. Sign in as admin with ADMIN_PASSWORD from auth.env |
| http://localhost:8080/v1/api/opds | the OPDS feed |
| http://localhost:8080/v1/api/docs | the API reference |
Add some public domain books from Standard Ebooks to try it out:
make preload items=10Add your own EPUB, keyed to its Open Library edition:
make addbook olid=OL60638966M filepath=~/books/mybook.epub encrypted=trueTo put the node on the internet, see Public access and HTTPS. To turn on lending, see Lending modes.
Update later with:
make update| Guide | Covers |
|---|---|
| Install and operate | requirements, install, updates, backups, ARM, tunnels and HTTPS |
| Configuration | every config file, environment variable and make target |
| Admin guide | staff accounts, adding books, access and lending modes, patron sign-in, the reader |
| Members-only books with Ghost | selling reading access through a Ghost membership: setup, webhooks, stats, troubleshooting |
| API | REST and OPDS endpoints, harvesting, health check |
| Development | local builds, tests, migrations, the admin app, contributing |
| Troubleshooting | common failures and how to recover |
| OAuth 2.0 app access | letting other apps sign patrons in and borrow |
| External OIDC sign-in | using your own identity provider for patrons |
| Database migrations | Alembic workflow |
- Bugs and questions: GitHub issues.
- Chat: request an invite to the Lenny Slack channel.
- Email: mek@archive.org. Libraries interested in a pilot are welcome to write.
- Open Library holds a weekly community call that covers Lenny too.
Issues and pull requests are welcome. Start with Development. It covers the local setup, tests, and the VERSION bump CI asks for when a change ships to servers.
Please report vulnerabilities privately through GitHub's vulnerability reporting, not in a public issue.
Lenny is built on:
- Readium for serving publications, and Thorium Web by EDRLab as the reader
- Garage by Deuxfleurs for object storage
- Open Library and the Internet Archive for metadata, patron sign-in and lending accounts
- Standard Ebooks for the sample collection
- FastAPI, PostgreSQL, SQLAlchemy, Alembic and nginx
- Archive Labs' own opds-client, lenny-app and pyopds2 libraries
GNU Affero General Public License v3.0. If you run a modified Lenny for others, the AGPL requires you to offer them your source.