@interop/byoe-react-template 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.0 - TBD
4
-
5
- ### Changed
6
-
7
- - Scoped the package name to `@interop/byoe-react-template` (the unscoped
8
- `byoe-react-template` npm package is deprecated).
3
+ ## 0.1.0-0.1.1 - 2026-07-12
9
4
 
10
5
  ### Added
11
6
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@interop/byoe-react-template",
3
3
  "description": "Template for building 'Bring Your Own Everything' (BYOE) apps on Wallet Attached Storage: a Vite + React + TypeScript SPA with DID Auth login via a CHAPI wallet, local-first encrypted storage, and background sync, built on @interop/was-react.",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -53,8 +53,24 @@
53
53
  "node": ">=24.0"
54
54
  },
55
55
  "publishConfig": {
56
- "access": "public"
56
+ "access": "public",
57
+ "provenance": true
57
58
  },
59
+ "keywords": [
60
+ "byoe",
61
+ "chapi",
62
+ "wallet-attached-storage",
63
+ "did-auth",
64
+ "local-first",
65
+ "react",
66
+ "template"
67
+ ],
58
68
  "author": "Interop Alliance (https://github.com/interop-alliance/)",
59
- "license": "MIT"
69
+ "license": "MIT",
70
+ "repository": {
71
+ "type": "git",
72
+ "url": "git+https://github.com/interop-alliance/byoe-react-template.git"
73
+ },
74
+ "homepage": "https://github.com/interop-alliance/byoe-react-template",
75
+ "bugs": "https://github.com/interop-alliance/byoe-react-template/issues"
60
76
  }
