@powerhousedao/academy 3.2.0-dev.2 → 3.2.0-dev.4

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 (67) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +188 -0
  3. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +10 -12
  4. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +8 -8
  5. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +11 -11
  6. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +13 -13
  7. package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +12 -12
  8. package/docs/academy/01-GetStarted/home.mdx +50 -51
  9. package/docs/academy/01-GetStarted/images/Connect.png +0 -0
  10. package/docs/academy/01-GetStarted/images/Packagemanager.png +0 -0
  11. package/docs/academy/01-GetStarted/images/TodoDriveApp.png +0 -0
  12. package/docs/academy/01-GetStarted/styles.module.css +7 -14
  13. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +25 -24
  14. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +17 -17
  15. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +1 -1
  16. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +15 -15
  17. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +11 -9
  18. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +15 -15
  19. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +9 -9
  20. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +15 -15
  21. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +14 -14
  22. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +6 -6
  23. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +31 -32
  24. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +7 -9
  25. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +485 -92
  26. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/{00-DocumentToolbar.md → 00-DocumentToolbar.mdx} +7 -2
  27. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/01-OperationHistory.md +12 -12
  28. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/02-RevisionHistoryTimeline.md +18 -7
  29. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/images/DocumentToolbar.png +0 -0
  30. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-DocumentTools/images/revision-history-timeline.png +0 -0
  31. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/01-RenownAuthenticationFlow.md +22 -11
  32. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/08-Authorization/02-Authorization.md +8 -8
  33. package/docs/academy/02-MasteryTrack/04-WorkWithData/01-ReadingAndWritingThroughTheAPI.mdx +13 -19
  34. package/docs/academy/02-MasteryTrack/04-WorkWithData/02-GraphQLAtPowerhouse.md +3 -3
  35. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/02-GraphQLAndSubgraphs.mdx +8 -8
  36. package/docs/academy/02-MasteryTrack/04-WorkWithData/03-WorkingWithSubgraphs/03-WorkingWithSubgraphs.md +28 -28
  37. package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +4 -4
  38. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/01-SetupBuilderEnvironment.md +14 -14
  39. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/02-CreateNewPowerhouseProject.md +2 -2
  40. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/03-GenerateAnAnalyticsProcessor.md +6 -6
  41. package/docs/academy/02-MasteryTrack/04-WorkWithData/05-AnalyticsProcessorTutorial/04-UpdateAnalyticsProcessor.md +1 -1
  42. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +2 -2
  43. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +4 -4
  44. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +7 -7
  45. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +1 -1
  46. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +6 -6
  47. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/browser.md +1 -1
  48. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +5 -5
  49. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +1 -1
  50. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/pg.md +2 -2
  51. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +1 -1
  52. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +1 -1
  53. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/index.md +1 -1
  54. package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +12 -12
  55. package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +9 -9
  56. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +8 -8
  57. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +35 -35
  58. package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +8 -8
  59. package/docs/academy/02-MasteryTrack/_category_.json +1 -1
  60. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +5 -5
  61. package/docs/academy/04-APIReferences/01-ReactHooks.md +209 -0
  62. package/docs/academy/07-Cookbook.md +105 -105
  63. package/package.json +1 -1
  64. package/sidebars.ts +9 -10
  65. package/src/css/custom.css +18 -0
  66. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.md +0 -88
  67. package/docs/academy/04-APIReferences/01-ReactHooks +0 -98
@@ -2,11 +2,16 @@
2
2
 
3
3
  The Document Toolbar is a central component in Powerhouse Connect, appearing at the top of every document view. It provides quick access to a variety of tools and functions designed to streamline your workflow and enhance document management.
4
4
 
5
+ <figure className="image-container">
6
+ <img src={require("./images/DocumentToolbar.png").default} alt="Document Toolbar" />
7
+ <figcaption>The Document Toolbar can be found at the top of any generic document.</figcaption>
8
+ </figure>
9
+
5
10
  ## Overview
6
11
 
7
12
  The toolbar is designed to be intuitive and context-aware, offering relevant options based on the document type and your current task. Its capabilities range from basic actions to more advanced document control features.
8
13
 
9
- Key functionalities often include:
14
+ ### Key functionalities in the future will include:
10
15
  * **Switchboard API Access:** Access the Switchboard API via its logo in the toolbar. This opens the Apollo Studio Sandbox, pre-populating the DocumentID for your current document model. This feature is unavailable for locally stored documents.
