diff --git a/README.md b/README.md index dea5e321..785c1799 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,15 @@ Run Claude Code / Codex / Gemini sessions locally and control them remotely thro ## Getting Started ```bash -npx @twsxtd/hapi server # start the server locally -npx @twsxtd/hapi # run claude code +npx @twsxtd/hapi server --relay # start server with E2E encrypted relay +npx @twsxtd/hapi # run claude code ``` -Open `http://:3006` and login with the token, if you need to access it remotely, see [Remote access](docs/guide/installation.md#remote-access) +The terminal will display a URL and QR code. Scan the QR code with your phone or open the URL to access. -More options: [Quick Start](docs/guide/quick-start.md) | [Installation](docs/guide/installation.md) +> The relay uses WireGuard + TLS for end-to-end encryption. Your data is encrypted from your device to your machine. + +For self-hosted options (Cloudflare Tunnel, Tailscale), see [Installation](docs/guide/installation.md) ## Docs diff --git a/docs/guide/installation.md b/docs/guide/installation.md index e27c1028..5b748a36 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -60,10 +60,24 @@ The server can be deployed on: - **Local desktop** (default) - Run on your development machine - **Remote server** - Deploy on a VPS, cloud server, or any machine with network access -Start the server: +### Default: Public Relay (recommended) + +```bash +hapi server --relay +``` + +The terminal displays a URL and QR code. Scan to access from anywhere. + +- **End-to-end encrypted** with WireGuard + TLS +- No configuration needed +- Works behind NAT, firewalls, and any network + +### Local Only ```bash hapi server +# or +hapi server --no-relay ``` The server listens on `http://localhost:3006` by default. @@ -130,19 +144,18 @@ Each machine gets a unique ID stored in `~/.hapi/settings.json`. This allows: ## Operations -### Remote access +### Self-hosted tunnels -If the server is deployed on a machine with a **public IP**, you can access it directly via `http://your-server-ip:3006`. Use HTTPS (via reverse proxy like Nginx or Caddy) for production. - -If the server is behind NAT, use one of these options: +If you prefer not to use the public relay (e.g., for lower latency or self-managed infrastructure), you can use these alternatives:
-Cloudflare Tunnel (recommended for NAT) +Cloudflare Tunnel https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/ ```bash export WEBAPP_URL="https://your-tunnel.trycloudflare.com" +hapi server ```
@@ -153,6 +166,7 @@ https://tailscale.com/download ```bash sudo tailscale up +hapi server ``` Access via your Tailscale IP: @@ -163,11 +177,11 @@ http://100.x.x.x:3006
-ngrok +Public IP / Reverse Proxy -```bash -ngrok http 3006 -``` +If the server has a public IP, access directly via `http://your-server-ip:3006`. + +Use HTTPS (via Nginx, Caddy, etc.) for production.
### Telegram setup diff --git a/docs/guide/quick-start.md b/docs/guide/quick-start.md index 82ae93ee..ee9ec0c5 100644 --- a/docs/guide/quick-start.md +++ b/docs/guide/quick-start.md @@ -25,11 +25,15 @@ Other install options: [Installation](./installation.md) ## Start the server ```bash -hapi server +hapi server --relay ``` On first run, HAPI prints an access token and saves it to `~/.hapi/settings.json`. +The terminal will display a URL and QR code for remote access. + +> End-to-end encrypted with WireGuard + TLS. + ## Start a coding session ```bash @@ -40,11 +44,7 @@ This starts Claude Code wrapped with HAPI. The session appears in the web UI. ## Open the UI -Open your browser: - -``` -http://:3006 -``` +Open the URL shown in the terminal, or scan the QR code with your phone. Enter your access token to log in. diff --git a/website/src/locales/en.json b/website/src/locales/en.json index f34dd3a1..5938b511 100644 --- a/website/src/locales/en.json +++ b/website/src/locales/en.json @@ -110,10 +110,12 @@ }, "installation": { "title": "Get Started in Seconds", + "e2ee": "🔒 End-to-end encrypted with WireGuard + TLS", "npm": { "step1": "1. Start the Server", "step2": "2. Start a Coding Session", - "step3": "3. Open the UI" + "step3": "3. Open the URL", + "step3Hint": "URL and QR code shown in terminal" } }, "cta": { diff --git a/website/src/locales/zh.json b/website/src/locales/zh.json index d1ea460c..6f44c501 100644 --- a/website/src/locales/zh.json +++ b/website/src/locales/zh.json @@ -110,10 +110,12 @@ }, "installation": { "title": "几秒钟内开始", + "e2ee": "🔒 WireGuard + TLS 端对端加密", "npm": { "step1": "1. 启动服务器", "step2": "2. 启动编码会话", - "step3": "3. 打开 UI" + "step3": "3. 打开 URL", + "step3Hint": "终端中显示 URL 和二维码" } }, "cta": { diff --git a/website/src/pages/Home.tsx b/website/src/pages/Home.tsx index 139e4ef8..ec3e6e5c 100644 --- a/website/src/pages/Home.tsx +++ b/website/src/pages/Home.tsx @@ -274,8 +274,8 @@ export default function Home() {

{t('installation.npm.step1')}

- npx @twsxtd/hapi server -
@@ -297,15 +297,13 @@ export default function Home() {

{t('installation.npm.step3')}

-
- http://<your-ip>:3006 - +
+ {t('installation.npm.step3Hint')}
+

{t('installation.e2ee')}