Framework-specific tunnel commands — uvicorn-mekong, flask-mekong, django-mekong and more
Project description
mekong-tunnel
Expose your Python dev server to the internet in one command. Works with FastAPI, Flask, Django, Gunicorn, Uvicorn, Hypercorn, and Granian.
How it works
mekong-tunnel installs framework-specific commands that start your dev server and open a public tunnel via mekongtunnel.dev — all in a single command.
uvicorn-mekong main:app --reload
uvicorn-mekong cmd: uvicorn main:app --reload port: 8000 mode: tunnel
[uvicorn] INFO: Uvicorn running on http://127.0.0.1:8000
✔ uvicorn is up on port 8000.
[tunnel] ✔ Tunnel is live!
[tunnel] URL https://happy-tiger-a1b2c3d4.mekongtunnel.dev
╔═══════════════════════════════════════════════════════════════╗
║ Public URL: https://happy-tiger-a1b2c3d4.mekongtunnel.dev ║
╚═══════════════════════════════════════════════════════════════╝
Installation
pip install mekong-tunnel
Requires the
mekongbinary — install it separately:# macOS / Linux (auto-detect arch) curl -fsSL https://github.com/MuyleangIng/MekongTunnel/releases/latest/download/mekong-$(uname -s | tr A-Z a-z)-$(uname -m) \ -o ~/.local/bin/mekong && chmod +x ~/.local/bin/mekong # Windows — download from: # https://github.com/MuyleangIng/MekongTunnel/releases/latest
Commands
| Command | Framework | Default port |
|---|---|---|
uvicorn-mekong |
Uvicorn / FastAPI | 8000 |
fastapi-mekong |
FastAPI (alias for uvicorn) | 8000 |
flask-mekong |
Flask | 5000 |
gunicorn-mekong |
Gunicorn | 8000 |
django-mekong |
Django | 8000 |
hypercorn-mekong |
Hypercorn | 8000 |
granian-mekong |
Granian | 8000 |
Modes
Each command supports three modes:
| Flag | Mode | What happens |
|---|---|---|
| (none) | tunnel | Start server + open public tunnel, print URL |
--local |
local | Start server only, open http://localhost:{port} in browser |
--domain |
domain | Start server + tunnel, open public URL in browser |
Usage
FastAPI / Uvicorn
# Default: start server + tunnel, print public URL
uvicorn-mekong main:app
# With hot-reload and custom port
uvicorn-mekong main:app --reload --port 8080
# Open localhost in browser (no tunnel)
uvicorn-mekong main:app --local
# Open public URL in browser automatically
uvicorn-mekong main:app --domain
# Tunnel with 2-hour expiry
uvicorn-mekong main:app --expire 2h
# fastapi-mekong is identical to uvicorn-mekong
fastapi-mekong main:app --reload --domain
Flask
flask-mekong run # port 5000 + tunnel
flask-mekong run --port 5001 # custom port
flask-mekong run --local # localhost only, open browser
flask-mekong run --domain # tunnel + open public URL
flask-mekong run --expire 1d # expires in 1 day
Django
django-mekong runserver # port 8000 + tunnel
django-mekong runserver 8080 # custom port
django-mekong runserver 0.0.0.0:8000 # bind all interfaces
django-mekong runserver --local # localhost only, open browser
django-mekong runserver --domain # tunnel + open public URL
Gunicorn
gunicorn-mekong app:app # port 8000 + tunnel
gunicorn-mekong app:app --bind 0.0.0.0:8080 # custom port
gunicorn-mekong app:app -w 4 # 4 workers + tunnel
gunicorn-mekong app:app --domain # tunnel + open public URL
Hypercorn
hypercorn-mekong main:app # port 8000 + tunnel
hypercorn-mekong main:app --bind 0.0.0.0:8080 # custom port
hypercorn-mekong main:app --domain # tunnel + open public URL
Granian
granian-mekong main:app # port 8000 + tunnel
granian-mekong main:app --port 8080 # custom port
granian-mekong main:app --domain # tunnel + open public URL
All mekong-tunnel flags
These flags are consumed by mekong-tunnel and not forwarded to your framework:
| Flag | Description |
|---|---|
--local |
No tunnel — open localhost in browser |
--domain |
Tunnel + open public URL in browser |
--expire <val> |
Tunnel expiry: 30m, 2h, 1d, 1w |
--no-qr |
Suppress QR code in terminal |
--daemon |
Run tunnel in background |
--help, -h |
Show help |
All other flags are forwarded verbatim to your framework.
Quick test (FastAPI)
pip install fastapi uvicorn mekong-tunnel
cat > main.py << 'EOF'
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
return {"message": "Hello from Mekong Tunnel!"}
EOF
uvicorn-mekong main:app --reload
How it works internally
- Start your server as a subprocess
- Poll the port until it accepts connections (30 s timeout)
- Spawn
mekongtunnel to the detected port - Stream both outputs to your terminal
- On URL detected — print banner (and open browser if
--domain) - Clean shutdown on
Ctrl+C— stops both processes
Requirements
- Python 3.8+
mekongbinary on PATH (download)- No other Python dependencies
License
MIT © Ing Muyleang — KhmerStack
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mekong_tunnel-2.0.0.tar.gz.
File metadata
- Download URL: mekong_tunnel-2.0.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b0af859c7891770ed4050a9f69a51cad5bd85c7bee8e7f71c0828eddc89cb3c
|
|
| MD5 |
5dc3d5c34a07dab4b9929e1108e3dcc6
|
|
| BLAKE2b-256 |
10bc573c7a40edbd7a3f03da1171eb6086980576004852b56d5e14a34cff36f4
|
File details
Details for the file mekong_tunnel-2.0.0-py3-none-any.whl.
File metadata
- Download URL: mekong_tunnel-2.0.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5984fbe3736fe54865cb58aeebc07ea614ad6693555d284ef475e5c3950831b7
|
|
| MD5 |
01a54e76bdaa9b5c3cc004d7928faf1b
|
|
| BLAKE2b-256 |
baea7e75525389351ac73ba92c738bf9a0e680d079554589dd33a060e2f4ae07
|