---
title: "Deploy Audiobookshelf on Pethost in one click"
description: "Your own audiobook and podcast server: listen in the browser or the apps, with progress kept across devices. A template for Pethost: in a minute or two the app is live on your machine, with HTTPS at its own address and nightly backups."
---

[← All templates](https://pethost.dev/templates/)

# Deploy Audiobookshelf on Pethost in one click

Your own audiobook and podcast server: listen in the browser or the apps, with progress kept across devices

[Deploy on Pethost](https://console.pethost.dev/?template=audiobookshelf)

## What happens

1. You sign in to Pethost or make an account, with a passkey, GitHub or Google.
2. No machine yet? You pick a plan, and we prepare one for you. The link waits in your browser until it is ready.
3. New project opens at the app. You fill in what it asks for and click Create project: **Admin password**.
4. In a minute or two the app is live at its own address with HTTPS. Its secrets are made for it at random, and its data is in the nightly backup.
5. It is a project like any other: its compose.yaml, its .env, its logs and a terminal are in the panel, and your agent can change it, roll it back or restore it.

## First steps

Sign in as root with the admin password you gave: the server is set up with it before it answers, so nobody else gets its setup page. Create a library under Settings → Libraries with the folder /audiobooks or /podcasts, then add books with the upload button at the top.

## What it runs

The template is this compose.yaml and the variables it writes into the project’s .env. Pethost runs the file as it is written.

```
services:
  audiobookshelf:
    image: ghcr.io/advplyr/audiobookshelf:2.37.1
    restart: unless-stopped
    environment:
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    # The first visitor of a new server would create its root user. So, before it answers on its
    # own port, it is started on one nobody reaches and given root with the password asked.
    command:
      - sh
      - -c
      - |
        PORT=8081 node dist-server/index.js &
        setup=$$!
        node -e '
          const init = async () => {
            for (let i = 0; i < 180; i++) {
              try {
                const status = await fetch("http://127.0.0.1:8081/status").then((r) => r.json());
                if (status.isInit) return;
                const body = JSON.stringify({ newRoot: { username: "root", password: process.env.ADMIN_PASSWORD } });
                const answer = await fetch("http://127.0.0.1:8081/init", { method: "POST", headers: { "Content-Type": "application/json" }, body });
                if (answer.ok) return;
              } catch {}
              await new Promise((done) => setTimeout(done, 1000));
            }
            process.exit(1);
          };
          init();
        ' || exit 1
        kill $$setup
        wait $$setup
        exec node dist-server/index.js
    volumes:
      - config:/config
      - metadata:/metadata
      - audiobooks:/audiobooks
      - podcasts:/podcasts
volumes:
  config:
  metadata:
  audiobooks:
  podcasts:
```

[compose.yaml](https://pethost.dev/templates/audiobookshelf/compose.yaml)[See it on GitHub](https://github.com/pethost-dev/templates/tree/main/audiobookshelf)

Pethost · Stephan Gomer · NIP 1133096755

[Templates](https://pethost.dev/templates/) [About](https://pethost.dev/about/) [Blog](https://pethost.dev/blog/) [Terms](https://pethost.dev/terms/) [Privacy](https://pethost.dev/privacy/) [Refunds](https://pethost.dev/refunds/) [API](https://pethost.dev/docs/api/) [CLI](https://pethost.dev/docs/cli/) [Plugin](https://github.com/pethost-dev/plugin) [support@pethost.dev](mailto:support@pethost.dev)