package/CLAUDE.md DELETED
@@ -1,55 +0,0 @@
1
- # byoe-react-template (BYOE Notes)
2
-
3
- A minimal, working "Bring Your Own Everything" (BYOE) app template: a Vite +
4
- React + TypeScript SPA with DID-Auth login via a CHAPI wallet, local-first
5
- encrypted storage, and background sync to a WAS server, built on
6
- `@interop/was-react`. It ships one example "notes" collection. The library owns
7
- the reusable plumbing (identity, login, session, encrypted replica, sync, hooks,
8
- MUI components); this repo is the thin app-specific shell around it.
9
-
10
- ## Source layout
11
-
12
- - `src/app.config.ts` -- env-var exports and the one `WasAppConfig` the library
13
- consumes (app name, credential type/vocab, `COLLECTIONS` map). First stop when
14
- renaming the template.
15
- - `src/stores/notes.ts` -- the example entity store (`createEntityStore`) plus
16
- the `StoreRegistry` the rehydrate mechanism drives.
17
- - `src/dev/` -- dev-mode bootstrap (`bootstrap.ts` opens the local store from
18
- `devSeed.ts` and hydrates) and `devSync.ts` (CHAPI-bypassed replication from a
19
- provisioned grants file).
20
- - `src/components/` -- `AppShell` (top bar, `SyncStatusChip`, `ReconnectBanner`,
21
- logout) and `DevGate` (dev-mode router gate; wallet mode uses the library's
22
- `ProtectedRoute`).
23
- - `src/pages/` -- `LoginPage` (CHAPI login) and `NotesPage` (list/add/edit/
24
- delete).
25
- - `scripts/provision-dev-grants.ts` -- provisions a dev Space, collections, and
26
- delegated zcaps against a running was-teaching-server.
27
- - `playwright.config.ts` (offline/mocked, CI), `playwright.was.config.ts` (real
28
- WAS server), `playwright.wallet.config.ts` (full wallet login), and `test/`
29
- tiers, plus Node unit tests via Vitest.
30
-
31
- ## Commands
32
-
33
- ```
34
- pnpm dev # wallet mode; VITE_AUTH_MODE=dev for offline mode
35
- pnpm run build # typecheck + Vite build
36
- pnpm run typecheck
37
- pnpm run lint
38
- pnpm run fix # eslint --fix + prettier
39
- pnpm run test:node # Vitest + fake-indexeddb
40
- pnpm run test:browser # Playwright, offline/mocked (CI)
41
- pnpm run test:browser:was # Playwright against a real local WAS server
42
- pnpm run test:browser:wallet # Playwright full wallet login (local/manual)
43
- pnpm run provision:dev # provision dev grants (SERVER_URL, default :3002)
44
- ```
45
-
46
- ## Conventions
47
-
48
- - pnpm; Node >= 24; ESM only.
49
- - Prettier: no semicolons, single quotes, no trailing commas,
50
- `arrowParens: avoid`.
51
- - Never use the right-arrow character (write `to`), em-dash character (write
52
- `--`), or ellipsis character (write `...`).
53
- - Inline single-use option/argument types at the function signature instead of
54
- declaring a named type.
55
- - Keep app-agnostic logic in `@interop/was-react` rather than growing it here.
@@ -1,143 +0,0 @@
1
- # Phase 2 handoff: build `byoe-react-template`
2
-
3
- Phase 1 is DONE: `@interop/was-react` is fully extracted, tested, documented
4
- (local checkout at `~/code/Interop/was-react`, for reading source/API), and
5
- published to npm as `@interop/was-react@0.1.2`. This file gives a fresh
6
- session everything needed to build
7
- the template app in THIS repo (`~/code/Interop/byoe-react-template`, currently
8
- an empty clone).
9
-
10
- ## Goal (from the original prompt)
11
-
12
- A minimal but complete Vite + React + TypeScript SPA, `private: true`, no
13
- packaging machinery, demonstrating the BYOE pattern end to end by consuming
14
- `@interop/was-react`. Keep the template thin: anything app-agnostic belongs in
15
- the library.
16
-
17
- Required app content:
18
- - Login page with DID Auth via CHAPI (wallet polyfill wired up)
19
- - One protected route behind `ProtectedRoute` (from `@interop/was-react/mui`)
20
- - One example WAS-backed collection ("notes"): list/add/edit/delete,
21
- local-first with sync, `SyncStatusChip` in the app shell
22
- - MUI app shell with `ReconnectBanner`
23
-
24
- Tooling modeled on `~/code/Dima/life-advisor/package.json`: scripts `dev`,
25
- `build` (typecheck + `vite build`), `fix`, `format`, `lint`, `typecheck`,
26
- `test`, `test:node`, `test:browser`, `test:browser:was`,
27
- `test:browser:wallet`, `provision:dev`; pnpm; `engines.node >= 24`; MIT;
28
- author "Interop Alliance" (https://github.com/interop-alliance/); eslint flat
29
- config + prettier + tsconfig conventions as in life-advisor /
30
- isomorphic-lib-template.
31
-
32
- Testing: vitest + fake-indexeddb for unit tests; THREE Playwright configs
33
- (mocked / real WAS server / real wallet) mirroring life-advisor's
34
- `playwright.config.ts`, `playwright.was.config.ts`,
35
- `playwright.wallet.config.ts`; plus the dev-grants provisioning script
36
- (`provision:dev` calls the library's `@interop/was-react/dev`).
37
-
38
- README: what BYOE/BYOS is (brief), prerequisites (WAS server, wallet), how to
39
- rename the template into a new app, how to run each test tier. Also a short
40
- CLAUDE.md describing structure and conventions.
41
-
42
- Constraints: do NOT modify life-advisor, freewallet, or was-react (except:
43
- publishing reminder below). Check in with the user when the template is done.
44
-
45
- ## Consuming @interop/was-react
46
-
47
- Published: use `"@interop/was-react": "^0.1.2"` from the npm registry (do NOT
48
- use link:/file: references). was-react peers the template must install:
49
- `react >= 19`, `react-dom`, `zustand ^5`, `rxdb ^17`, and for the mui entry:
50
- `@mui/material ^9`, `@mui/icons-material ^9`, `@emotion/react`,
51
- `@emotion/styled`, `react-router ^8`. Node-only dev entry needs `tsx` to run
52
- the provision script (or use the installed `was-provision-dev-grants` bin).
53
-
54
- ## was-react API facts (verified)
55
-
56
- - Wrap app above the router:
57
- `<WasSessionProvider config={appConfig} registry={storeRegistry}>`.
58
- - `WasAppConfig`: `{ appName, appOrigin, collections: [{ key, id }],
59
- credential: { credentialType, vocabBase }, wasServerUrl?, mediatorBase?,
60
- dbName?, storageKeyPrefix?, sync?, expiry? }`. The library builds the
61
- documentLoader/LoginConfig internally from this.
62
- - `StoreRegistry = Record<collectionKey, { hydrate(): Promise<void>;
63
- upsert(doc: {id}): void; drop(uuid): void; clear(): void }>` -- one entry
64
- per `collections[].key`.
65
- - `createEntityStore` (zustand factory) exposes
66
- `hydrate/insert/update/remove/replaceAll/patch/drop` -- NO `upsert`/`clear`;
67
- registry wiring needs small adapters: `upsert -> patch` (with a cast),
68
- `clear -> replaceAll([])`. The was-react README quick start shows exactly
69
- this for a "notes" store -- FOLLOW IT. (Optional improvement noted with the
70
- user: a `toRegistryEntry(store)` helper in was-react could remove this
71
- boilerplate; fine to add to was-react during Phase 2 if it proves annoying,
72
- it was offered and not rejected.)
73
- - Hooks: `useLogin()` -> `{ login, status, phase, error }` (phases:
74
- `probing`/`storing-key`/`requesting-grants`/`verifying`), `useSession`,
75
- `useLogout`, `useReconnect`, `useSyncStatus` (rollup:
76
- offline / error > syncing > synced), `useAppReady`.
77
- - `@interop/was-react/mui`: `ProtectedRoute` (props incl.
78
- `loginPath`, default `/login`; calls `restore()` on mount, redirects
79
- unauthenticated), `ReconnectBanner`, `SyncStatusChip`. Wallet-mode only (no
80
- dev-mode branch; life-advisor's dev `initApp`/`AUTH_MODE` pattern stays
81
- app-side -- the template does NOT need a dev mode unless the WAS e2e tier
82
- requires dev-sync, see below).
83
- - Dev sync (no wallet): app-side wiring like life-advisor's `devSync.ts` --
84
- fetch a grants JSON, `parseGrants`, `deriveIdentity({ seed })`,
85
- `startWasSync({ parsed, zcapClient, localStore,
86
- syncController: createSyncController({ collections, sync }),
87
- onRemoteChange: (key, event) => patchFromChange(registry, key, event) })`.
88
- Library exports all of these from the root entry.
89
- - `@interop/was-react/dev`: `provisionDevGrants({ serverUrl, seed,
90
- collections: string[], spaceName?, outFile?, probe? })`; CLI
91
- `was-provision-dev-grants --server-url --seed (hex|base64url)
92
- --collections a,b --space-name --out --probe`.
93
- - CHAPI E2E test bridge globals (for Playwright without a real mediator):
94
- `__WAS_REACT_E2E_CHAPI__` (activation flag),
95
- `__WAS_REACT_E2E_CHAPI_REQUESTS__`, `__WAS_REACT_E2E_CHAPI_RESPONSES__`;
96
- active when `import.meta.env.MODE !== 'production'`.
97
- - Read `~/code/Interop/was-react/README.md` -- its Quick start section is the
98
- authoritative wiring example (all symbols verified against source).
99
-
100
- ## Playwright tier facts (from life-advisor + freewallet)
101
-
102
- - Default config: offline/mocked suite, vite dev server, single chromium.
103
- - WAS config: serialized, single worker; boots the app AND a real WAS server
104
- from a sibling checkout `../was-teaching-server` (env override
105
- `WAS_SERVER_DIR`), server started with `pnpm run dev` and env
106
- `PORT`/`SERVER_URL`; the server's `SERVER_URL` must EXACTLY equal the
107
- client's `VITE_WAS_SERVER_URL` (zcap invocation-target host match).
108
- life-advisor's version uses globalSetup/globalTeardown to provision grants.
109
- - Wallet config: boots 3 servers -- was-teaching-server, freewallet
110
- (`../freewallet`, env `FREEWALLET_DIR`), and the app. life-advisor's
111
- playwright.wallet.config.ts hardcodes `/Users/dmitriz/...` defaults --
112
- use env-overridable relative defaults (`../was-teaching-server`,
113
- `../freewallet`) instead.
114
- - freewallet CI note: only the mocked tier runs in CI; WAS/wallet tiers are
115
- local/manual (need sibling checkouts).
116
-
117
- ## Repo conventions (user's rules)
118
-
119
- - pnpm, Node >= 24, MIT, author Interop Alliance. Do not commit or bump
120
- versions; user handles that. CHANGELOG dates are `TBD`.
121
- - Never use the characters `→` (use `to`), mdash (use `--`), `…` (use `...`).
122
- - Never mention `_spec` dirs, roadmap phases/tracks, or bedrock libraries in
123
- CHANGELOG/code comments.
124
- - TS style: single-use options types inlined at signatures; single-field
125
- interfaces inlined at usage.
126
- - pnpm build-script approvals: if scripts fail with ERR_PNPM_IGNORED_BUILDS,
127
- set `allowBuilds: esbuild: true` in pnpm-workspace.yaml (was done in
128
- was-react). Lockfile/minimumReleaseAge issues: stop and ask the user.
129
- - Delegate to Opus 4.8 sub-agents whenever appropriate.
130
- - Prettier in these repos: no semicolons, single quotes, no trailing commas,
131
- arrowParens avoid, proseWrap always.
132
-
133
- ## Suggested plan
134
-
135
- 1. Scaffold: Vite React-TS app modeled on life-advisor's tooling (copy its
136
- eslint/prettier/tsconfig conventions; `private: true`, no exports/files/
137
- publishConfig). `@interop/was-react@^0.1.2` + peers.
138
- 2. App: config + notes entity store + registry + provider + router (login
139
- page, protected `/notes` route, MUI shell with ReconnectBanner +
140
- SyncStatusChip). Deliberately minimal, every piece demonstrating one part.
141
- 3. Tests: vitest unit (notes store round-trip w/ fake-indexeddb), 3 Playwright
142
- tiers, provision:dev script.
143
- 4. README + CLAUDE.md. Check in with user when done.