Skip to content

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.

Download server.js

Install Node.js ​

The server runs with Node.js. Install the current LTS version from nodejs.org, then confirm it is available:

sh
node --version

macOS ​

Install Node.js from the official macOS installer, or use Homebrew:

sh
brew install node
node --version

Linux ​

Install Node.js from your distribution package manager or from NodeSource. On Ubuntu or Debian, the package manager flow looks like this:

sh
sudo apt update
sudo apt install nodejs npm
node --version

If 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:

powershell
node --version

Download 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:

txt
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 ​

sh
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.js

Windows PowerShell ​

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.js

When 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 ​

VariableDefaultDescription
ANPLAYER_SERVER_PORT5556HTTP port used by the server.
ANPLAYER_SERVER_STORAGEServer script folderFolder used for plugins, temporary files, and the server id.
ANPLAYER_SERVER_HOST127.0.0.1Address to bind. Use 0.0.0.0 to accept connections from other devices on your network.
ANPLAYER_SERVER_IDGenerated automaticallyOptional stable server id. Leave empty unless you need to preserve a specific id.
ANPLAYER_SERVER_AUTH_TOKENEmptyBearer token required for /api routes. Set this for any remote server.
ANPLAYER_SERVER_AUTH_THROTTLE_ATTEMPTS10Failed auth attempts before temporary lockout.
ANPLAYER_SERVER_AUTH_THROTTLE_TIMEOUT_MS300000Auth throttle window and lockout duration in milliseconds.

Positional Arguments ​

The same values can be passed after server.js in this order:

sh
node server.js <port> <storagePath> <host> <serverId> <authToken> <throttleAttempts> <throttleTimeoutMs>

Example:

sh
node server.js 5556 ./data 0.0.0.0 my-server change-this-token 10 300000

Keep 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:

sh
node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))"