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/*.viewAPI 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.
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 plexsonicThen 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 (default3127).BIND_HOST: listen interface (127.0.0.1local only,0.0.0.0for 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 to1to enable incoming request logs. Very verbose, and can expose your login credeitial. (0by 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. ./datais mounted to/app/datafor SQLite persistence.docker-compose.ymluses${VAR:-default}interpolation.- You should change at least:
SESSION_SECRETTOKEN_ENC_KEY(recommended)BASE_URLonly 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
- Open
http://127.0.0.1:3127/signup - Create a local Plexsonic account
- Link Plex (
/link/plex) and complete PIN auth - Select Plex server
- Select music library
- Open
/testto 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