GitHub - ClassicOldSong/Plexsonic: Plex Music to Subsonic bridge

3 min read Original article ↗

Plexsonic

Plexsonic is a local bridge that exposes a Plex music library through Subsonic/OpenSubsonic-compatible endpoints.

It provides:

  • Local account signup/login
  • Plex account linking via Plex PIN
  • Plex server and music library selection
  • Subsonic-compatible /rest/*.view API for clients
  • Web test page for manual API checks
  • Playback/scrobble/rating/playlist actions mapped to Plex

To support this project, please subscribe to my Patreon.

Support me on Patreon

Requirements

  • Node.js 18+ (Node 20 recommended)
  • pnpm
  • A reachable Plex Media Server with a music library
  • A Plex account with access to that server

Install

pnpm install
cp .env.example .env

Global CLI install

Install globally from this repo:

pnpm add -g plexsonic
# or
npm install -g plexsonic

Then run:

Configuration

Edit .env:

PORT=3127
BIND_HOST=127.0.0.1
BASE_URL=
SQLITE_PATH=./data/app.db
SESSION_SECRET=replace-with-a-long-random-secret
TOKEN_ENC_KEY=
PLEX_PRODUCT=Plexsonic Bridge
PLEX_CLIENT_IDENTIFIER=
LICENSE_EMAIL=
PLEX_INSECURE_TLS=0
LOG_LEVEL=warn
LOG_REQUESTS=0

Important env vars

  • PORT: HTTP port (default 3127).
  • BIND_HOST: listen interface (127.0.0.1 local only, 0.0.0.0 for LAN).
  • BASE_URL: optional public URL override used for callback generation. If empty, origin is derived from request headers.
  • SESSION_SECRET: cookie/session signing secret. Keep stable across restarts.
  • TOKEN_ENC_KEY: optional but recommended 32-byte key (hex or base64) used to encrypt stored Plex tokens.
  • LOG_LEVEL: logger level (trace, debug, info, warn, error, fatal).
  • LOG_REQUESTS: set to 1 to enable incoming request logs. Very verbose, and can expose your login credeitial. (0 by default).

Generate secrets (examples):

# SESSION_SECRET
openssl rand -hex 32

# TOKEN_ENC_KEY (hex)
openssl rand -hex 32

Run

Or, if installed globally:

Dev mode:

Docker

Build and run with Compose:

docker compose up -d --build

Notes:

  • Compose maps 3127:3127.
  • ./data is mounted to /app/data for SQLite persistence.
  • docker-compose.yml uses ${VAR:-default} interpolation.
  • You should change at least:
    • SESSION_SECRET
    • TOKEN_ENC_KEY (recommended)
    • BASE_URL only if auto-detected origin is wrong in your proxy/network setup

Override via CLI (without editing compose):

SESSION_SECRET='replace-me' \
TOKEN_ENC_KEY='your-32-byte-key' \
BASE_URL='http://192.168.1.50:3127' \
docker compose up -d --build

Or with an env file:

docker compose --env-file .env up -d --build

Stop:

Health check:

curl http://127.0.0.1:3127/health

Web Setup Flow

  1. Open http://127.0.0.1:3127/signup
  2. Create a local Plexsonic account
  3. Link Plex (/link/plex) and complete PIN auth
  4. Select Plex server
  5. Select music library
  6. Open /test to run quick API checks

Using From Subsonic/OpenSubsonic Clients

Use:

  • Server URL: http://<host>:3127
  • Username/password: your local Plexsonic account

Endpoint suffix compatibility

Both endpoint styles are accepted:

  • /rest/getArtists.view
  • /rest/getArtists

Expose to LAN

Set:

BIND_HOST=0.0.0.0
# Optional when auto-detection is not correct:
# BASE_URL=http://<your-lan-ip>:3127

Then:

  • Open firewall inbound TCP 3127
  • Keep it LAN-only (do not expose directly to the internet)

If you run behind a reverse proxy, forward X-Forwarded-Proto and X-Forwarded-Host so Plex PIN callbacks use the correct public origin.

Without HTTPS, credentials travel unencrypted on your network.

Notes

  • This project currently targets practical client compatibility over strict parity with any single server implementation.
  • Some Subsonic features may be partially implemented or client-dependent.

License

Apache-2.0