Note: This README reflects the latest development version. For documentation specific to the latest stable release, please check the latest release on GitHub.
Automatically syncs your Audiobookshelf library with Hardcover, including reading progress, book status, and ownership information.
audiobookshelf-hardcover-sync now supports multiple sync profiles with a modern web interface and secure token management!
http://localhost:8080# Using config file (recommended) # Set enable_web_ui: true in your config.yaml ./audiobookshelf-hardcover-sync --server-only ```
Access the web interface: Open http://localhost:8080 in your browser
Add Sync Profiles: Use the "Add Profile" tab to create profiles with individual tokens
Monitor syncs: View real-time sync status and control operations
Existing single-profile setups are automatically migrated on first startup:
config.yaml is detected and backed uphttp://localhost:8080| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Web management interface |
GET |
/api/profiles |
List all sync profiles |
POST |
/api/profiles |
Create new sync profile |
GET |
/api/profiles/{id} |
Get profile details |
PUT |
/api/profiles/{id} |
Update profile |
DELETE |
/api/profiles/{id} |
Delete profile |
PUT |
/api/profiles/{id}/config |
Update profile configuration |
GET |
/api/profiles/{id}/status |
Get sync status |
POST |
/api/profiles/{id}/sync |
Start sync |
DELETE |
/api/profiles/{id}/sync |
Cancel sync |
GET |
/api/status |
All profile statuses |
| Variable | Description | Default |
|---|---|---|
ENCRYPTION_KEY |
Base64-encoded 32-byte encryption key (auto-generated if not set) | Auto-generated |
DATA_DIR |
Directory for database and encryption files | ./data |
The project follows standard Go project layout:
.
├── cmd/ # Main application entry points
│ └── audiobookshelf-hardcover-sync/ # Main application
├── internal/ # Private application code
│ ├── api/ # Multi-user API handlers
│ │ ├── audiobookshelf/ # Audiobookshelf API client
│ │ ├── hardcover/ # Hardcover API client
│ │ └── handlers.go # REST API endpoints
│ ├── auth/ # Authentication system
│ │ ├── handlers.go # Auth HTTP handlers (login/logout)
│ │ ├── local.go # Local username/password provider
│ │ ├── middleware.go # Auth middleware and RBAC
│ │ ├── models.go # User, session, provider models
│ │ ├── oidc.go # Keycloak/OIDC provider
│ │ ├── provider.go # Auth provider interface
│ │ ├── repository.go # Database operations
│ │ ├── service.go # Auth service orchestration
│ │ └── session.go # Session management
│ ├── config/ # Configuration loading and validation
│ ├── crypto/ # Encryption utilities
│ │ └── encryption.go # AES-256-GCM token encryption
│ ├── database/ # Database layer
│ │ ├── database.go # Connection management
│ │ ├── migration.go # Single-user to multi-user migration
│ │ ├── models.go # User, config, sync state models
│ │ └── repository.go # CRUD operations
│ ├── logger/ # Structured logging
│ ├── models/ # Data structures
│ ├── multiuser/ # Multi-user service
│ │ └── service.go # User management and sync orchestration
│ ├── server/ # HTTP server
│ │ └── server.go # Routing and middleware setup
│ ├── services/ # Business logic
│ ├── sync/ # Sync logic
│ └── utils/ # Utility functions
├── pkg/ # Public libraries
│ ├── cache/ # Caching implementation
│ ├── edition/ # Edition creation logic
│ └── mismatch/ # Mismatch detection
├── web/ # Web UI assets
│ └── static/ # Static files
│ ├── app.js # Multi-user management JavaScript
│ ├── index.html # Web dashboard
│ ├── login.html # Authentication login page
│ └── styles.css # Modern responsive styling
├── docs/ # Documentation
│ ├── AUTHENTICATION.md # Authentication setup guide
│ └── helm-chart-publishing.md # Helm deployment guide
├── helm/ # Kubernetes Helm chart
│ └── audiobookshelf-hardcover-sync/
└── test/ # Test files
├── testdata/ # Test data
├── unit/ # Unit tests
├── integration/ # Integration tests
└── e2e/ # End-to-end tests
http://localhost:8080/api/me endpoint for accurate finished book detection, preventing false re-read scenariosClone the repository:
sh
git clone https://github.com/drallgood/audiobookshelf-hardcover-sync.git
cd audiobookshelf-hardcover-sync
Install dependencies:
sh
make deps
3.### Configuration
Create a config.yaml file based on the example:
cp config.example.yaml config.yaml
Edit the configuration to match your environment. See Configuration Reference for all available options.
Deprecation Notice: The
appsection in the configuration is now deprecated and will be removed in a future version. Please migrate to the newsyncsection.
Migrating from old configuration (app.) to new configuration (sync.):
# Old deprecated format (app.*):
# app:
# sync_interval: "1h"
# minimum_progress: 0.01
# sync_want_to_read: true
# sync_owned: false
# dry_run: false
# New format (sync.*):
sync:
sync_interval: "1h"
minimum_progress: 0.01
sync_want_to_read: true
sync_owned: false
dry_run: false
# Other sync settings...
The application will automatically migrate settings from the old app section to the new sync section and log a warning if any deprecated settings are found.
sh
make build
./bin/audiobookshelf-hardcover-syncCreate a project directory and navigate to it:
bash
mkdir -p ~/abs-hardcover-sync && cd ~/abs-hardcover-sync
Create a docker-compose.yml file: ```yaml version: '3.8'
services: audiobookshelf-hardcover-sync: image: ghcr.io/drallgood/audiobookshelf-hardcover-sync:latest container_name: abs-hardcover-sync restart: unless-stopped volumes: - ./config:/app/config # For configuration files - ./data:/app/data # For persistent storage and state - ./logs:/app/logs # For log files (optional) # Optional environment variables (config file takes precedence) environment: - CONFIG_PATH=/app/config/config.yaml - LOG_LEVEL=info healthcheck: test: ["CMD", "wget", "--spider", "http://localhost:8080/healthz"] interval: 30s timeout: 10s retries: 3 start_period: 10s ```
Create a config directory and config.yaml file:
bash
mkdir -p config && touch config/config.yaml
Add your configuration to config.yaml: ```yaml audiobookshelf: url: https://your-abs-server.com token: your_abs_token
hardcover: token: your_hardcover_token
sync: interval: 10m state_file: /app/data/sync_state.json
logging: level: info format: json # or text for improved readability during development ```
Create data directories:
bash
mkdir -p data logs
Start the service:
bash
docker compose up -d
View logs: ```bash # Follow logs docker compose logs -f
# View recent logs (last 100 lines) docker compose logs --tail=100
# View logs for a specific time period docker compose logs --since 1h ```
# Restart the service docker compose restart
# Update to the latest version docker compose pull docker compose up -d --force-recreate ```
For Kubernetes deployments, use the official Helm chart:
helm repo add audiobookshelf-hardcover-sync \ https://drallgood.github.io/audiobookshelf-hardcover-sync/stable
helm repo add audiobookshelf-hardcover-sync-dev \ https://drallgood.github.io/audiobookshelf-hardcover-sync/dev helm repo update ``
$ claude mcp add audiobookshelf-hardcover-sync \
-- python -m otcore.mcp_server <graph>