A simple and efficient Wake-on-LAN API built with Hono and Bun. This API allows you to wake up devices on your local network using Wake-on-LAN functionality.
- 🚀 Fast Performance - Built with Bun runtime for optimal speed
- 🔧 Simple API - Single endpoint for Wake-on-LAN functionality
- 🐳 Docker Support - Easy deployment with Docker and Docker Compose
- 🔒 API Key Authentication - Secure access with API key validation
- 📡 Network Broadcasting - Configurable IP address and MAC address targeting
- ⚡ Hot Reload - Development mode with hot reloading support
- Bun (for local development)
- Docker (for containerized deployment)
- Docker Compose (for orchestrating containers)
-
Clone the repository
git clone https://github.com/BramSuurdje/wol-api.git cd wol-api -
Install dependencies
bun install
-
Start the development server
bun run dev
-
Access the API Open your browser to http://localhost:3000
-
Build and start with Docker Compose
docker-compose up -d
-
View logs
docker-compose logs -f
-
Stop the application
docker-compose down
-
Rebuild after changes
docker-compose up --build -d
POST /wake
Wakes up a device using Wake-on-LAN magic packet.
Headers:
x-api-key: Your API key (required)Content-Type:application/json
Example Request:
curl -X POST http://localhost:3000/wake \
-H "x-api-key: jBqqNSgG2gYiGfYDI9dmyLL8nT5E9PnQDwpFbbZM4b" \
-H "Content-Type: application/json"Success Response (200):
{
"message": "OK",
"timestamp": "2024-01-15T10:30:00.000Z"
}Error Response (401 - Invalid API Key):
{
"error": "Invalid API key"
}Error Response (500 - Wake Failure):
{
"error": "Failed to wake up"
}WOL-API/
├── src/
│ └── index.ts # Main application file
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentation
- Ensure Docker and Docker Compose are installed
- Run
docker-compose up -din the project root - Your API will be available at
http://localhost:3000
- Install Bun on your target system
- Install dependencies:
bun install --production - Start the server:
bun run src/index.ts - Configure your reverse proxy (nginx, Apache, etc.) to forward requests to port 3000
This project is licensed under the MIT License - see the LICENSE file for details.