11
16
  * **Navigation and Versioning:** Tools for managing [document versions](/academy/MasteryTrack/BuildingUserExperiences/DocumentTools/OperationHistory), such as undo/redo, and accessing the [revision history timeline](/academy/MasteryTrack/BuildingUserExperiences/DocumentTools/RevisionHistoryTimeline).
12
17
  * **Document Actions:** Buttons for common operations like exporting or deleting documents.
@@ -17,4 +22,4 @@ Key functionalities often include:
17
22
 
18
23
  The specific set of tools available on the toolbar can be configured and may evolve as new features are introduced. This section will detail the various components and options you may encounter.
19
24
 
20
- *(Detailed sections on each toolbar feature, such as "Export Button", "Title Display", "Search Functionality", "Toggle Switches", "Icon Buttons", etc., will follow here.)*
25
+ *(Detailed information on each toolbar feature, such as "Export Button", "Title Display", "Search Functionality", "Toggle Switches", "Icon Buttons", etc., will follow here.)*
@@ -1,13 +1,13 @@
1
- # Operations History
1
+ # Operations history
2
2
 
3
- ## What Is a Document Model?
3
+ ## What is a document model?
4
4
  A **document model** in Powerhouse is the core unit for managing business data. Each document (such as an invoice, contributor agreement, or scope of work) is created from a specific document model, which defines:
5
5
 
6
6
  - **State schema:** What data the document contains
7
7
  - **Operations:** What actions can modify that document
8
8
 
9
- ## What Is Operations History?
10
- Every time a user edits a document, they do so by submitting a document operation (e.g., `ADD_LINE_ITEM`, `UPDATE_RECIPIENT`). These operations are:
9
+ ## What is an operations history?
10
+ Every time a user edits a document, they do so by submitting a document operation or a 'command' in CQRS (e.g., `ADD_LINE_ITEM`, `UPDATE_RECIPIENT`). These operations are:
11
11
 
12
12
  - **Appended** to the document's history
13
13
  - **Immutable** (you never overwrite; you always append)
@@ -15,14 +15,14 @@ Every time a user edits a document, they do so by submitting a document operatio
15
15
 
16
16
  This design is based on **event sourcing** principles.
17
17
 
18
- ## Why Use an Operations History?
18
+ ## Why use an operations history?
19
19
  - **Auditability:** Inspect every change ever made to a document.
20
20
  - **Transparency:** Contributors see what others have done.
21
21
  - **Versioning:** Revert to any prior state or resolve conflicts using branching and merging.
22
22
  - **Interoperability:** Operations are just data—they can be signed, stored on-chain, or synchronized across systems.
23
23
 
24
24
 
25
- ## Example: Invoice Document
25
+ ## Example: Invoice document
26
26
  Suppose you're editing a `powerhouse/invoice` document. Its operations history might look like this:
27
27
 
