Remote Server
AN Player can connect to a standalone server running on another computer. Use this when you want plugins to run outside the Android app, for example on a desktop, laptop, mini PC, or home server.
Install Node.js
The server runs with Node.js. Install the current LTS version from nodejs.org, then confirm it is available:
node --versionmacOS
Install Node.js from the official macOS installer, or use Homebrew:
brew install node
node --versionLinux
Install Node.js from your distribution package manager or from NodeSource. On Ubuntu or Debian, the package manager flow looks like this:
sudo apt update
sudo apt install nodejs npm
node --versionIf your distribution provides an old Node.js version, use the official downloads or NodeSource packages instead.
Windows
Install the Windows LTS installer from nodejs.org. After installation, open PowerShell and check:
node --versionDownload The Server
Download server.js and place it in a folder that will hold the server data. The server stores installed plugins and temporary files in the storage folder you configure.
Example folder layout:
anplayer-server/
server.js
data/Start The Server
Choose an auth token before starting the server. This token is required when you add the remote server in AN Player.
macOS Or Linux
mkdir -p anplayer-server/data
cd anplayer-server
ANPLAYER_SERVER_AUTH_TOKEN="change-this-token" \
ANPLAYER_SERVER_HOST="0.0.0.0" \
ANPLAYER_SERVER_PORT="5556" \
ANPLAYER_SERVER_STORAGE="./data" \
node server.jsWindows PowerShell
New-Item -ItemType Directory -Force .\anplayer-server\data
Set-Location .\anplayer-server
$env:ANPLAYER_SERVER_AUTH_TOKEN = "change-this-token"
$env:ANPLAYER_SERVER_HOST = "0.0.0.0"
$env:ANPLAYER_SERVER_PORT = "5556"
$env:ANPLAYER_SERVER_STORAGE = ".\data"
node .\server.jsWhen the server starts, add it in AN Player with:
- Host:
http://<computer-ip>:5556 - Auth token: the same token passed as
ANPLAYER_SERVER_AUTH_TOKEN
Configuration
You can configure the server with environment variables or positional arguments.
Environment Variables
| Variable | Default | Description |
|---|---|---|
ANPLAYER_SERVER_PORT | 5556 | HTTP port used by the server. |
ANPLAYER_SERVER_STORAGE | Server script folder | Folder used for plugins, temporary files, and the server id. |
ANPLAYER_SERVER_HOST | 127.0.0.1 | Address to bind. Use 0.0.0.0 to accept connections from other devices on your network. |
ANPLAYER_SERVER_ID | Generated automatically | Optional stable server id. Leave empty unless you need to preserve a specific id. |
ANPLAYER_SERVER_AUTH_TOKEN | Empty | Bearer token required for /api routes. Set this for any remote server. |
ANPLAYER_SERVER_AUTH_THROTTLE_ATTEMPTS | 10 | Failed auth attempts before temporary lockout. |
ANPLAYER_SERVER_AUTH_THROTTLE_TIMEOUT_MS | 300000 | Auth throttle window and lockout duration in milliseconds. |
Positional Arguments
The same values can be passed after server.js in this order:
node server.js <port> <storagePath> <host> <serverId> <authToken> <throttleAttempts> <throttleTimeoutMs>Example:
node server.js 5556 ./data 0.0.0.0 my-server change-this-token 10 300000Keep The Token Private
Anyone with the auth token can use the server API. Use a long random token, keep it private, and change it if you think it was shared accidentally.
You can generate a token with Node.js:
node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))"