You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- move websocket endpoint to {path_prefix}/websocket and reserve {path_prefix}/enable|disable
- add token-gated enable/disable routes; disabling closes active websocket and clears override paths
- client: support --token / FASTAPI_DEV_PROXY_TOKEN and inject token into relay URL
- update docs, examples, and tests for new websocket path
Copy file name to clipboardExpand all lines: README.md
+36-23Lines changed: 36 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,18 @@ FastAPI webhook relay/proxy library for local development. Production webhooks a
7
7
forwarded over WebSocket to a developer machine, replayed against a local server,
8
8
and the response is sent back to production.
9
9
10
-
### Status
10
+
### Why
11
11
12
-
- v0 software: unstable APIs and behavior, expect breaking changes.
13
-
- Extracted from another project; not all original features are included yet.
12
+
Webhook integrations are awkward to build locally because **the third-party needs to reach your machine**:
13
+
14
+
- Your FastAPI server is on `localhost`, behind NAT/firewalls, and often on an unreliable dev network.
15
+
- “Just open a port” is rarely an option (corporate networks, Wi‑Fi, security policies).
16
+
17
+
Tools like ngrok (and similar tunneling/reverse-proxy setups) can solve this, but for webhook development they can also feel **overly complex**: extra moving parts, extra configuration, and yet another service to pay for.
18
+
19
+
This project is the alternative I wanted: **a simple, free, open-source relay** specifically for developing webhook handlers. Instead of exposing your laptop to the internet, updating your webhook registration, you run a tiny websocket “relay” websocket in production. Then you connect a local client, receive real webhook requests, replay them against `http://localhost:...`, and send the response back upstream.
20
+
21
+
A nice side-effect: you can keep the **same third-party webhook URL** (pointing at your production app) and **toggle forwarding on/off** with a config change (e.g. `enabled=False`) or by simply connecting/disconnecting the dev client—no redeploy and no “update webhook URL” dance.
Alternatively, use the class method for a one-line setup: `relay = RelayManager.for_app(app, token="secret", ...)`. Or create the relay first and call `relay.install(app)` later.
43
+
If you prefer, you can create the relay first and call `relay.install(app)` later.
44
+
45
+
When installed (default `path_prefix` is `/fastapi-dev-proxy`), the relay registers:
46
+
47
+
-`{path_prefix}/websocket` (WebSocket): dev client connects here
The client must include the shared token as the `token` query param when connecting (e.g. `...?token=...`). To avoid hardcoding secrets in source control, read it from an environment variable.
0 commit comments