28
28
  ```plaintext
@@ -33,34 +33,34 @@ UPDATE_DUE_DATE(date: "2025-06-01")
33
33
 
34
34
  The document's state at any time is the result of running those operations in order.
35
35
 
36
- ## Visualizing Operations History
36
+ ## Visualizing the operations history
37
37
 
38
- ### Revision List and Details
38
+ ### Revision list and details
39
39
  In Connect the Powerhouse UI displays a chronologic list of all applied modifications to the document, each with a unique event ID, state hash, and commit message. You can inspect each revision for signatures and errors.
40
40
 
41
41
  ![Revision History List](./images/revision-history-list.png)
42
42
 
43
43
 
44
- ### Viewing Revision Hashes and Event IDs
44
+ ### Viewing revision hashes and event IDs
45
45
  Hovering over a revision reveals its event ID and state hash, providing traceability for every change.
46
46
 
47
47
  ![Revision Hash Popup](./images/revision-hash-popup.png)
48
48
 
49
49
 
50
- ### Signature Verification
50
+ ### Signature verification
51
51
  Clicking the signature badge shows signature details, including signer address, hash, and verification status. This ensures every operation is cryptographically auditable.
52
52
  Read more about how we are using [Renown](/academy/MasteryTrack/BuildingUserExperiences/Authorization/RenownAuthenticationFlow) for authentication & verification of signer data.
53
53
 
54
54
  ![Signature Details Popup](./images/signature-details-popup.png)
55
55
 
56
56
 
57
- ### Viewing Committer Addresses
57
+ ### Viewing committer addresses
58
58
  You can also view the committer's address for each revision, supporting full transparency and accountability.
59
59
 
60
60
  ![Committer Address Popup](./images/committer-address-popup.png)
61
61
 
62
62
 
63
- ## Replay, Branch, and Merge (UNDER DEVELOPMENT)
63
+ ## Replay, branch, and merge (under development)
64
64
  - **Replay:** When you load a document, the system replays all operations to build its state.
65
65
  - **Branch:** Create a parallel version of the document to test changes or handle conflicts.
66
66
  - **Merge:** Combine branches intelligently based on operations, not just raw field values.
@@ -1,8 +1,8 @@
1
- # Revision History Timeline
1
+ # Revision history timeline
2
2
 
3
- The timeline feature enables users to view document history and navigate through different revisions of a document. This guide explains how to implement and customize the timeline functionality in your Powerhouse application.
3
+ The history timeline feature enables users to view document history and navigate through different revisions of a document. This guide explains how to implement and customize the timeline functionality in your Powerhouse application.
4
4
 
5
- ## Enabling the Timeline Feature
5
+ ## How to enable the timeline feature
6
6
 
7
7
  To enable the timeline feature in your document editor, you need to set `timelineEnabled: true` in your editor module configuration:
8
8
 
@@ -23,9 +23,20 @@ export const module: EditorModule<ToDoDocument> = {
23
23
 
24
24
  This setting enables the timeline button in the document toolbar.
25
25
 
26
- ## Implementation Options
26
+ :::warning Heads Up!
27
+ The revision history timeline will only become visible once your document model has some operations or 'history'.
28
+ Add a few to-do's or some data in the model you are working on and the revision history timeline button in the Document Toolbar will be activated.
29
+ Click the button to see the timeline expand and see the first history 'candle' appear.
30
+ :::
27
31
 
28
- ### Default Drive Explorer
32
+ <figure className="image-container">
33
+ <img src={require("./images/revision-history-timeline.png").default} alt="revision history timeline" />
34
+ <figcaption>Once your document has a few operations added to it's history the revision history timeline gets activated.</figcaption>
35
+ </figure>
36
+
37
+ ## How to implement the timeline feature
38
+
39
+ ### Default drive explorer
29
40
 
30
41
  When using the default drive explorer with `ph connect`, the timeline functionality is handled automatically:
31
42
 
@@ -33,7 +44,7 @@ When using the default drive explorer with `ph connect`, the timeline functional
33
44
  - The timeline button appears in the toolbar when enabled
34
45
  - Users can click on timeline items to view document revisions
35
46
 
36
- ### Custom Drive Explorer
47
+ ### Custom drive explorer
37
48
 
38
49
  For custom drive explorers, you need to handle timeline items fetching and user interaction manually. Here's how:
39
50
 
@@ -86,7 +97,7 @@ const [selectedTimelineItem, setSelectedTimelineItem] = useState<TimelineItem |
86
97
  />
87
98
  ```
88
99
 
89
- ## Handling Timeline Revisions in Document Editor
100
+ ## Handling timeline revisions in document editor
90
101
 
91
102
  In your document editor (e.g., `editors/to-do-list/editor.tsx`), you need to handle the timeline context props:
92
103
 
@@ -1,34 +1,45 @@
1
- # Renown Authentication Flow
1
+ # Renown authentication flow
2
2
 
3
3
  The Renown login flow leverages decentralized identity (DID) creation and the Ceramic network for credential storage and verification, ensuring secure and verifiable actions within decentralized organizations. Below is a detailed breakdown of the process, aimed at developers integrating the Renown, Connect, and Switchboard components.
4
4
 
5
5
  ### Renown in the decentralized workplace
6
- Renown provides a decentralized identity and reputation hub, where users connect their Ethereum address, creating a **Decentralized Identifier (DID)** tied to their wallet. Renown is designed to address the challenge of trust within DAOs, where contributors often operate under pseudonyms. In traditional organizations, personal identity and reputation are key to establishing trust and accountability. Renown replicates this dynamic in the digital space, allowing contributors to earn experience and build reputation without revealing their real-world identities. Over time, contributors can share their pseudonymous profiles with other organizations as cryptographic resumes, helping to secure new opportunities while maintaining privacy.
6
+ Renown provides a decentralized identity and reputation hub, where users connect their Ethereum address, creating a **Decentralized Identifier (DID)** tied to their wallet.
7
7
 
