devportal-tunnel
v1.0.1
Published
Expose your localhost to the internet with a single command
Maintainers
Readme
DevPortal CLI
Expose your localhost to the internet with a single command.
Installation
From npm (after publishing)
npm install -g devportalFrom source
git clone <repo>
cd cli
npm install
npm run build
npm linkQuick Start
# Expose port 3000
devportal 3000
# With custom subdomain
devportal 3000 --subdomain my-api
# Password protected
devportal 3000 --password secret123
# Show QR code for mobile testing
devportal 3000 --qr
# Temporary demo link (expires in 2 hours)
devportal 3000 --demo
# Run in local simulation mode (no server needed)
devportal 3000 --localCommands
Start a tunnel
devportal <port> [options]
Options:
-s, --subdomain <name> Custom subdomain for your URL
-p, --password <pass> Password protect the tunnel
--demo Create a temporary link (2 hours)
--qr Display QR code in terminal
--auth-header <header> Add authorization header to forwarded requests
--local Run in simulation mode (no server required)List active tunnels
devportal lsStop a tunnel
# Stop specific tunnel
devportal stop <tunnel-id>
# Stop all tunnels
devportal stop --allReplay requests
# Replay a captured request
devportal replay <request-id>
# With modified headers
devportal replay <request-id> --header "X-Debug: true"
# With modified body
devportal replay <request-id> --body '{"test": true}'Stream logs
devportal logs <tunnel-id>Configuration
# View current config
devportal config
# Set server URL (for self-hosted)
devportal config server https://your-server.com
# Reset to defaults
devportal config resetDevice info
devportal whoamiConfiguration
DevPortal stores configuration in ~/.devportal/:
~/.devportal/
├── config.json # Server URL, WebSocket URL
├── device.json # Unique device ID
└── tunnels.json # Active tunnel informationSelf-Hosted Server
To use your own DevPortal server:
# Set your server URL
devportal config server https://tunnel.your-domain.com
# Now tunnels will use your server
devportal 3000How It Works
- CLI connects to the DevPortal server via WebSocket
- Server assigns a public URL (e.g.,
https://my-app.devportal.live) - Requests arrive at the public URL
- Server forwards requests through the WebSocket to CLI
- CLI proxies requests to your local server
- Response travels back through the tunnel
Internet Request
│
▼
[DevPortal Server] ◄──WSS──► [CLI Client] ──► [localhost:3000]
│ │
└──────── Response ◄─────────┘Publishing to npm
- Update package.json with your details:
{
"name": "devportal",
"author": "Your Name",
"repository": {
"type": "git",
"url": "https://github.com/yourusername/devportal"
}
}- Login and publish:
npm login
npm publish- For scoped package (if name is taken):
{
"name": "@yourusername/devportal"
}npm publish --access publicDevelopment
# Install dependencies
npm install
# Run in development
npm run dev 3000
# Build
npm run build
# Link globally for testing
npm linkLicense
MIT
