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
Actors combine compute and storage into unified entities for simplified architecture. Actors seamlessly integrate with your existing infrastructure or can serve as a complete standalone solution.
By default, ActorCore will connect to `redis://127.0.0.1:6379`. See [instructions on configuring Redis](#configuring-redis).
38
+
This will start your ActorCore server in development mode.
20
39
</Step>
21
-
<Steptitle="Create New Bun Project">
22
-
```sh
23
-
# Create project
24
-
mkdir my-project
25
-
cd my-project
26
-
bun init --yes
40
+
<Steptitle="Test">
41
+
In a separate terminal, run the auto-generated test client:
27
42
43
+
```sh
44
+
bun tests/client.ts
45
+
# Outputs:
46
+
# Event: 1
47
+
# RPC: 1
48
+
```
49
+
50
+
Run this again to see the state update.
51
+
</Step>
52
+
<Steptitle="Deploy">
53
+
To build for production:
54
+
55
+
```sh
56
+
bun build
57
+
bun start
58
+
```
59
+
60
+
_Request a guide for deploying Bun to your preferred cloud provider on [GitHub Discussions](https://github.com/rivet-gg/actor-core/discussions)._
61
+
</Step>
62
+
</Steps>
63
+
64
+
## Integrating With Existing Projects
65
+
66
+
If you already have a Bun project and want to add ActorCore, you can follow these steps for manual integration. This approach gives you more control over how ActorCore fits into your existing codebase.
67
+
68
+
<Steps>
69
+
<Steptitle="Install Bun">
70
+
Install Bun [here](https://bun.sh/).
71
+
</Step>
72
+
<Steptitle="Install Packages">
73
+
```sh
28
74
# Install ActorCore
29
75
bun add actor-core @actor-core/bun
30
76
```
31
-
32
-
<Tip>ActorCore can also be used with existing Bun projects.</Tip>
33
77
</Step>
34
78
<Steptitle="Create Actor">
35
79
Create a new file for your actor at `src/counter.ts`:
@@ -49,6 +93,8 @@ import IntegrationExistingProjects from '/snippets/integration-existing-projects
49
93
cors: { origin: "http://localhost:3000" }
50
94
});
51
95
```
96
+
97
+
<IntegrationExistingProjects />
52
98
</Step>
53
99
<Steptitle="Create Client">
54
100
Create a client to connect to your actor in `src/client.ts`:
@@ -85,40 +131,18 @@ import IntegrationExistingProjects from '/snippets/integration-existing-projects
85
131
```sh
86
132
bun src/client.ts
87
133
# Outputs:
88
-
# Event: 43
89
-
# RPC: 43
134
+
# Event: 1
135
+
# RPC: 1
90
136
```
91
-
</Step>
92
-
<Steptitle="Deploy">
93
-
_Request a guide for deploying Bun to your preferred cloud provider on [GitHub Discussions](https://github.com/rivet-gg/actor-core/discussions)._
137
+
138
+
Run this again to see the state update.
94
139
</Step>
95
140
</Steps>
96
141
97
-
## Integrating With Existing Projects
98
-
99
-
<IntegrationExistingProjects />
100
-
101
142
## Available Regions
102
143
103
144
Bun can only run in one region at the moment. See [Rivet](https://rivet.gg/docs/setup) and [Cloudflare Workers](/platforms/cloudflare-workers) for supporting multiple regions.
104
145
105
-
## Configuring Redis
106
-
107
-
Configure your Redis connection like this:
108
-
109
-
```typescript
110
-
exportdefaultcreateHandler({
111
-
redis: {
112
-
port: 6379,
113
-
host: "127.0.0.1",
114
-
password: "my-top-secret"
115
-
},
116
-
// ...
117
-
});
118
-
```
119
-
120
-
See all available options [here](https://redis.github.io/ioredis/index.html#RedisOptions).
0 commit comments