8
- ### Detailed Login Flow
8
+ #### Why an integrated identity solution?
9
+ Renown is designed to address the challenge of trust within DAOs, where contributors often operate under pseudonyms. In traditional organizations, personal identity and reputation are key to establishing trust and accountability. Renown replicates this dynamic in the digital space, allowing contributors to earn experience and build reputation without revealing their real-world identities. Over time, contributors can share their pseudonymous profiles with other organizations as cryptographic resumes, helping to secure new opportunities while maintaining privacy.
9
10
 
10
- #### 1. User Login via Wallet Connection
11
+ ### Detailed login flow
12
+
13
+ #### 1. User login via wallet connection
11
14
  - The user starts by logging into Renown using their Ethereum address. This is done by signing a message with their wallet.
12
15
  - The Ethereum key is used to create a DID (Decentralized Identifier), which uniquely represents the user without exposing their personal identity.
13
16
 
14
- ![Renown Login](./images/ConnectAddress.png)
15
17
 
16
- #### 2. DID Creation
18
+ <figure className="image-container">
19
+ <img src={require("./images/ConnectAddress.png").default} alt="Connect Address" />
20
+ <figcaption>Connecting your Ethereum address to generate Decentralized Identifier with Renown.</figcaption>
21
+ </figure>
22
+
23
+ #### 2. DID creation
17
24
  - A Decentralized Identifier (DID) is created based on the user's Ethereum key. The DID follows a specific format:
18
25
  `did:example:123456789abcdefghijk`
19
26
  - This DID acts as the user's digital identifier across decentralized systems.
20
27
 
21
- #### 3. Credential Generation
28
+ #### 3. Credential generation
22
29
  - A credential is generated, allowing the DID to sign operations on behalf of the user. This credential is stored on Ceramic, a decentralized data stream network.
23
30
  - Ceramic ensures that the credentials are securely stored and verifiable across the network. Credentials include the user's signing permissions and are linked to the DID.
24
31
 
25
- #### 4. Operation Signing with Connect
32
+ #### 4. Operation signing with Connect
26
33
  - Connect uses the newly created DID to sign operations performed by the user. For example, when a document or transaction is edited in Connect, the operation is signed with the user's DID.
27
34
  - This ensures that every action taken within the Connect system is linked to the user's decentralized identity, maintaining transparency and accountability.
28
35
 
29
- ![Renown Login](./images/OperationsHistory.png)
30
36
 
31
- #### 5. Switchboard Verification
37
+ <figure className="image-container">
38
+ <img src={require("./images/OperationsHistory.png").default} alt="Renown Login" />
39
+ <figcaption>Your DID is used to sign operations performed by the user.</figcaption>
40
+ </figure>
41
+
42
+ #### 5. Switchboard verification
32
43
  - Once an operation is signed by the DID through Connect, it is sent to Switchboard for verification.
33
44
  - Switchboard verifies whether the DID has a valid credential stored on Ceramic and if the DID was indeed the one that signed the operation.
34
45
  - The request includes critical metadata such as the user's Ethereum address, the DID, the signed operation, and other parameters required for validation.
@@ -42,7 +53,7 @@ Renown provides a decentralized identity and reputation hub, where users connect
42
53
  }
43
54
  ```
44
55
 
45
- #### 6. Operation Validation and Execution
56
+ #### 6. Operation validation and execution
46
57
  - After Switchboard validates the operation, it ensures the operation context is accurate and the credentials match the signer.
47
58
  - The operation is then either approved or rejected based on the verification results.
48
59
  - Approved operations are processed, and changes made within the Connect system are synchronized across the relevant nodes.
@@ -1,15 +1,15 @@
1
- # Switchboard Authorization
1
+ # Switchboard authorization
2
2
 
3
3
  This tutorial explains how to configure authorization for the Powerhouse Switchboard using the new role-based authentication system.
4
4
 
5
- ## Basic Configuration
5
+ ## Basic configuration
6
6
 
7
7
  The Switchboard supports two main ways to configure authorization:
8
8
 
9
9
  1. Using environment variables
10
10
  2. Using the powerhouse configuration file
11
11
 
12
- ### Environment Variables
12
+ ### Environment variables
13
13
 
14
14
  The following environment variables can be used to configure authorization:
15
15
 
@@ -27,7 +27,7 @@ USERS="0xdef,0xghi"
27
27
  ADMINS="0x123,0x456"
28
28
  ```
