A pure Go Docker application that authenticates with Audible, downloads audiobooks, removes DRM via FFmpeg, fetches enriched metadata from Audnexus, and organizes files in Plex-compatible Author/Title/Title.m4b structure.
┌─────────────────────────────────────────────────────────────────┐
│ Docker Container (~80MB) │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Go Binary │ │ FFmpeg │ │ Alpine Linux │ │
│ │ (~15MB) │ │ (~30MB) │ │ (~5MB) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ Volumes │
│ /config (auth, db) │ /audiobooks (Plex) │ /downloads (temp)│
└─────────────────────────────────────────────────────────────────┘
| Component | Technology | Purpose |
|---|---|---|
| Auth & API | Pure Go (go-audible lib) |
OAuth, device registration, Audible API |
| Web UI | HTMX + Go templates | Dashboard, library browser, settings |
| Audio Processing | FFmpeg (subprocess) | AAX decryption, format conversion |
| Metadata | Audnexus API | Enriched book/author/chapter data |
| Database | SQLite (default) / PostgreSQL | Library state, queue, settings |
| Scheduler | robfig/cron |
Automated library sync |
- Authentication: Browser-based OAuth flow with Audible/Amazon
- Library Sync: Automatic detection of new purchases (scheduled or manual)
- Download Queue: Concurrent downloads with progress tracking
- DRM Removal: FFmpeg-based decryption (AAX activation bytes, AAXC voucher)
- Output Formats: M4B (single file) or MP3 (chapter-split), configurable
- Metadata: Audnexus-enriched tags embedded in audio files
- Plex Structure:
{Author}/{Title}/{Title}.m4b+{Title}.chapters.txt - Web Dashboard: Real-time progress via SSE, library browser, settings
-
Initialize Go module
go mod init github.com/nick/audplexus
-
Create Dockerfile
- Multi-stage build:
golang:1.22-alpine→alpine:3.19 - Install FFmpeg, ca-certificates
- Expose port 8080
- Multi-stage build:
-
Set up docker-compose.yml
services: audible-plex: build: . ports: - "8080:8080" volumes: - ./config:/config - /path/to/audiobooks:/audiobooks - ./downloads:/downloads environment: - DATABASE_TYPE=sqlite # or postgres
-
Database abstraction
- Interface supporting SQLite and PostgreSQL
- Tables:
books,download_queue,sync_history,settings,devices - Migrations via
golang-migrate
-
Import go-audible library
- OAuth flow integration
- Credential storage (encrypted)
- API client for library/download operations
-
Library sync service
- Fetch full library with pagination
- Compare with local DB, identify new titles
- Queue new books for download
-
Download manager
- Concurrent downloads (configurable, default 2)
- Progress tracking
- Resumable downloads
-
DRM removal pipeline
- FFmpeg wrapper for AAX:
ffmpeg -activation_bytes <bytes> -i input.aax -c copy output.m4b - FFmpeg wrapper for AAXC:
ffmpeg -audible_key <key> -audible_iv <iv> -i input.aaxc -c copy output.m4b - Integrity validation (duration check)
- FFmpeg wrapper for AAX:
-
Format conversion
- M4B: Direct copy from decrypted (fastest)
- MP3: Chapter-split using FFmpeg + chapters metadata
-
Cover art processing
- Download high-res cover
- Embed in M4B
- Save standalone
cover.jpg
-
Audnexus API client
GET /books/{asin}- Book metadataGET /authors/{asin}- Author detailsGET /chapters/{asin}- Chapter info- Fallback to Audible data if unavailable
-
Metadata processor
- Merge Audnexus + Audible (Audnexus preferred)
- Fields: title, author, narrator, series, position, description, genres
-
File tagger
- Embed via FFmpeg metadata options
- ID3/MP4 tags
-
File organizer
- Structure:
{library_root}/{Author}/{Title}/{Title}.{ext} - Sanitize filenames (remove
<>:"/\|?*) - Series handling:
{Title} - {Series}, Book {N}
- Structure:
-
Chapter file generation
-
{Title}.chapters.txtformat:00:00:00.000 Opening Credits 00:01:23.456 Chapter 1 00:45:12.789 Chapter 2 ...
-
-
Post-processing
- Clean temp files
- Update database
- Optional: Trigger Plex library scan via API
-
HTMX-based interface
- Dashboard: overview, recent downloads, sync status
- Library browser: searchable/sortable table
- Book detail: metadata, cover, actions
- Download queue: progress bars (SSE)
- Settings: auth, output format, paths, schedule
-
Authentication UI
/auth/start- Redirect to Amazon OAuth/auth/callback- Receive authorization code/auth/status- Current auth state
-
Cron scheduler
- Library sync: hourly/daily/weekly/disabled
- Manual trigger via UI
- Quiet hours configuration
-
Notifications (future)
- Webhook on download complete
- Discord/Slack integration
audplexus/
├── cmd/
│ └── server/
│ └── main.go # Entry point
├── internal/
│ ├── audnexus/
│ │ └── client.go # Audnexus API client
│ ├── audio/
│ │ ├── ffmpeg.go # FFmpeg wrapper
│ │ ├── decrypt.go # DRM removal
│ │ ├── convert.go # Format conversion
│ │ └── tag.go # Metadata embedding
│ ├── database/
│ │ ├── interface.go # DB abstraction
│ │ ├── sqlite.go
│ │ ├── postgres.go
│ │ ├── models.go # Data models
│ │ └── migrations/
│ │ └── 001_initial.sql
│ ├── library/
│ │ ├── sync.go # Library sync logic
│ │ └── download.go # Download manager
│ ├── organizer/
│ │ └── plex.go # File organization
│ ├── scheduler/
│ │ └── cron.go # Scheduled jobs
│ └── web/
│ ├── server.go # HTTP server
│ ├── handlers/
│ │ ├── auth.go
│ │ ├── library.go
│ │ ├── downloads.go
│ │ └── settings.go
│ ├── templates/
│ │ ├── base.html
│ │ ├── dashboard.html
│ │ ├── library.html
│ │ ├── auth.html
│ │ └── settings.html
│ └── static/
│ ├── htmx.min.js
│ └── style.css
├── Dockerfile
├── docker-compose.yml
├── go.mod
├── go.sum
├── config.example.yaml
├── PLAN.md
└── README.md
| Package | Purpose |
|---|---|
github.com/mstrhakr/go-audible |
Audible auth & API |
github.com/gin-gonic/gin |
HTTP router |
github.com/mattn/go-sqlite3 |
SQLite driver |
github.com/lib/pq |
PostgreSQL driver |
github.com/golang-migrate/migrate/v4 |
Migrations |
github.com/robfig/cron/v3 |
Scheduler |
github.com/rs/zerolog |
Logging |
# config.yaml
server:
port: 8080
database:
type: sqlite # sqlite | postgres
path: /config/audible.db # for sqlite
# dsn: postgres://user:pass@host/db # for postgres
paths:
audiobooks: /audiobooks
downloads: /downloads
config: /config
output:
format: m4b # m4b | mp3
embed_cover: true
chapter_file: true
sync:
schedule: "0 */6 * * *" # every 6 hours
enabled: true
plex:
url: http://plex:32400
token: "" # optional, for library scan trigger- go-audible: Pure Go Audible authentication and API library (separate repo)
- FFmpeg: Audio processing (bundled in Docker image)
- Docker image builds successfully (< 100MB)
- OAuth flow completes in browser
- Library sync detects all owned books
- AAX download and decryption works
- AAXC download and decryption works
- Metadata embedded correctly
- Files organized as
{Author}/{Title}/{Title}.m4b - Chapter file generated
- Plex detects and displays audiobook
- Audnexus metadata shows in Plex (via audnexus plugin)
- Scheduled sync runs on time
- Web UI functional on mobile
- Multi-region support (UK, DE, FR, etc.)
- Wishlist sync and purchase notifications
- Audiobookshelf compatibility mode
- Podgrab-style podcast support (Audible podcasts)
- Discord/Slack notifications
- Bulk re-download with updated metadata