Skip to content

Commit 601f36d

Browse files
docs(web-demo): add consumer config matrix for retail and UI
Document planned CONSUMER_PROFILE setups and map demo routes to production patterns from bitgo-retail and bitgo-ui. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 35edadb commit 601f36d

1 file changed

Lines changed: 55 additions & 5 deletions

File tree

modules/web-demo/README.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,63 @@
11
# web-demo
22

3-
This module serves as an example on how you can integrate the BitGo SDK into your own UI.
3+
Reference UI for integrating the BitGo SDK in the browser. Routes mirror problems solved in production apps (**bitgo-retail**, **bitgo-ui**) using SDK packages directly — no private `@bitgo-private/*` dependencies.
44

5-
## Usage
5+
## Quick start
66

7-
In order to start the server, run the following command after having already run `yarn install` in the root of the repo.
7+
From the BitGoJS repo root (after `yarn install`):
88

9-
```
9+
```bash
10+
cd modules/web-demo
1011
yarn dev
1112
```
1213

13-
This will spin up a server serving the UI at [localhost:8080](localhost:8080).
14+
Opens [localhost:8080](http://localhost:8080).
15+
16+
## Consumer config matrix
17+
18+
Production apps bundle the SDK differently. web-demo will support **consumer profiles** (via `CONSUMER_PROFILE` env) so each profile documents one real-world setup. Profiles are added incrementally; only `classic-webpack` is active today.
19+
20+
| Profile | Status | Mirrors | Bundler | WASM | SDK auth |
21+
| --- | --- | --- | --- | --- | --- |
22+
| `classic-webpack` | **active** (default) | bitgo-ui classic app, default web-demo | Webpack + [`webpack/bitgojs.config.js`](../../webpack/bitgojs.config.js) | Partial ESM aliases in shared config | Access token or [`WebCryptoAuth`](/webcrypto-auth) |
23+
| `retail-browser` | planned | bitgo-retail web (`MOBILE_MODE` off) | Webpack profile | Full `@bitgo/wasm-*` ESM paths, DKLS/cardano browser swaps | `WebCryptoHmacStrategy` + `requestIdPrefix` |
24+
| `retail-mobile-stub` | planned | bitgo-retail mobile webview | Webpack profile | Empty WASM shims (no heavy signing WASM) | Bridge / token (documented only) |
25+
| `direct-sdk` | planned | bitgo-retail mock server, `examples/ts` | Either | Per profile | `BitGoAPI` + `customRootURI`, no Express |
26+
| `express-proxy` | planned | Self-hosted Express users | Either | Per profile | Local Express signing proxy |
27+
28+
**Planned usage** (not wired yet):
29+
30+
```bash
31+
yarn dev # classic-webpack
32+
CONSUMER_PROFILE=retail-browser yarn dev # future
33+
CONSUMER_PROFILE=retail-mobile-stub yarn dev # future
34+
```
35+
36+
### What each production app solved
37+
38+
| Problem | bitgo-retail | bitgo-ui | web-demo route |
39+
| --- | --- | --- | --- |
40+
| Browser WASM loading | Vite ESM aliases for `@bitgo/wasm-utxo`, `wasm-ton`, `wasm-mps` | Webpack aliases (similar) | `/wasm-miniscript` |
41+
| HMAC without raw token in storage | `WebCryptoHmacStrategy` + IndexedDB | Classic token flow | `/webcrypto-auth` |
42+
| Passkey PRF wallet flows | `@bitgo-private/web-client` (retail); SDK: `@bitgo/passkey-crypto` | Partial | `/passkey-demo` |
43+
| Keycard generation | `@bitgo/key-card` in wallet create / migration | Keycard flows | `/keycard` |
44+
| Lazy coin registration | `retail-sdk-client/coinFactory` | `~/utils/coinFactory` | `/coins` |
45+
| Token enable prebuild | React Query + `PrebuildTransactionResult` | `useBuildTokenEnablementMutation` | planned `/token-enable` |
46+
47+
## Demo routes
48+
49+
| Path | Description |
50+
| --- | --- |
51+
| `/` | Home |
52+
| `/bitgo-js` | BitGo SDK object inspect |
53+
| `/bitgo-api` | BitGoAPI usage |
54+
| `/coins` | Coin factory / registration |
55+
| `/keycard` | Keycard download fixtures |
56+
| `/wasm-miniscript` | WASM miniscript smoke |
57+
| `/ecdsachallenge` | ECDSA challenge generation |
58+
| `/webcrypto-auth` | WebCrypto HMAC strategy + IndexedDB session |
59+
| `/passkey-demo` | Passkey register / attach / wallet (uses `@bitgo/passkey-crypto`) |
60+
61+
## Contributing
62+
63+
Owned by **@BitGo/web-experience** (`CODEOWNERS`). Prefer small PRs: one profile, one route, or one README section at a time. See the local BitGoJS side-improvements plan for micro-PR sizing.

0 commit comments

Comments
 (0)