29
29
 
30
- ### Powerhouse Configuration
30
+ ### Powerhouse configuration
31
31
 
32
32
  Alternatively, you can configure authorization in your `powerhouse.config.json`:
33
33
 
@@ -44,7 +44,7 @@ Alternatively, you can configure authorization in your `powerhouse.config.json`:
44
44
  }
45
45
  ```
46
46
 
47
- ## Role-Based Access Control
47
+ ## Role-based access control
48
48
 
49
49
  The new authorization system implements role-based access control with three distinct roles:
50
50
 
@@ -63,7 +63,7 @@ The new authorization system implements role-based access control with three dis
63
63
  - Can manage drives
64
64
  - Can perform administrative tasks
65
65
 
66
- ## Docker Configuration
66
+ ## Docker configuration
67
67
 
68
68
  When running the Switchboard in Docker, you can pass these configurations as environment variables:
69
69
 
@@ -75,13 +75,13 @@ docker run -e AUTH_ENABLED=true \
75
75
  your-switchboard-image
76
76
  ```
77
77
 
78
- ## Authorization Flow
78
+ ## Authorization flow
79
79
 
80
80
  1. Authentication can be enabled/disabled using AUTH_ENABLED
81
81
  2. Users are assigned roles based on their wallet addresses
82
82
  3. Each role has specific permissions and access levels
83
83
 
84
- ## Security Best Practices
84
+ ## Security best practices
85
85
 
86
86
  1. Keep your admin wallet addresses secure
87
87
  2. Use HTTPS in production environments
@@ -1,30 +1,24 @@
1
- # Read & Write through the API
1
+ # Read and write through the API
2
2
 
3
3
  ## Introduction to Switchboard
4
4
 
5
5
  **Switchboard** is the API interface that allows developers and data engineers to get access to the data, that is being collected through the use of document models in Connect & Fusion.
6
6
  After structurally capturing the desired data of your formalised business processes the data can be used to build insightful experiences in external websites, drive widgets or create specific reports and dashboard in fusion.
7
- **Since your document models have been defined with a GraphQL schema, you can use the same objects and fields in your queries and mutations to retrieve or write data from and to your document models.**
8
7
 
9
- <details>
10
- <summary>Get your Switchboard API token (if required)</summary>
11
-
12
- Your API requests are authenticated using API keys or tokens. Any request that doesn't include an API key will return an error. You can generate an API token from your Switchboard instance at any time [by logging in with your Ethereum address here](https://apps.powerhouse.io/develop/powerhouse/switchboard/user).
13
-
14
- </details>
8
+ :::tip Using the state schema of your document
9
+ Since your document models have been defined with a GraphQL schema, you can use the same objects and fields in your queries and mutations to retrieve or write data from and to your document models.
10
+ :::
15
11
 
16
12
  ## Querying a document with the GraphQL API
17
13
 
18
14
  ### Starting the reactor locally
19
15
 
20
- In this documentation we'll show how to use a **GraphQL** query to query a document model. We'll **continue on the ToDoList example** from our [introduction tutorial](/academy/GetStarted/DefineToDoListDocumentModel) , but the process can be applied to any other document model.
16
+ In this tutorial we'll show how to use a **GraphQL** query to query a document model. We'll **continue on the To-do List example** from our [introduction tutorial](/academy/GetStarted/CreateNewPowerhouseProject) , but the process can be applied to any other document model.
21
17
  To make our document model available in the Apollo Studio Sandbox we'll need to store it on a remote [Reactor](/academy/Architecture/WorkingWithTheReactor).
22
18
 
23
- :::info
19
+ :::info What are reactors?
24
20
  **Powerhouse Reactors** are the nodes in the network that store documents, resolve conflicts and rerun operations to verify document event histories.
25
21
  Reactors can be configured for local storage, centralized cloud storage or on a decentralized storage network.
26
-
27
- A reactor allows you to store multiple documents, but also host **drives** with different organisational purposes, users, access rights and more.
28
22
  :::
29
23
 
30
24
  Just like we can run Connect locally in studio mode we can run a remote node or a Reactor locally.
