A lightweight Wake on LAN server that can be installed on Raspberry Pi or other lightweight Linux devices.
- Simple REST API for sending Wake on LAN packets
- JWT authentication for security
- Small memory footprint
- Systemd service for automatic startup
- CORS configuration for connecting from web applications
- for Raspberry Pi Zero 2W/3/4/5 or other lightweight Linux devices
- Node.js 12.x or higher
- Internet connection for installation
- The server must be on the same network as the devices you want to wake
- Download the latest release and extract it
- Run the installer script:
chmod +x install.sh
./install.sh
- Edit the configuration file:
sudo nano /opt/wol-server/.env
- Set your JWT_SECRET and ALLOWED_ORIGINS in the .env file
If you prefer to install manually:
- Install Node.js if not already installed
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
- Create a directory for the server
sudo mkdir -p /opt/wol-server
- Copy files and install dependencies
sudo cp wol-server.js package.json .env.example /opt/wol-server/
sudo mv /opt/wol-server/.env.example /opt/wol-server/.env
cd /opt/wol-server
npm install --production
- Create and enable systemd service
sudo nano /etc/systemd/system/wol-server.service
# Copy the service configuration from install.sh
sudo systemctl daemon-reload
sudo systemctl enable wol-server
sudo systemctl start wol-server
GET /api/status
Returns the server status and version.
POST /api/wake
Headers:
Authorization: Bearer [JWT_TOKEN]
Body:
{
"macAddress": "00:11:22:33:44:55",
"broadcastAddress": "255.255.255.255", (optional)
"port": 9 (optional)
}
To use this WOL server with the main Wake on LAN web app:
- In the main app, add your WOL server URL to the device settings
- Generate a JWT token with your secret or use the same JWT_SECRET as your main app
- Configure ALLOWED_ORIGINS to allow requests from your main app domain
- Check if the service is running:
sudo systemctl status wol-server
- View logs:
sudo journalctl -u wol-server -f
- Test API directly:
curl -X GET http://localhost:8080/api/status
MIT