Skip to content

Commit fbe22e0

Browse files
committed
docs: add mock mode documentation to root and client READMEs
1 parent 21358f0 commit fbe22e0

2 files changed

Lines changed: 59 additions & 2 deletions

File tree

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ That's it! Your local server running on port 3000 is now accessible from the int
2020
- **Request Inspector** - Built-in web UI to monitor all proxied requests and responses in real-time
2121
- **API Composer** - Postman-like request builder inside the inspector to craft and send HTTP requests
2222
- **cURL Export** - Generate copy-ready cURL commands from any captured request
23+
- **Mock Mode** - Define mock responses for API paths without a running backend, with a web UI to manage mocks
2324
- **Token Protection** - Secure your tunnels with authentication tokens
2425
- **Self-Hostable** - Run your own ProxyHub server
2526
- **Session Timeouts** - Configurable session duration limits
@@ -74,6 +75,31 @@ Inspector features:
7475
- **cURL export** — expand the cURL section on any request detail page to get a ready-to-copy command
7576
- Light/dark theme
7677

78+
### Mock Mode
79+
80+
Define mock API responses without needing a real backend server. Mock mode includes a web UI for managing mocks and supports exact, prefix, and regex path matching.
81+
82+
```bash
83+
# Pure mock mode (no local server needed)
84+
proxyhub --mock
85+
86+
# Hybrid mode (mocked paths return mock data, others proxy to localhost)
87+
proxyhub --mock -p 3000
88+
89+
# Inspector automatically enables mock mode
90+
proxyhub -p 3000 --inspect
91+
```
92+
93+
Once running, open the Mock Manager URL shown in the terminal (e.g., `http://localhost:3001/mocks`) to create and manage mocks.
94+
95+
Mock features:
96+
- **Pure mock mode** — no local server required, define all responses via the UI
97+
- **Hybrid mode** — combine mocks with a real backend; mocked paths return mock data, non-mocked paths proxy normally
98+
- **Path matching** — exact, prefix, or regex matching with configurable priority
99+
- **Response customization** — set status codes, headers, body, and response delay
100+
- **Inspector integration** — mocked requests appear in the inspector with a `MOCK` badge
101+
- Enable/disable individual mocks without deleting them
102+
77103
### Token Protection
78104

79105
Secure your tunnel so only requests with the correct token can access it:
@@ -96,14 +122,17 @@ curl -H "X-Proxy-Token: mysecrettoken" https://your-tunnel.proxyhub.cloud/
96122

97123
| Option | Description |
98124
|--------|-------------|
99-
| `-p, --port <port>` | Port number to proxy (required) |
125+
| `-p, --port <port>` | Port number to proxy |
126+
| `-m, --mock` | Enable mock mode |
100127
| `-t, --token <token>` | Token for tunnel protection |
101128
| `-i, --inspect` | Enable request inspector UI |
102129
| `--inspect-port <port>` | Port for inspector UI (default: port + 1000) |
103130
| `-d, --debug` | Enable debug mode |
104131
| `-V, --version` | Output version number |
105132
| `-h, --help` | Display help |
106133

134+
Either `--port` or `--mock` is required. Using `--inspect` automatically enables mock mode.
135+
107136
## Self-Hosting
108137

109138
### Docker (Recommended)

packages/client/README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@ Inspector features:
5959
- **cURL export** — expand the cURL section on any request detail page to get a ready-to-copy command
6060
- Light/dark theme
6161

62+
### Mock Mode
63+
64+
Define mock API responses without needing a real backend server. Mock mode includes a web UI for managing mocks and supports exact, prefix, and regex path matching.
65+
66+
```bash
67+
# Pure mock mode (no local server needed)
68+
proxyhub --mock
69+
70+
# Hybrid mode (mocked paths return mock data, others proxy to localhost)
71+
proxyhub --mock -p 3000
72+
73+
# Inspector automatically enables mock mode
74+
proxyhub -p 3000 --inspect
75+
```
76+
77+
Once running, open the Mock Manager URL shown in the terminal (e.g., `http://localhost:3001/mocks`) to create and manage mocks.
78+
79+
Mock features:
80+
- **Pure mock mode** — no local server required, define all responses via the UI
81+
- **Hybrid mode** — combine mocks with a real backend; mocked paths return mock data, non-mocked paths proxy normally
82+
- **Path matching** — exact, prefix, or regex matching with configurable priority
83+
- **Response customization** — set status codes, headers, body, and response delay
84+
- **Inspector integration** — mocked requests appear in the inspector with a `MOCK` badge
85+
- Enable/disable individual mocks without deleting them
86+
6287
### Token Protection
6388

6489
Secure your tunnel so only requests with the correct token can access it:
@@ -83,14 +108,17 @@ proxyhub -p 3000 --debug
83108

84109
| Option | Description |
85110
|--------|-------------|
86-
| `-p, --port <port>` | Port number to proxy (required) |
111+
| `-p, --port <port>` | Port number to proxy |
112+
| `-m, --mock` | Enable mock mode |
87113
| `-t, --token <token>` | Token for tunnel protection |
88114
| `-i, --inspect` | Enable request inspector UI |
89115
| `--inspect-port <port>` | Port for inspector UI (default: port + 1000) |
90116
| `-d, --debug` | Enable debug mode |
91117
| `-V, --version` | Output version number |
92118
| `-h, --help` | Display help |
93119

120+
Either `--port` or `--mock` is required. Using `--inspect` automatically enables mock mode.
121+
94122
## Self-Hosted Server
95123

96124
Connect to your own ProxyHub server using environment variables:

0 commit comments

Comments
 (0)