Skip to content

Deploying Audiobookshelf

Audiobookshelf is a powerful, open-source, self-hosted audiobook and podcast server that puts you in complete control of your audio library. With native mobile apps for Android and iOS, multi-user support, and seamless progress synchronization across all your devices, Audiobookshelf delivers a premium listening experience without subscription fees.

Built with Node.js and featuring a beautiful Vue.js web interface, Audiobookshelf can stream any audio format on-the-fly, automatically fetch metadata and cover art, and even manage podcasts with auto-download capabilities. With over 10,000 GitHub stars, it’s become the go-to solution for self-hosted audiobook enthusiasts.

Stream Any Format

Play all audio formats directly in your browser or mobile app

Mobile Apps

Native Android and iOS apps with offline listening support

Multi-User

Separate progress tracking and permissions per user

Podcast Support

Subscribe to podcasts with automatic episode downloads

Key Features

Audiobookshelf provides a comprehensive audiobook and podcast management solution:

FeatureDescription
Chromecast SupportCast to Chromecast devices from web and Android apps
Progress SyncAutomatic sync across all devices per user
Metadata FetchingAutomatically fetch book info and covers from multiple sources
Chapter EditorEdit chapters with lookup via Audnexus API
Audio MergeCombine multiple audio files into a single m4b
Embed MetadataWrite metadata and covers into your audio files
Ebook SupportRead ePub, PDF, CBR, CBZ with send-to-device (Kindle)
RSS FeedsGenerate RSS feeds for podcasts and audiobooks
Auto-DetectionLibrary auto-updates without manual rescanning

Supported Formats

AudioEbooks
MP3, M4A, M4BePub
FLAC, OGG, OPUSPDF
WAV, WMACBR, CBZ
AAC, AIFF

Prerequisites

Before deploying Audiobookshelf on Klutch.sh, ensure you have:

  • A Klutch.sh account with an active project
  • A GitHub repository for your deployment configuration
  • Your audiobook/podcast library ready to upload

Project Structure

Set up your Audiobookshelf deployment:

  • Directoryaudiobookshelf/
    • Dockerfile
    • docker-compose.yml (local development)
    • README.md

Deployment Configuration

Dockerfile

Create a Dockerfile for your Audiobookshelf deployment:

Dockerfile
FROM ghcr.io/advplyr/audiobookshelf:latest
# Set timezone (adjust to your timezone)
ENV TZ=America/New_York
# Expose the internal port (container listens on port 80)
EXPOSE 80
# Create necessary directories
RUN mkdir -p /audiobooks /podcasts /config /metadata
# Default command is already set in base image

Custom Dockerfile with Additional Configuration

For more control over your deployment:

Dockerfile
FROM ghcr.io/advplyr/audiobookshelf:latest
# Environment configuration
ENV TZ=America/New_York
ENV NODE_ENV=production
# Create directory structure
RUN mkdir -p /audiobooks /podcasts /ebooks /config /metadata
# Set permissions
RUN chmod -R 755 /audiobooks /podcasts /ebooks /config /metadata
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
EXPOSE 80

Environment Variables

Audiobookshelf supports extensive configuration through environment variables:

VariableDefaultDescription
TZUTCServer timezone
CONFIG_PATH/configPath to configuration directory
METADATA_PATH/metadataPath to metadata directory
PORT80Internal listening port
HOST0.0.0.0Host to bind to
ACCESS_TOKEN_EXPIRY43200Access token expiry in seconds (12 hours)
REFRESH_TOKEN_EXPIRY604800Refresh token expiry in seconds (7 days)
ALLOW_CORS0Enable CORS (set to 1)

Local Development with Docker Compose

Test your Audiobookshelf setup locally:

docker-compose.yml
services:
audiobookshelf:
image: ghcr.io/advplyr/audiobookshelf:latest
container_name: audiobookshelf
ports:
- "13378:80"
volumes:
- ./audiobooks:/audiobooks
- ./podcasts:/podcasts
- ./ebooks:/ebooks
- audiobookshelf-config:/config
- audiobookshelf-metadata:/metadata
environment:
- TZ=America/New_York
restart: unless-stopped
volumes:
audiobookshelf-config:
audiobookshelf-metadata:

Deploying to Klutch.sh

  1. Push your repository to GitHub

    1. Initialize your Git repository and commit the Dockerfile
    Terminal window
    git init
    git add .
    git commit -m "Initial Audiobookshelf configuration"
    git remote add origin https://github.com/yourusername/audiobookshelf.git
    git push -u origin main
  2. Create a new app on Klutch.sh

    1. Navigate to your Klutch.sh dashboard at klutch.sh/app
    2. Select your project or create a new one
    3. Click Create App and connect your GitHub repository
    4. Klutch.sh will automatically detect your Dockerfile
  3. Configure environment variables

    1. In your app settings, add the following environment variables
    VariableValue
    TZYour timezone (e.g., America/New_York)
  4. Configure the internal port

    1. Set the internal port to 80 (Audiobookshelf’s default container port)
    2. Select HTTP as the traffic type
  5. Set up persistent storage

    1. Add persistent volumes for your audiobook library and server data
    Mount PathSizePurpose
    /audiobooks100 GB+Your audiobook library (adjust based on collection)
    /podcasts50 GBPodcast episodes
    /ebooks10 GBEbook files
    /config1 GBDatabase and user settings
    /metadata10 GBCovers, cache, backups, and logs
  6. Deploy your application

    1. Click Deploy to build and launch your Audiobookshelf server
    2. Monitor the build logs for any issues
    3. Once deployed, your server will be available at https://your-app.klutch.sh
  7. Create your admin account

    1. Visit your deployed server URL
    2. Create your initial admin account on first access
    3. Set up your first library by pointing to your mounted directories

