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
Copy file name to clipboardExpand all lines: docs/stately-sky-getting-started.mdx
+3-21Lines changed: 3 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,24 +63,7 @@ You’ll need the workflow’s URL to reference it from the starter project.
63
63
64
64

65
65
66
-
## Step 4: Add your API key to the starter project
67
-
68
-
1. Open [the starter project](https://github.com/statelyai/sky-starter-app) in your code editor.
69
-
2. Install the packages using your package manager of choice:
70
-
71
-
```bash npm2yarn
72
-
npm install
73
-
```
74
-
75
-
3. At the project’s root, create a `.env` file to hold your API key.
76
-
4. Set the following two variables in the `.env` file; paste your API key as the value for both these keys:
77
-
78
-
-`SKY_API_KEY`: used by the `@xstate/cli` to fetch the machine config.
79
-
-`VITE_SKY_API_KEY`: used by the Vite React app to connect to Sky.
After adding the API key, you’ll need to create an actor.
86
69
@@ -91,6 +74,7 @@ After adding the API key, you’ll need to create an actor.
91
74
import { actorFromStately } from'@statelyai/sky';
92
75
93
76
const actor =actorFromStately({
77
+
apiKey: 'paste your API key here',
94
78
url: 'paste your Sky url here',
95
79
sessionId: 'your session id here',
96
80
});
@@ -105,7 +89,7 @@ The session ID is used to shard the multiplayer session. Each actor has a unique
105
89
106
90
:::
107
91
108
-
## Step 6: Fetching the config from Sky
92
+
## Step 5: Fetching the config from Sky
109
93
110
94
Now that we’ve created the actor, we need to fetch the config from Sky. Doing so will download and generate the machine configuration file in our repo, giving us type safety when interacting with the running actor!
111
95
@@ -134,8 +118,6 @@ Add your generated `sky.ts` files to source control.
And that’s it! You can now interact with your running actor in much the same way you would with local actors, like sending events with the `send()` function. Sky is still in its early days, so there are some limitations and things to remember. Specifically:
0 commit comments