This repository is a fork and continuation of Petr Prikryl's original OPDS-ABS project. His work provided the foundation for this project. Since the upstream repository had not been updated in roughly a year, I am continuing development here.
This project provides an OPDS (Open Publication Distribution System) server that fetches books from the Audiobookshelf API and presents them in OPDS format, making it easy to browse and download books in supported OPDS clients.
- Fetch books & libraries from the Audiobookshelf API
- Supports OPDS for easy integration with reading apps
- Multiple authentication methods:
- Basic auth with Audiobookshelf username and password
- API key authentication for better security and flexibility
- Bearer token authentication for API clients
- Pagination support for better performance with large libraries
- Dockerized for easy deployment
- Lightweight web interface
- Enhanced web interface
- Improved Auth
- PocketBook Reader iOS and Android
- KOreader
- Moon+ Reader Pro Android
OPDS-ABS supports multiple authentication methods to connect to your Audiobookshelf server:
The standard authentication method using your Audiobookshelf username and password:
Username: your_abs_username
Password: your_abs_password
This method always works regardless of configuration settings.
For improved security, you can use an API key instead of your password. This is useful for clients where you don't want to store your actual password. Note: API Key authentication must be enabled with the API_KEY_AUTH_ENABLED=true environment variable.
- Log into your Audiobookshelf web interface
- Click on your user icon in the top-right corner
- Select "User Settings"
- Find the "API Key" section
- Copy your existing API key or generate a new one
Username: your_abs_username
Password: your_audiobookshelf_api_key
Most OPDS clients support this authentication method. Use your Audiobookshelf API key in place of your password.
For direct API access, you can use the API key as a Bearer token:
Authorization: Bearer your_audiobookshelf_api_key
The server will automatically determine your username from the API key by querying Audiobookshelf.
This method matches Audiobookshelf's native API authentication behavior.
If you need to switch between different authentication methods, you can use the following environment variables:
API_KEY_AUTH_ENABLED=false- Disables all API key authentication, forcing the use of username/password onlyAUTH_TOKEN_CACHING=false- Disables token caching, ensuring each request is authenticated fresh (useful when testing)
git clone https://github.com/trevorswanson/OPDS-ABS.git
cd opds-absEnsure Docker and Docker Compose are installed, then run:
docker-compose up -dThis will start the OPDS server.
- OPDS Root:
http://localhost:8000/opds/ - Web Interface:
http://localhost:8000/
You can use an OPDS-compatible reader (e.g., Calibre, KOReader, Thorium Reader) to access your books.
You can configure the server using environment variables in your docker-compose.yml file:
services:
opds:
environment:
# User/Group settings for proper file permissions
- PUID=1000 # Set to your user's UID
- PGID=1000 # Set to your user's GID
# Connection settings
# Legacy: AUDIOBOOKSHELF_URL is supported for backward compatibility
# - AUDIOBOOKSHELF_URL=http://audiobookshelf:13378
# Recommended: set internal and/or external URLs
- AUDIOBOOKSHELF_INTERNAL_URL=http://audiobookshelf
- AUDIOBOOKSHELF_EXTERNAL_URL=http://abs.example.com
# Feature toggles
- AUTH_ENABLED=true
- API_KEY_AUTH_ENABLED=true
- CACHE_PERSISTENCE_ENABLED=true
# Performance settings
- OPDS_LOG_LEVEL=INFO
# Development only; leave false in Docker to avoid filesystem polling
- OPDS_RELOAD=false
- ITEMS_PER_PAGE=25 # Set to 0 to disable pagination| Variable | Description | Default |
|---|---|---|
AUDIOBOOKSHELF_URL |
(Legacy) Main URL of your Audiobookshelf server. If set, used for both internal and external. | http://localhost |
AUDIOBOOKSHELF_INTERNAL_URL |
Internal URL for container-to-container communication. If only this or EXTERNAL is set, that value is used for both. | http://localhost |
AUDIOBOOKSHELF_EXTERNAL_URL |
External URL for client downloads and images. If only this or INTERNAL is set, that value is used for both. | http://localhost |
AUTH_ENABLED |
Enable/disable authentication | true |
API_KEY_AUTH_ENABLED |
Enable/disable API key authentication (set to false to only allow username/password) |
true |
AUTH_TOKEN_CACHING |
Enable/disable token caching (set to false to force re-authentication on each request) |
true |
PAGINATION_ENABLED |
Enable/disable pagination entirely (overrides ITEMS_PER_PAGE) | true |
PUID |
User ID for file ownership | 1000 |
PGID |
Group ID for file ownership | 1000 |
ITEMS_PER_PAGE |
Number of items per page, 0 to disable pagination | 25 |
OPDS_LOG_LEVEL |
Logging level (DEBUG, INFO, WARNING, ERROR) | INFO |
OPDS_RELOAD |
Enable Uvicorn hot reload; intended for local development | false |
CACHE_PERSISTENCE_ENABLED |
Enable/disable cache persistence | true |
You can use the pre-built Docker image. latest tracks the newest tagged
release; pin a specific version (e.g. v0.5.0, 0.5, or 0) if you want to
control upgrades yourself.
docker run -d -p 8000:8000 \
--env AUDIOBOOKSHELF_INTERNAL_URL=http://audiobookshelf:13378 \
--env AUDIOBOOKSHELF_EXTERNAL_URL=http://abs.hlm.ing:13378 \
--env PUID=$(id -u) \
--env PGID=$(id -g) \
--volume ./data:/app/opds_abs/data \
ghcr.io/trevorswanson/opds-abs:latestOr use docker-compose.yml directly:
curl -o docker-compose.yml https://raw.githubusercontent.com/trevorswanson/OPDS-ABS/refs/heads/master/docker-compose.yml
docker-compose up -dThe Docker container supports custom user IDs to ensure proper file ownership when mounting volumes:
# Find your user and group IDs
id -u # Your user ID (PUID)
id -g # Your group ID (PGID)Update your docker-compose.yml with these values to ensure proper file permissions.
You can control pagination behavior through two environment variables:
PAGINATION_ENABLED: Set tofalseto completely disable pagination across all feedsITEMS_PER_PAGE: Set a positive number (e.g., 25) for page size, or 0 to disable pagination but keep the option
For most users, setting PAGINATION_ENABLED=false is the simplest way to disable pagination completely. Using ITEMS_PER_PAGE=0 is an alternative that keeps the pagination code active but shows all items.
Pagination helps improve performance and load times when dealing with large libraries, but disabling it can be useful for smaller libraries or when using clients that work better with complete feeds.
Pull requests are welcome! If you find a bug or want to suggest improvements, open an issue on GitHub.
-
Install development dependencies:
pip install -r requirements-dev.txt
-
Set up pre-commit hooks:
pre-commit install
-
Before submitting a PR, ensure your code passes all checks:
./docstring-check.py
For more information about our documentation standards, see DOCS_STANDARDS.md.
Made with ❤️ for Audiobookshelf users.