A lightweight application to remotely shutdown or restart your Windows laptop from an Android device over a local network.
- Node.js Server - Runs on the Windows laptop
- Android Interface - For sending commands to the server
- Make sure Node.js is installed on your laptop
- Navigate to the
server
directory:cd server
- Install dependencies:
npm install
- Configure environment variables:
- Copy the
.env.example
file to.env
- Edit the
.env
file and replace theAPI_KEY
value with your secret key
- Copy the
- Start the server:
npm start
- Ensure your laptop and Android device are on the same Wi-Fi network
- Note your laptop's IP address (use
ipconfig
in Windows command prompt) - Open the Android app and enter your laptop's IP and API key
- Use the buttons in the app to shutdown or restart your laptop
GET /api/status
- Check server statusPOST /shutdown
- Shutdown the laptopPOST /restart
- Restart the laptopPOST /cancel
- Cancel pending shutdown/restart command
All POST endpoints require an x-api-key
header with the correct API key value.
- Use a strong and complex API key in the
.env
file - Use only on secure local networks
- Avoid exposing the server port to the public internet
- Never store the
.env
file in your code repository
Use applications like HTTP Request Widget, Tasker, or create a simple custom Android app to send requests to the server. Alternatively, use the included web interface by visiting your server's URL from any browser.
To run the server automatically at Windows startup, create a shortcut to the following batch file and place it in the Windows Startup folder:
-
Create a
start_shutoff_server.bat
file with the following content:@echo off cd /d "PATH_TO_SERVER_DIRECTORY" npm start
-
Replace
PATH_TO_SERVER_DIRECTORY
with the full path to your server directory -
Press Win+R, type
shell:startup
and press Enter -
Place the shortcut to the batch file in that folder