@@ -44,18 +38,18 @@ It will return a url to access the Reactor.
44
38
  [Reactor]: ➜ Reactor: http://localhost:4001/d/powerhouse
45
39
  ```
46
40
 
47
- ### Adding a remote drive or reactor to Connect:
41
+ ### Adding a remote drive or reactor to Connect
48
42
 
49
43
  If the remote drive or Reactor isn't present yet in connect you can add it by clicking the (+) button in the Connect drive navigation
50
44
  and using the localhost url to add a new drive with it's underlying reactor. Usually http://localhost:4001/d/powerhouse
51
45
 
52
46
  Get access to an **organisations drive** instances by adding their drive to your Connect Drive navigation tree view with the help of the correct drive url.
53
- click the (+) to add a public drive. To add a new drive you'll have to know the correct public URL of the drive.
47
+ Click the (+) to add a public drive. To add a new drive you'll have to know the correct public URL of the drive.
54
48
 
55
49
  ## Querying the state of a document
56
50
 
57
51
  Now that we have our remote reactor and/or drive running we can store our document model on it.
58
- Let's quickly create a new **todo list document** to test the process.
52
+ Let's quickly create a new to-do list document to test the process.
59
53
 
60
54
  Add to following todo's to your list:
61
55
  - [ ] Sign up for Powerhouse
@@ -66,9 +60,9 @@ Add to following todo's to your list:
66
60
 
67
61
  Now that we have some data in our document model we can query it through the GraphQL API.
68
62
 
69
- ### 1. The complete state of the document:
63
+ ### 1. The complete state of the document
70
64
 
71
- Whenever you want to start a query from a document within connect you can open up switchboard by looking for the Switchboard logo in the top right hand corner of the document editor interface.
65
+ Whenever you want to start a query from a document within connect you can open up Switchboard by looking for the Switchboard logo in the top right hand corner of the document editor interface.
72
66
  This will prepopulate the Apollo Studio Sandbox with the correct **DocumentID** for your document model. This feature will not be available for documents stored on local drives.
73
67
 
74
68
  ![Switchboardbutton](./images/SwitchboardButton.png)
@@ -79,7 +73,7 @@ The documentation on the left hand side of the Apollo Sandbox will show you all
79
73
 
80
74
  Alternatively we can just use our reactor url and endpoint to figure out the document id.
81
75
  We can find out what the id of our document is by querying the drive for it's documents.
82
- Since we only have one document in our drive it will return the id of our todo list document.
76
+ Since we only have one document in our drive it will return the id of our to-do list document.
83
77
 
84
78
  This example query is structured to request a document by its unique identifier (id).
85
79
  It extracts common fields such as **id**, **name**, **documentType**, **revision**, **created**, and **lastModified**.
@@ -93,7 +87,7 @@ As you can see there is a 'Delete' operation in the history on revision 5 as we
93
87
 
94
88
  Now let's query the content of the document using Apollo Studio Sandbox. The left sidebar shows the schema documentation, where you can explore all available fields and types for your document model.
95
89
 
96
- For our TodoList document, let's construct a query that fetches the operations with the help of a nested operations field
90
+ For our To-do List document, let's construct a query that fetches the operations with the help of a nested operations field
97
91
 
98
92
  ```graphql
