@powerhousedao/academy 5.1.0-dev.14 → 5.1.0-dev.17

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +11 -11
  3. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +22 -5
  4. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +2 -20
  5. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +2 -3
  6. package/docs/academy/01-GetStarted/05-BuildToDoListEditor.md +4 -4
  7. package/docs/academy/01-GetStarted/home.mdx +43 -104
  8. package/docs/academy/01-GetStarted/images/DocumentModelOperations.png +0 -0
  9. package/docs/academy/01-GetStarted/styles.module.css +30 -6
  10. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-VetraStudio.md +95 -0
  11. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/{02-StandardDocumentModelWorkflow.md → 03-CreateAPackageWithVetra.md} +202 -33
  12. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/{03-BuilderTools.md → BuilderTools} +1 -1
  13. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +4 -4
  14. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +34 -34
  15. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/03-DocumentPermissions.md +387 -0
  16. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +118 -184
  17. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +1 -1
  18. package/docs/academy/02-MasteryTrack/05-Launch/05-DockerDeployment.md +1 -1
  19. package/docs/academy/02-MasteryTrack/_category_.json +1 -1
  20. package/docs/academy/03-ExampleUsecases/00-Overview.mdx +60 -0
  21. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +38 -16
  22. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +11 -14
  23. package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +12 -95
  24. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +30 -20
  25. package/docs/academy/03-ExampleUsecases/Chatroom/{06-LaunchALocalReactor.md → 06-LaunchALocalReactor} +13 -8
  26. package/docs/academy/03-ExampleUsecases/VetraPackageLibrary/VetraPackageLibrary.md +13 -0
  27. package/docs/academy/03-ExampleUsecases/_category_.json +9 -0
  28. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +168 -15
  29. package/docs/academy/04-APIReferences/01-ReactHooks.md +7 -0
  30. package/docs/academy/04-APIReferences/04-RelationalDatabase.md +6 -0
  31. package/docs/academy/04-APIReferences/renown-sdk/03-CLIIdentity.md +321 -0
  32. package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +46 -11
  33. package/docs/academy/07-Cookbook.md +598 -145
  34. package/docs/academy/08-Glossary.md +1 -1
  35. package/docusaurus.config.ts +13 -35
  36. package/package.json +1 -1
  37. package/sidebars.ts +11 -11
  38. package/src/css/custom.css +28 -30
  39. package/src/theme/DocSidebarItem/Category/index.tsx +47 -0
  40. package/tsconfig.tsbuildinfo +1 -1
  41. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/05-VetraStudio.md +0 -253
  42. package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +0 -78
@@ -16,11 +16,7 @@ pnpm install -g ph-cmd
16
16
 
17
17
  :::
18
18
 
