Skip to main content
The PopLock API is a single file with no npm dependencies. Installation is a copy-and-configure process.

Prerequisites

  • Node.js available at /usr/bin/node
  • systemd for service management
  • openssl for key generation

Steps

1

Copy the application file

Copy the script to your system binaries directory:
sudo cp poplock-api.js /usr/local/bin/poplock-api.js
2

Set up the config file

Copy the config template and lock down its permissions:
sudo cp poplock-api.conf /etc/poplock-api.conf
sudo chmod 600 /etc/poplock-api.conf
The config file contains your API key. Keep permissions set to 600 so only root can read it. Wider permissions expose your key to all local users.
3

Generate an API key

Generate a secure 32-byte hex string:
openssl rand -hex 32
Open the config file in a text editor and replace REPLACE_WITH_YOUR_SECRET_KEY with the generated string:
sudo nano /etc/poplock-api.conf
The config file format is:
# /etc/poplock-api.conf
API_KEY=your_secret_key_here
PORT=6767
The port can be changed by setting PORT= in /etc/poplock-api.conf or by setting the PORT environment variable before starting the service. The default is 6767.
4

Install the systemd service

Before copying, open poplock-api.service and update the User and Group fields to match the system user that owns the Minecraft server directory:
poplock-api.service
[Service]
User=your_username
Group=your_username
Then copy the unit file, reload systemd, and enable the service so it starts on boot:
sudo cp poplock-api.service /etc/systemd/system/poplock-api.service
sudo systemctl daemon-reload
sudo systemctl enable --now poplock-api
5

Verify it's running

Check the service status:
sudo systemctl status poplock-api
You should see active (running) in the output. The API will be listening on http://0.0.0.0:6767.