Initial Server Setup

Creating Your First Library

After your first login:

  1. Click Settings (gear icon) → Libraries
  2. Click Add Library
  3. Choose library type: Audiobooks or Podcasts
  4. Set the library name and folders:
    • Audiobooks: /audiobooks
    • Podcasts: /podcasts
    • Ebooks: Add /ebooks to an audiobook library
  5. Click Create and let the scanner index your library

Organize your audiobooks for optimal metadata detection:

/audiobooks/
├── Terry Goodkind/ # Author folder
│ └── Sword of Truth/ # Series folder
│ ├── Vol 1 - 1994 - Wizards First Rule/
│ │ ├── Audio Track 1.mp3
│ │ ├── Audio Track 2.mp3
│ │ └── cover.jpg
│ └── Vol 2 - 1995 - Stone of Tears/
│ └── Audiobook.m4b
└── Steven Levy/
└── Hackers - Heroes of the Computer Revolution/
└── Audiobook.m4a

Title Folder Naming Patterns

Audiobookshelf parses folder names for metadata:

PatternExample
Title onlyWizards First Rule
With narratorWizards First Rule {'{'}Sam Tsoutsouvas{'}'}
With year1994 - Wizards First Rule
With seriesVol 1 - 1994 - Wizards First Rule
Full formatVol. 1 - 1994 - Wizards First Rule - Subtitle {'{'}Narrator{'}'}

Mobile App Setup

Android App

  1. Download from Google Play Store
  2. Open the app and tap Add Server
  3. Enter your server URL: https://your-app.klutch.sh
  4. Log in with your credentials
  5. Download books for offline listening

iOS App

  1. Join the TestFlight beta
  2. Install the app through TestFlight
  3. Configure your server connection
  4. Enjoy offline listening on your iOS device

Managing Podcasts

Adding a Podcast

  1. Navigate to your Podcasts library
  2. Click Add Podcast
  3. Search by name or paste an RSS feed URL
  4. Configure auto-download settings
  5. Click Subscribe

Auto-Download Settings

SettingDescription
Auto DownloadEnable automatic episode downloads
Max EpisodesLimit downloaded episodes to save space
ScheduleSet check interval (hourly, daily, etc.)

User Management

Creating Additional Users

  1. Go to SettingsUsers
  2. Click Create User
  3. Set username, password, and user type
  4. Configure library access permissions

User Types

TypeDescription
AdminFull server access and configuration
UserCan access assigned libraries and features
GuestLimited access, view-only

API Integration

Audiobookshelf provides a comprehensive REST API for integrations:

Terminal window
# Get all libraries
curl "https://your-app.klutch.sh/api/libraries" \
-H "Authorization: Bearer YOUR_TOKEN"
# Get library items
curl "https://your-app.klutch.sh/api/libraries/{library-id}/items" \
-H "Authorization: Bearer YOUR_TOKEN"
# Get listening progress
curl "https://your-app.klutch.sh/api/me/listening-sessions" \
-H "Authorization: Bearer YOUR_TOKEN"

Full API documentation: api.audiobookshelf.org

Metadata Management

Fetching Metadata

  1. Select a book in your library
  2. Click Match to search providers
  3. Choose from results: Audnexus, Google Books, Open Library, iTunes
  4. Apply metadata and cover art

Embedding Metadata

Write metadata directly into your audio files:

  1. Select books to update
  2. Click ToolsEmbed Metadata
  3. Choose options (metadata, chapters, cover)
  4. Process files

Backups and Restoration

Automatic Backups

Audiobookshelf creates automatic daily backups:

  • Stored in /metadata/backups
  • Contains database and metadata
  • Configure retention in SettingsBackups

Manual Backup

  1. Go to SettingsBackups
  2. Click Create Backup
  3. Download the backup file for off-site storage

Restoring from Backup

  1. Go to SettingsBackups
  2. Upload your backup file
  3. Click Restore
  4. Restart the server if prompted

Security Configuration

Strong Passwords

Use complex passwords for all user accounts

HTTPS Enabled

Klutch.sh provides automatic SSL certificates

Rate Limiting

Built-in protection against brute force attacks

Token Security

Secure JWT tokens with configurable expiry

Security Environment Variables

# Add to your Dockerfile for additional security
ENV ACCESS_TOKEN_EXPIRY=43200
ENV REFRESH_TOKEN_EXPIRY=604800
ENV RATE_LIMIT_AUTH_MAX=40
ENV RATE_LIMIT_AUTH_WINDOW=600000

Troubleshooting

Common issues and solutions:

IssueCauseSolution
Library not scanningWrong folder permissionsEnsure proper permissions on mounted volumes
No cover artMetadata not fetchedUse Match feature to fetch from providers
Mobile app can’t connectWebSocket issuesVerify HTTPS is working correctly
Progress not syncingToken expiredLog out and back in on the mobile app
Audio not playingCodec not supportedConvert to a supported format like M4B

Viewing Logs

Access logs in /metadata/logs or through the web interface:

  1. Go to SettingsLogs
  2. Filter by level (Error, Warning, Info, Debug)
  3. Download logs for support requests

Performance Optimization

For Large Libraries

# Add SQLite optimizations for large libraries
ENV SQLITE_MMAP_SIZE=268435456
ENV SQLITE_CACHE_SIZE=10000

Transcoding Settings

Audiobookshelf transcodes audio on-the-fly. For better performance:

  1. Go to SettingsGeneral
  2. Adjust Max Transcode Workers based on server CPU
  3. Consider pre-converting to M4B for direct playback

Additional Resources