19
- <!-- AUTO-GENERATED-CLI-COMMANDS-START -->\n<!-- This content is automatically generated. Do not edit directly. -->\n
20
-
21
- ### ph-cmd Commands
22
-
23
- - [Checkout](#checkout)
19
+ <!-- AUTO-GENERATED-CLI-COMMANDS-START -->\n<!-- This content is automatically generated. Do not edit directly. -->\n### ph-cmd Commands\n\n- [Checkout](#checkout)
24
20
  - [Init](#init)
25
21
  - [Setup Globals](#setup-globals)
26
22
  - [Update](#update)
@@ -247,7 +243,8 @@ Examples:
247
243
 
248
244
  ---
249
245
 
250
- *This document was automatically generated from the help text in the codebase.*\n\n### ph-cli Commands\n\n- [Connect Build](#connect-build)
246
+ *This document was automatically generated from the help text in the codebase.*\n\n### ph-cli Commands\n\n- [Access Token](#access-token)
247
+ - [Connect Build](#connect-build)
251
248
  - [Connect Preview](#connect-preview)
252
249
  - [Connect Studio](#connect-studio)
253
250
  - [Dev](#dev)
@@ -255,6 +252,7 @@ Examples:
255
252
  - [Inspect](#inspect)
256
253
  - [Install](#install)
257
254
  - [List](#list)
255
+ - [Login](#login)
258
256
  - [Reactor](#reactor)
259
257
  - [Service](#service)
260
258
  - [Switchboard](#switchboard)
@@ -262,6 +260,76 @@ Examples:
262
260
  - [Version](#version)
263
261
  - [Vetra](#vetra)
264
262
 
263
+ ## Access Token
264
+
265
+ ```
266
+ Command Overview:
267
+ The access-token command generates a bearer token for API authentication. This token
268
+ can be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).
269
+
270
+ This command:
271
+ 1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential
272
+ 2. Creates a JWT bearer token with configurable expiration
273
+ 3. Outputs the token to stdout (info to stderr) for easy piping
274
+
275
+ Prerequisites:
276
+ You must have a cryptographic identity. Run 'ph login' first to:
277
+ - Generate a keypair (stored in .keypair.json)
278
+ - Optionally link your Ethereum address (stored in .auth.json)
279
+
280
+ Options:
281
+ --expiry <duration> Set the token expiration time. Supports multiple formats:
282
+ - Days: "7d" (default), "30d", "1d"
283
+ - Hours: "24h", "12h", "1h"
284
+ - Seconds: "3600", "3600s", "86400s"
285
+ Default is 7 days.
286
+
287
+ --audience <url> Optional. Set the intended audience (aud claim) for the token.
288
+ This can be used to restrict the token to specific services.
289
+
290
+ Token Details:
291
+ The generated token is a JWT (JSON Web Token) containing:
292
+ - Issuer (iss): Your CLI's DID (did:key:...)
293
+ - Subject (sub): Your CLI's DID
294
+ - Credential Subject: Chain ID, network ID, and address (if authenticated)
295
+ - Expiration (exp): Based on --expiry option
296
+ - Audience (aud): If --audience is specified
297
+
298
+ Output:
299
+ - Token information (DID, address, expiry) is printed to stderr
300
+ - The token itself is printed to stdout for easy piping/copying
301
+
302
+ This allows you to use the command in scripts:
303
+ TOKEN=$(ph access-token)
304
+ curl -H "Authorization: Bearer $TOKEN" http://localhost:4001/graphql
305
+
306
+ Examples:
307
+ $ ph access-token # Generate token valid for 7 days
308
+ $ ph access-token --expiry 30d # Generate token valid for 30 days
309
+ $ ph access-token --expiry 24h # Generate token valid for 24 hours
310
+ $ ph access-token --expiry 3600 # Generate token valid for 1 hour (3600 seconds)
311
+ $ ph access-token --audience http://localhost:4001 # Set audience claim
312
+ $ ph access-token | pbcopy # Copy token to clipboard (macOS)
313
+ $ ph access-token | xclip -selection c # Copy token to clipboard (Linux)
314
+
315
+ Usage with APIs:
316
+ # Generate token and use with curl
317
+ TOKEN=$(ph access-token --expiry 1d)
318
+ curl -X POST http://localhost:4001/graphql \\
319
+ -H "Content-Type: application/json" \\
320
+ -H "Authorization: Bearer $TOKEN" \\
321
+ -d '{"query": "{ drives { id name } }"}'
322
+
323
+ # Export as environment variable
324
+ export PH_ACCESS_TOKEN=$(ph access-token)
325
+
326
+ Notes:
327
+ - Tokens are self-signed using your CLI's private key
328
+ - No network request is made; tokens are generated locally
329
+ - The recipient API must trust your CLI's DID to accept the token
330
+ - For reactor-api, ensure AUTH_ENABLED=true to require authentication
331
+ ```
332
+
265
333
  ## Connect Build
266
334
 
267
335
  ```
@@ -604,6 +672,76 @@ Notes:
604
672
  - Each package is displayed by its package name
605
673
  ```
606
674
 
675
+ ## Login
676
+
677
+ ```
678
+ Command Overview:
679
+ The login command authenticates you with Renown using your Ethereum wallet. This enables
680
+ the CLI to act on behalf of your Ethereum identity for authenticated operations.
681
+
682
+ This command:
683
+ 1. Generates or loads a cryptographic identity (DID) for the CLI
684
+ 2. Opens your browser to the Renown authentication page
685
+ 3. You authorize the CLI's DID to act on behalf of your Ethereum address
686
+ 4. Stores the credentials locally in ~/.ph/auth.json
687
+
688
+ Options:
689
+ --renown-url <url> Specify a custom Renown server URL. Defaults to
690
+ https://www.renown.id
691
+
692
+ --timeout <seconds> Set the authentication timeout in seconds. The command will
693
+ wait this long for you to complete authentication in the browser.
694
+ Defaults to 300 seconds (5 minutes).
695
+
696
+ --logout Sign out and clear your stored credentials. Use this when you
697
+ want to switch accounts or revoke local authentication.
698
+
699
+ --status Show your current authentication status without logging in.
700
+ Displays your CLI DID, ETH address, and when you authenticated.
701
+
702
+ --show-did Show only the CLI's DID and exit. Useful for scripts.
703
+
704
+ Authentication Flow:
705
+ 1. Run 'ph login' - the CLI generates/loads its cryptographic identity (DID)
706
+ 2. A browser window opens to Renown with the CLI's DID
707
+ 3. Connect your Ethereum wallet (MetaMask, etc.)
708
+ 4. Authorize the CLI's DID to act on behalf of your ETH address
709
+ 5. Return to your terminal - authentication is complete!
710
+
711
+ Credentials Storage:
712
+ All identity files are stored per-project in the current working directory:
713
+
714
+ .keypair.json The CLI's cryptographic keypair (ECDSA P-256)
715
+ .auth.json Your authentication credentials including:
716
+ - Your Ethereum address (the account you authorized)
717
+ - Your User DID (did:pkh:eip155:chainId:address)
718
+ - CLI DID (did:key:... - the CLI's cryptographic identity)
719
+ - Credential ID for session validation
720
+
721
+ This allows each project to have its own identity and credentials.
722
+ For CI/CD, provide the keypair via PH_RENOWN_PRIVATE_KEY env variable.
723
+
724
+ Environment Variables:
725
+ PH_RENOWN_PRIVATE_KEY JSON-encoded JWK keypair for the CLI's identity.
726
+ If set, the CLI will use this instead of generating
727
+ or loading from file. Useful for CI/CD environments.
728
+
729
+ Examples:
730
+ $ ph login # Authenticate with default settings
731
+ $ ph login --status # Check authentication status and CLI DID
732
+ $ ph login --show-did # Print only the CLI's DID
733
+ $ ph login --logout # Sign out and clear credentials
734
+ $ ph login --timeout 600 # Wait up to 10 minutes for authentication
735
+ $ ph login --renown-url http://localhost:3000 # Use local Renown server
736
+
737
+ Notes:
738
+ - You only need to authenticate once; credentials persist until you log out
739
+ - The CLI's DID remains stable unless you delete .keypair.json from your project
740
+ - If already authenticated, the command will show your current status
741
+ - The browser must remain open until authentication completes
742
+ - Your wallet signature authorizes the CLI's DID to act on your behalf
743
+ ```
744
+
607
745
  ## Reactor
608
746
 
609
747
  ```
@@ -701,29 +839,42 @@ Command Overview:
701
839
  2. Loads document models and processors
702
840
  3. Provides an API for document operations
703
841
  4. Enables real-time document processing
842
+ 5. Can authenticate with remote services using your identity from 'ph login'
704
843
 
705
844
  Options:
706
845
  --port <PORT> Port to host the API. Default is 4001.
707
-
708
- --config-file <path> Path to the powerhouse.config.js file. Default is
846
+
847
+ --config-file <path> Path to the powerhouse.config.js file. Default is
709
848
  './powerhouse.config.json'. This configures the switchboard behavior.
710
-
849
+
711
850
  --dev Enable development mode to load local packages from the current directory.
712
851
  This allows the switchboard to discover and load document models, processors,
713
852
  and subgraphs from your local development environment.
714
-
853
+
715
854
  --db-path <DB_PATH> Path to the database for storing document data.
716
-
855
+
717
856
  --https-key-file <path> Path to the SSL key file if using HTTPS for secure connections.
718
-
857
+
719
858
  --https-cert-file <path> Path to the SSL certificate file if using HTTPS.
720
-
859
+
721
860
  --packages <pkg...> List of packages to be loaded. If defined, packages specified
722
861
  in the config file are ignored.
723
-
724
- --base-path <path> Base path for the API endpoints. Sets the BASE_PATH environment
862
+
863
+ --base-path <path> Base path for the API endpoints. Sets the BASE_PATH environment
725
864
  variable used by the server to prefix all routes.
726
865
 
866
+ Identity Options:
867
+ --use-identity Enable identity using the keypair from 'ph login'. This allows the
868
+ switchboard to authenticate with remote drives and services using
869
+ your authorized Ethereum identity.
870
+
871
+ --keypair-path <path> Path to a custom keypair file. Overrides the default .keypair.json
872
+ in the current directory.
873
+
874
+ --require-identity Require an existing keypair; fail if not found. Use this when you
875
+ want to ensure the switchboard runs with a valid identity. If no
876
+ keypair exists, run 'ph login' first to create one.
877
+
727
878
  Examples:
728
879
  $ ph switchboard # Start switchboard with default settings
729
880
  $ ph switchboard --port 5000 # Use custom port 5000
@@ -731,6 +882,8 @@ Examples:
731
882
  $ ph switchboard --config-file custom.json # Use custom configuration file
732
883
  $ ph switchboard --packages pkg1 pkg2 # Load specific packages
733
884
  $ ph switchboard --base-path /switchboard # Set API base path to /switchboard
885
+ $ ph switchboard --use-identity # Start with identity from ph login
886
+ $ ph switchboard --require-identity # Require identity, fail if not logged in
734
887
  ```
735
888
 
736
889
  ## Uninstall
@@ -1,3 +1,10 @@
1
+ ---
2
+ toc_max_heading_level: 2
3
+
4
+
5
+ ---
6
+
7
+
1
8
  # React Hooks
2
9
 
3
10
  On this page we're providing an overview of the available hooks you can make use of as a builder.
@@ -1,3 +1,9 @@
1
+ ---
2
+ toc_max_heading_level: 2
3
+
4
+
5
+ ---
6
+
1
7
  # Relational Database
2
8
 
3
9
  This page covers the relational database tools available in Powerhouse applications, providing type-safe database operations with real-time updates through PGlite integration.
@@ -0,0 +1,321 @@
1
+ # CLI Identity & Authentication
2
+
3
+ This guide covers how to authenticate the Powerhouse CLI with your Ethereum identity and use that identity in the Switchboard for authenticated operations with remote services.
4
+
5
+ ## Overview
6
+
7
+ The Powerhouse CLI uses **Renown** for identity management. When you run `ph login`, the CLI:
8
+
9
+ 1. Generates a cryptographic keypair (ECDSA P-256) stored locally
10
+ 2. Creates a DID (Decentralized Identifier) in `did:key:...` format
11
+ 3. Opens your browser to authorize this DID to act on behalf of your Ethereum address
12
+ 4. Stores the authorization credentials for future use
13
+
14
+ This enables the CLI and Switchboard to authenticate with remote drives and services using your Ethereum identity.
15
+
16
+ ## Quick Start
17
+
18
+ ```bash
19
+ # 1. Login with your Ethereum wallet
20
+ ph login
21
+
22
+ # 2. Start switchboard with your identity
23
+ ph switchboard --use-identity
24
+ ```
25
+
26
+ ## The Login Command
27
+
28
+ ### Basic Usage
29
+
30
+ ```bash
31
+ # Authenticate with Renown
32
+ ph login
33
+
34
+ # Check your authentication status
35
+ ph login --status
36
+
37
+ # Show only your CLI's DID (useful for scripts)
38
+ ph login --show-did
39
+
40
+ # Logout and clear credentials
41
+ ph login --logout
42
+ ```
43
+
44
+ ### How It Works
45
+
46
+ ```
47
+ ┌──────────────────────────────────────────────────────────────────────┐
48
+ │ ph login │
49
+ ├──────────────────────────────────────────────────────────────────────┤
50
+ │ │
51
+ │ 1. CLI generates/loads keypair (.keypair.json) │
52
+ │ └─► Creates DID: did:key:zDnae... │
53
+ │ │
54
+ │ 2. Opens browser to Renown portal │
55
+ │ └─► URL includes CLI's DID │
56
+ │ │
57
+ │ 3. User connects wallet & signs authorization │
58
+ │ └─► "I authorize did:key:zDnae... to act on my behalf" │
59
+ │ │
60
+ │ 4. Renown issues credential │
61
+ │ └─► Links CLI DID to user's ETH address │
62
+ │ │
63
+ │ 5. CLI stores credentials (.auth.json in project dir) │
64
+ │ └─► Ready to authenticate with remote services │
65
+ │ │
66
+ └──────────────────────────────────────────────────────────────────────┘
67
+ ```
68
+
69
+ ### Output Example
70
+
71
+ ```
72
+ $ ph login
73
+ Initializing cryptographic identity...
74
+ CLI DID: did:key:zDnaej4f3d83mmCodYjZyHzUKDSt2dGVKjzD8dd22AS83GtMo
75
+
76
+ Opening browser for authentication...
77
+ Session ID: a1b2c3d4...
78
+
79
+ Waiting for authentication in browser
80
+ (timeout in 300 seconds)
81
+
82
+ Please connect your wallet and authorize this CLI to act on your behalf.
83
+
84
+ Waiting.................
85
+
86
+ Successfully authenticated!
87
+ ETH Address: 0x1234...abcd
88
+ User DID: did:pkh:eip155:1:0x1234...abcd
89
+ CLI DID: did:key:zDnaej4f3d83mmCodYjZyHzUKDSt2dGVKjzD8dd22AS83GtMo
90
+
91
+ The CLI can now act on behalf of your Ethereum identity.
92
+ ```
93
+
94
+ ## Storage Locations
95
+
96
+ All identity files are stored **per-project** in the current working directory:
97
+
98
+ ```
99
+ your-project/
100
+ ├── .keypair.json # CLI's cryptographic keypair (did:key identity)
101
+ ├── .auth.json # Authentication credentials (ETH address, User DID, etc.)
102
+ ├── powerhouse.config.json
103
+ └── ...
104
+ ```
105
+
106
+ This means each project can have its own identity and credentials, which is useful for:
107
+ - Different projects requiring different identities
108
+ - Team members using the same machine
109
+ - Separating development and production identities
110
+ - Isolating credentials between projects
111
+
112
+ ### Environment Variable
113
+
114
+ For CI/CD environments, provide the keypair via environment variable:
115
+
116
+ ```bash
117
+ # Export keypair as JSON
118
+ export PH_RENOWN_PRIVATE_KEY='{"publicKey":{"kty":"EC",...},"privateKey":{"kty":"EC",...}}'
119
+
120
+ # Now ph login --show-did will use this keypair
121
+ ph login --show-did
122
+ ```
123
+
124
+ ## Using Identity in Switchboard
125
+
126
+ ### Starting with Identity
127
+
128
+ ```bash
129
+ # Enable identity using keypair from ph login
130
+ ph switchboard --use-identity
131
+
132
+ # Output includes identity DID:
133
+ # ➜ Switchboard: http://localhost:4001
134
+ # ➜ Identity: did:key:zDnaej4f3d83mmCodYjZyHzUKDSt2dGVKjzD8dd22AS83GtMo
135
+ ```
136
+
137
+ ### Identity Options
138
+
139
+ | Option | Description |
140
+ |--------|-------------|
141
+ | `--use-identity` | Enable identity using `.keypair.json` |
142
+ | `--keypair-path <path>` | Use a custom keypair file |
143
+ | `--require-identity` | Fail if no keypair exists |
144
+
145
+ ### Requiring Identity
146
+
147
+ Use `--require-identity` when the switchboard must have a valid identity:
148
+
149
+ ```bash
150
+ # Fails if no keypair exists (user must run ph login first)
151
+ ph switchboard --require-identity
152
+
153
+ # Error if not logged in:
154
+ # Error: Identity required but failed to initialize. Run "ph login" first.
155
+ ```
156
+
157
+ ### Custom Keypair Path
158
+
159
+ ```bash
160
+ # Use a specific keypair file
161
+ ph switchboard --use-identity --keypair-path /path/to/my-keypair.json
162
+ ```
163
+
164
+ ## How the Switchboard Uses Identity
165
+
166
+ When the Switchboard starts with identity enabled, it can:
167
+
168
+ 1. **Authenticate with Remote Drives**: Generate bearer tokens for API requests
169
+ 2. **Sign Operations**: Cryptographically sign document operations
170
+ 3. **Identify Itself**: Present its DID to remote services
171
+
172
+ ### Getting Bearer Tokens
173
+
174
+ The Switchboard can generate bearer tokens for authenticated API calls:
175
+
176
+ ```typescript
177
+ import { getBearerToken, getConnectDid } from "@powerhousedao/switchboard";
178
+
179
+ // Get the switchboard's DID
180
+ const did = await getConnectDid();
181
+ console.log("Switchboard DID:", did);
182
+
183
+ // Get a bearer token for a remote drive
184
+ const token = await getBearerToken("https://remote.drive.example.com");
185
+ console.log("Bearer Token:", token);
186
+
187
+ // Use in API requests
188
+ const response = await fetch("https://remote.drive.example.com/api/documents", {
189
+ headers: {
190
+ Authorization: `Bearer ${token}`,
191
+ },
192
+ });
193
+ ```
194
+
195
+ ## Security Considerations
196
+
197
+ ### Identity Files Protection
198
+
199
+ The `.keypair.json` and `.auth.json` files contain sensitive data. Protect them:
200
+
201
+ ```bash
202
+ # Add to .gitignore
203
+ echo ".keypair.json" >> .gitignore
204
+ echo ".auth.json" >> .gitignore
205
+
206
+ # Set restrictive permissions (Unix)
207
+ chmod 600 .keypair.json .auth.json
208
+ ```
209
+
210
+ ### CI/CD Best Practices
211
+
212
+ For automated environments:
213
+
214
+ 1. **Use environment variables** instead of files
215
+ 2. **Store secrets securely** (GitHub Secrets, AWS Secrets Manager, etc.)
216
+ 3. **Rotate keys** periodically
217
+ 4. **Limit scope** - use separate identities for different environments
218
+
219
+ ```yaml
220
+ # GitHub Actions example
221
+ jobs:
222
+ deploy:
223
+ runs-on: ubuntu-latest
224
+ steps:
225
+ - uses: actions/checkout@v4
226
+ - name: Setup identity
227
+ env:
228
+ PH_RENOWN_PRIVATE_KEY: ${{ secrets.PH_KEYPAIR }}
229
+ run: |
230
+ ph switchboard --use-identity &
231
+ ```
232
+
233
+ ### Authorization Scope
234
+
235
+ When you authorize the CLI's DID:
236
+ - It can act on behalf of your Ethereum address
237
+ - It can authenticate with services that trust Renown
238
+ - It **cannot** sign Ethereum transactions or access your wallet
239
+
240
+ ## Troubleshooting
241
+
242
+ ### "No existing keypair found"
243
+
244
+ ```bash
245
+ $ ph switchboard --require-identity
246
+ Error: Identity required but failed to initialize. Run "ph login" first.
247
+ ```
248
+
249
+ **Solution**: Run `ph login` to create a keypair:
250
+
251
+ ```bash
252
+ ph login
253
+ # Then retry
254
+ ph switchboard --require-identity
255
+ ```
256
+
257
+ ### "Authentication timed out"
258
+
259
+ The browser authentication didn't complete in time.
260
+
261
+ **Solutions**:
262
+ - Increase timeout: `ph login --timeout 600`
263
+ - Check browser opened correctly
264
+ - Ensure you completed the wallet connection
265
+
266
+ ### Different DID than expected
267
+
268
+ Each project directory has its own `.keypair.json`.
269
+
270
+ **Check current DID**:
271
+ ```bash
272
+ ph login --show-did
273
+ ```
274
+
275
+ **Use specific keypair**:
276
+ ```bash
277
+ ph switchboard --use-identity --keypair-path ~/.shared-keypair.json
278
+ ```
279
+
280
+ ## API Reference
281
+
282
+ ### Login Options
283
+
284
+ | Option | Type | Default | Description |
285
+ |--------|------|---------|-------------|
286
+ | `--renown-url` | string | `https://renown.powerhouse.io` | Renown server URL |
287
+ | `--timeout` | number | `300` | Auth timeout (seconds) |
288
+ | `--logout` | boolean | `false` | Clear credentials |
289
+ | `--status` | boolean | `false` | Show auth status |
290
+ | `--show-did` | boolean | `false` | Print DID only |
291
+
292
+ ### Switchboard Identity Options
293
+
294
+ | Option | Type | Default | Description |
295
+ |--------|------|---------|-------------|
296
+ | `--use-identity` | boolean | `false` | Enable identity |
297
+ | `--keypair-path` | string | `.keypair.json` | Keypair file path |
298
+ | `--require-identity` | boolean | `false` | Fail without keypair |
299
+
300
+ ### Exported Functions (Switchboard)
301
+
302
+ ```typescript
303
+ // Get the ConnectCrypto instance
304
+ function getConnectCrypto(): IConnectCrypto | null;
305
+
306
+ // Get the switchboard's DID
307
+ async function getConnectDid(): Promise<string | null>;
308
+
309
+ // Get a bearer token for a remote URL
310
+ async function getBearerToken(
311
+ driveUrl: string,
312
+ address?: string,
313
+ refresh?: boolean
314
+ ): Promise<string | null>;
315
+ ```
316
+
317
+ ## Related Documentation
318
+
319
+ - [Renown SDK Overview](./00-Overview.md) - Introduction to Renown
320
+ - [Authentication Guide](./01-Authentication.md) - Web app authentication
321
+ - [API Reference](./02-APIReference.md) - Full SDK reference
@@ -1,20 +1,55 @@
1
1
  # Powerhouse Architecture
2
2
 
3
- **Vetra is part of the Powerhouse Ecosystem** and acts as the builder platform and builder tooling for scalable network organizations.
3
+ **Vetra is part of the Powerhouse Ecosystem** and acts as the builder platform for creating an independent, open-source and decentralized back-end for any SaaS, ERP, CMS or CRM needs.
4
4
 
5
- The Powerhouse ecosystem makes use of 4 core host applications that together form a modular, scalable operating system for decentralized organizations.
6
- Each application serves a distinct role, yet they are interdependent, working as a unified system to streamline operations, enhance collaboration, and drive automation.
5
+ ## Local First. Built to Scale.
7
6
 
8
- These five applications are:
7
+ Vetra helps you build any type of web application on a **Reactive Document Architecture**. Define workflows once, deploy them globally, and co-own the software you create. The architecture is built on a minimal but powerful tech-stack: **GraphQL**, **TypeScript**, and **React**.
9
8
 
10
- 1. **Connect** The contributor's public or private workspace.
11
- 2. **Switchboard** – The data infrastructure and API engine.
12
- 3. **Fusion** The public-facing collaboration hub.
13
- 4. **Renown** – The decentralized reputation and identity system.
9
+ ### Reactive Document Architecture
10
+
11
+ The Powerhouse framework is built around structured document models and declarative design:
12
+
13
+ - **Reactive**: Real-time, responsive, and message-driven with an elastic scalable architecture.
14
+ - **Document-Centric**: Documents as local-first, self-contained data structures and nodes in a decentralized network.
15
+ - **Git-like UX**: State-of-the-art editing with history branching, merging, and commenting.
16
+ - **Stateful**: Documents with well-defined operations as state transitions become mini-APIs.
17
+ - **Scalable**: CQRS and EDA-inspired architecture with read models for data aggregation.
18
+
19
+ ## Target Audiences
20
+
21
+ Vetra supports a variety of organizations with a headless open-source back-end:
22
+
23
+ - Decentralized Autonomous Organizations (DAOs)
24
+ - Scalable Network Organizations (an evolution of DAOs within the Powerhouse framework)
25
+ - NGOs and Governmental Organizations
26
+ - Cooperatives and distributed teams
27
+
28
+ ## Host Applications
29
+
30
+ The Powerhouse ecosystem makes use of 4 core host applications that together form a modular, scalable operating system for any organization or business. Each application serves a distinct role, yet they are interdependent—working as a unified system to streamline operations, enhance collaboration, and drive automation.
31
+
32
+ 1. **Connect** – A collaboration hub and private workspace for independent contributors.
33
+ 2. **Switchboard** – The data infrastructure and API engine for managing remote instances.
34
+ 3. **Fusion** – An SDK for visualizing collected data and public-facing collaboration.
35
+ 4. **Renown** – A decentralized reputation and identity system.
36
+
37
+ ## How It All Connects: Reactors
38
+
39
+ The host applications sync their documents with one another through **Reactors**. A reactor is a node within any Powerhouse network responsible for storing documents, resolving conflicts, and verifying document event histories.
40
+
41
+ Reactors can be configured for:
42
+ - **Local Storage** – For offline or on-device access.
43
+ - **Cloud Storage** – For centralized, scalable data management.
44
+ - **Decentralized Storage** – Such as Ceramic or IPFS for distributed storage.
45
+
46
+ The documents within the network react to one another through the **DocSync** protocol—which sends updates from one reactor to another, ensuring all data stays synchronized across the system.
14
47
 
15
48
  ![Powerhouse Host Apps Interaction](./images/PowerhouseArchitecture.png)
16
49
 
17
- With the help of these host applications Powerhouse is launching 2 platforms that form an example of the infrastructure that can be build with the Powerhouse techstack.
50
+ ## Powerhouse Platforms
51
+
52
+ With the help of these host applications, Powerhouse is launching 2 platforms that demonstrate the infrastructure that can be built with the Powerhouse tech-stack:
18
53
 
19
- - [Vetra Builder Platform](https://vetra.io/): Sovereign infrastructure for scalable network organizations that is local first, built to scale.
20
- - [Achra Decentralized Operations Platform](https://achra.com/): Where open organizations can procure and purchase services.
54
+ - [**Vetra Builder Platform**](https://vetra.io/): Sovereign infrastructure for scalable network organizationslocal first, built to scale.
55
+ - [**Achra Decentralized Operations Platform**](https://achra.com/): Where open organizations can procure and purchase services.