dev-notify-bridge
v1.0.3
Published
Lightweight local HTTP bridge that delivers native desktop notifications for containerized or remote Node.js environments (Docker, WSL)
Maintainers
Readme
dev-notify-bridge
Lightweight local HTTP bridge that delivers native desktop notifications for containerized or remote Node.js environments (Docker, WSL). Use
dev-notifyfor direct local Node.js notifications; usedev-notify-bridgewhen your app runs in an environment that cannot access the host desktop directly.
Table of contents
- Overview
- When to use
- Install
- Quick start
- API
- CLI
- Docker integration examples
- Security & best practices
- Troubleshooting
- Contributing
- License
Overview
dev-notify-bridge is a tiny HTTP server that runs on your host machine and accepts JSON POST requests to trigger native desktop notifications (macOS Notification Center, Windows Toasts, Linux notify-send). It is intentionally minimal, secure by default, and intended for local development only.
A typical flow:
- Run
dev-notify-bridgeon your host. - From inside a container (or remote environment), POST a notification payload to the bridge.
- The bridge uses
node-notifierto show a native desktop notification.
When to use
- You run your application inside Docker, WSL, or a remote VM and want desktop toasts for events (OTPs, errors, build completion).
- You do not need this in production — it’s explicitly a developer convenience tool.
Note:
dev-notifyis a separate client-side package that sends notifications directly from local Node.js processes.dev-notify-bridgeis the host-side relay used when the app cannot show notifications itself.
Install
Globally (recommended for developer machines):
npm install -g dev-notify-bridgeOr run without installing:
npx dev-notify-bridgeQuick start
Start the bridge (default port 6789):
npx dev-notify-bridgeStart on a custom port:
PORT=5454 npx dev-notify-bridge
# or
npx dev-notify-bridge --port 5454You should see:
dev-notify-bridge running at http://localhost:6789
💬 Ready to receive notificationsAPI
POST /notify
Triggers a native desktop notification.
Request JSON
{
"title": "string", // required
"message": "string", // required
"sound": true|false, // optional, default true
"wait": true|false // optional, default false
}Success response (200)
{
"success": true,
"backend": "desktop",
"response": "Notification delivered",
"metadata": {
"hostname": "your-machine",
"platform": "darwin|win32|linux"
}
}Error response (4xx/5xx)
{
"success": false,
"backend": "desktop",
"error": "Error message"
}Example (curl)
curl -X POST http://localhost:6789/notify \
-H "Content-Type: application/json" \
-d '{"title":"Build OK","message":"API built successfully","sound":true}'CLI
Run the bridge:
npx dev-notify-bridge [--port <port>] [--verbose]Options:
--port,-p— server port (default6789)--verbose,-v— enable verbose logging
Environment variable:
PORT— alternate way to set the port.
Docker integration examples
1. Run a container and allow it to reach the host bridge
docker run --rm \
--add-host=host.docker.internal:host-gateway \
my-imageInside the container, send a notification to the bridge:
// example using axios in container
await axios.post('http://host.docker.internal:6789/notify', {
title: 'Container Ready',
message: 'Service listening on :3000'
});2. docker-compose (env var)
services:
api:
build: .
environment:
- DEV_NOTIFY_BRIDGE=http://host.docker.internal:6789
# For Linux hosts that need it:
# extra_hosts:
# - "host.docker.internal:host-gateway"Using
--add-host=host.docker.internal:host-gatewayorextra_hostsis recommended for cross-platform resolution.
Security & best practices
- Local-only by default: the server binds to
127.0.0.1(localhost) for safety. Do not expose it publicly. - Authentication: intentionally omitted for convenience in local dev. If you must use this across a network, add an auth layer or use SSH port forwarding.
- Production: do not use in production; it is a development tool only.
- Logging: use
--verboseto debug notification delivery during setup.
Troubleshooting
host.docker.internalDNS not found (Linux) Use--add-host=host.docker.internal:host-gatewaywhen running the container, or setDEV_NOTIFY_BRIDGEto the host IP resolved by your environment.No notification appears but API responded
200- Ensure
node-notifiersupports your platform (Linux may neednotify-sendavailable). - Check system notification settings (do-not-disturb, focus assist).
- Try
--verboseto view bridge logs.
- Ensure
Bridge fails to start (port in use) Start with a different port:
PORT=5454 npx dev-notify-bridge.
Contributing
Contributions, issues, and feature requests are welcome.
Suggested workflow:
- Fork the repo and create a branch.
- Run
npm installandnpm run build. - Add tests or examples for new behavior.
- Open a PR with a clear description and motivation.
Please follow standard code style.
License
MIT © 2025
