nkapp expose
Ephemerally expose a service to the local area network (LAN) or globally via a public tunnel. Ideal for testing on mobile devices, sharing with teammates, or webhook debugging.
nkapp expose <service> [options]Arguments
| Argument | Type | Description |
|---|---|---|
service | string | Required. Name of the service to expose. |
Options
| Flag | Type | Default | Description |
|---|---|---|---|
-e, --env <env> | string | local | Target environment |
-i, --ip <address> | string | auto-detect | Manual LAN IP override |
-p, --port <port> | number | 8080 | Gateway port to use for LAN exposure |
-t, --tunnel | boolean | false | Enable global exposure via localtunnel |
How It Works
LAN Exposure (Default)
Nanokit detects your LAN IP address and configures the Caddy gateway to serve the target service on a LAN-accessible port. Multiple URL formats are provided:
http://web.my-app.192.168.1.50.nip.io:8080 (Primary LAN hostname)
http://web.my-app.192.168.1.50.sslip.io:8080 (Secondary LAN hostname)
http://192.168.1.50:8080 (Direct LAN IP)Global Tunnel (--tunnel)
When the -t flag is passed, Nanokit spawns a localtunnel process to create a publicly reachable URL:
https://abc123.loca.lt (Global - Working Everywhere)The CLI process stays alive to maintain the tunnel connection.
IP Detection
Nanokit uses a smart scoring algorithm to detect the best LAN IP:
- Prioritizes physical interfaces (
en0,eth0,wlan0) over virtual bridges - Filters out Docker, VPN, and loopback interfaces
- Prefers
192.168.x.xover10.x.x.xranges - WSL2 Aware: Automatically queries the Windows host IP via PowerShell
WSL2 Notes
When running in WSL2, LAN access requires a Windows port proxy:
# Run in PowerShell (Admin)
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=<WSL_IP>Nanokit prints this command automatically when WSL is detected.
Examples
# Expose web service on LAN
nkapp expose web
# Expose with a specific port
nkapp expose api -p 9090
# Expose globally via tunnel
nkapp expose web --tunnel
# Manually specify LAN IP
nkapp expose web --ip 192.168.1.100[!NOTE] LAN exposure is ephemeral — it will be reset on the next full
nkapp upreconciliation.