99
93
  query {
@@ -11,7 +11,7 @@ In this section, we will cover **the core concepts of GraphQL with examples appl
11
11
  - **Single Endpoint**: With GraphQL, you can access all the data you need through one endpoint, reducing the number of network requests.
12
12
  - **Dynamic Queries**: Its introspective nature allows developers to explore the API's schema dynamically, which streamlines development and documentation.
13
13
 
14
- ## GraphQL: Core Concepts
14
+ ## GraphQL: Core concepts
15
15
 
16
16
  ### Schema
17
17
  The schema defines the structure of a GraphQL API. It acts as a contract between the client and server, detailing:
@@ -60,7 +60,7 @@ For example the contributor type has a relationship with the project type
60
60
 
61
61
  ---
62
62
 
63
- ### Fields & Arguments
63
+ ### Fields and arguments
64
64
  - **Field**: A specific piece of data you can request from an object. When you build a query, you select the fields you want to retrieve.
65
65
  - **Argument**: Key-value pairs that can be attached to fields to customize and refine the query. Some fields require arguments to work correctly, especially when dealing with mutations.
66
66
 
@@ -101,7 +101,7 @@ GraphQL APIs are self-documenting. Through introspection, you can query the API
101
101
  ```
102
102
 
103
103
  ---
104
- ### Connections, Edges, and Nodes
104
+ ### Connections, edges, and nodes
105
105
  When dealing with lists of data, GraphQL employs a pattern that includes:
106
106
 
107
107
  - **Connection**: A structure that represents a list of related objects.
@@ -1,4 +1,4 @@
1
- # GraphQL and Subgraphs
1
+ # GraphQL and subgraphs
2
2
 
3
3
  GraphQL plays a fundamental role in defining document model data schemas, handling data access patterns, and enabling event-driven workflows within the Powerhouse ecosystem.
4
4
  This document provides an intro to graphQL and how it is used at Powerhouse when dealing with subgraphs
@@ -8,7 +8,7 @@ More specifically, GraphQL is used as:
8
8
  - As the **query language in subgraphs**, which allow different services to expose and query structured data dynamically.
9
9
 
10
10
 
11
- ## Powerhouse's use of GraphQL Subgraphs
11
+ ## Powerhouse's use of GraphQL subgraphs
12
12
  Powerhouse structures its data into subgraphs, which are modular GraphQL services that connect to the Reactor, Powerhouse's core data infrastructure, or Operational Data Stores fueled by data from a processor.
13
13
 
14
14
  ### Fetching data from the Reactor
@@ -16,7 +16,7 @@ Powerhouse structures its data into subgraphs, which are modular GraphQL service
16
16
  Powerhouse uses GraphQL to expose system-level data, such as drives, users, and operational records.
17
17
  Example: The **System Subgraph** allows querying of drives, stored files and folders.
18
18
 
19
- ### Operational Data Stores
19
+ ### Operational data stores
20
20
 
21
21
  Custom subgraphs can be created to store and retrieve operational data in real time.
22
22
  Example: A subgraph can track file uploads and expose this data via GraphQL queries. ????
@@ -41,7 +41,7 @@ This schema ensures that every File entity has an ID, name, size, and timestamp.
41
41
 
42
42
  In Powerhouse, each subgraph has its own SDL, ensuring modularity and flexibility while working within the ecosystem.
43
43
 
44
- ## CQRS Breakdown
44
+ ## CQRS breakdown
45
45
 
46
46
  Powerhouse uses CQRS to separate write operations (commands) from read operations (queries).
47
47
  This improves system scalability and flexibility.
@@ -55,7 +55,7 @@ Powerhouse's subgraphs act as the read layer, while processors handle write oper
55
55
  | Write Model (Commands) | Handles state changes (adding, modifying, deleting) | GraphQL Mutations | Processor |
56
56
  | Read Model (Queries) | Optimized for fetching/reading/retrieving data | GraphQL Queries | Subgraph |
57
57
 
58
- ### Read & Write Separation
58
+ ### Read and write separation
59
59
  **Read Model (Query)**
60
60
 
61
61
  - Optimized for data retrieval
@@ -89,7 +89,7 @@ mutation {
89
89
  }
90
90
  ```
91
91
 
92
- ### GraphQL & Event-Driven Architecture (EDA)
92
+ ### GraphQL and event-driven architecture (EDA)
93
93
  Event-Driven Architecture (EDA) enables asynchronous processing where events trigger actions. Powerhouse uses GraphQL to expose real-time event data from its Reactor and Operational Data Stores.
94
94
 
95
95
  How GraphQL Fits into EDA
@@ -97,13 +97,13 @@ How GraphQL Fits into EDA
97
97
  - **Event Subscription Mechanism** – Powerhouse is working towards integrating GraphQL Subscriptions for real-time updates.
98
98
  - **Efficient Decoupling** – Events are stored in an operational datastore, and GraphQL queries retrieve structured results.
99
99
 
100
- #### Example: Powerhouse's Event Flow
100
+ #### Example: Powerhouse's event flow
101
101
  1. Processor detects an event (e.g., file upload).
102
102
  2. Writes event data to the Operational Data Store.
103
103
  3. Subgraph exposes the updated data via GraphQL.
104
104
 
105
105
 
106
- ## GraphQL Subscriptions
106
+ ## GraphQL subscriptions
107
107
  Although Powerhouse currently uses queries and mutations, GraphQL Subscriptions could allow real-time streaming of event-based data.
108
108
 
109
109
  #### Example (future implementation):