7
7
</a >
8
8
</p >
9
9
10
- <h3 align =" center " >The Stateful Serverless Framework</h3 >
10
+ <h3 align =" center " >Stateful, Scalable, Realtime Backend Framework</h3 >
11
11
<h4 align =" center " >
12
- Build AI agents, realtime apps, game servers, and more.<br />
13
- Supports Rivet, Cloudflare Workers, Bun, and Node.js.
14
12
</h4 >
15
13
<p align =" center " >
16
14
<!-- <a href="https://github.com/rivet-gg/rivet/graphs/commit-activity"><img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/rivet-gg/rivet?style=flat-square"/></a> -->
21
19
<a href =" /LICENSE " ><img alt =" License Apache-2.0 " src =" https://img.shields.io/github/license/rivet-gg/rivet?logo=open-source-initiative&logoColor=white " ></a >
22
20
</p >
23
21
24
- ![ Code snippets] ( ./.github/media/code.png )
25
-
26
22
## Intro
27
23
28
- ### Features
24
+ The modern way to build multiplayer, realtime, or AI agent backends.
29
25
30
- - 🔋 ** Batteries Included** : State, RPC, events, & scheduling included out of the box.
31
- - 💾 ** Persistent & In-Memory** : Supports storing actor state in-memory that's automatically persisted for high-performance workloads.
32
- - ⚡ ** Multiplayer & Realtime** : Build realtime or multiplayer applications on top of actors. :floppy_disk :
33
- - ⚙️ ** Serverless & Scalable** : Built on your serverless runtime of choice to make deploying, scaling, and cost management easy. :microchip:
26
+ Supports [ Rivet] ( https://actorcore.org/platforms/rivet ) , [ Cloudflare Workers] ( https://actorcore.org/platforms/cloudflare-workers ) , [ Bun] ( https://actorcore.org/platforms/bun ) , and [ Node.js] ( https://actorcore.org/platforms/nodejs ) .
34
27
35
- ### Supported Platforms
28
+ ### Architecture
36
29
37
- - [ ** Rivet** ] ( https://actorcore.org/platforms/rivet )
38
- - [ ** Cloudflare Workers** ] ( https://actorcore.org/platforms/cloudflare-workers )
39
- - [ ** Bun** ] ( https://actorcore.org/platforms/bun )
40
- - [ ** Node.js** ] ( https://actorcore.org/platforms/nodejs )
41
- <!-- - [**Supabase Edge Functions**](https://actorcore.org/platforms/supabase) - Serverless platform-->
42
- <!-- - [**Vercel**](https://actorcore.org/platforms/vercel) - Serverless platform-->
30
+ - 💾 ** Durable, In-Memory State** : Fast in-memory access with built-in durability — no external databases or caches needed.
31
+ - ⚡ ** Ultra-Fast State Updates** : Real-time state updates with ultra-low latency, powered by co-locating compute and data.
32
+ - 🔋 ** Batteries Included** : Integrated support for state, RPC, events, scheduling, and multiplayer — no extra boilerplate code needed.
33
+ - 🖥️ ** Serverless & Scalable** : Effortless scaling, scale-to-zero, and easy deployments on any serverless runtime.
34
+
35
+ ### Features
36
+
37
+ - 💾 [ ** State** ] ( https://actorcore.org/concepts/state ) : Fast in-memory access with built-in durability.
38
+ - 💻 [ ** RPC** ] ( https://actorcore.org/concepts/rpc ) : Remote procedure calls for seamless client-server communication.
39
+ - 📡 [ ** Events** ] ( https://actorcore.org/concepts/events ) : Real-time event handling and broadcasting.
40
+ - ⏰ [ ** Scheduling** ] ( https://actorcore.org/concepts/schedule ) : Timed tasks and operations management.
41
+ - 🌐 [ ** Connections & Multiplayer** ] ( https://actorcore.org/concepts/connections ) : Manage connections and multiplayer interactions.
42
+ - 🏷️ [ ** Metadata** ] ( https://actorcore.org/concepts/metadata ) : Store and manage additional data attributes.
43
43
44
- ### Use Cases
44
+ ### What makes ActorCore different?
45
45
46
- ActorCore is ideal for applications that need coordinated state across multiple clients. Some common use cases include:
46
+ ActorCore is the modern way to build realtime, stateful backends.
47
47
48
- - AI agents
49
- - Game Servers
50
- - Collaborative applications
51
- - Local-first apps
52
- - Discord Activities
53
- - Chat Apps
54
- - Yjs Sync & Storage
55
- - Sandboxed Code Execution
48
+ | Feature | ActorCore | Durable Objects | AWS Lambda | Redis | Socket.io |
49
+ | --------------- | --------- | --------------- | ---------- | ----- | --------- |
50
+ | In-Memory State | ✓ | ✓ | | ✓ | ✓ |
51
+ | Durable State | ✓ | ✓ | | | |
52
+ | RPC | ✓ | ✓ | ✓ | | ✓ |
53
+ | Events | ✓ | | | | ✓ |
54
+ | Scheduling | ✓ | | | | |
55
+ | Edge Computing | ✓ † | ✓ | ✓ | | |
56
+ | No Vendor Lock | ✓ | | | ✓ | ✓ |
56
57
57
- By handling the complexities of state management and coordination, ActorCore lets you focus on building your application logic rather than wrestling with distributed systems primitives.
58
+ † = on supported platforms
58
59
59
60
## Getting Started
60
61
@@ -80,23 +81,23 @@ bun add actor-core
80
81
import { Actor , type Rpc } from " actor-core" ;
81
82
82
83
export interface State {
83
- messages: { username: string ; message: string }[];
84
+ messages: { username: string ; message: string }[];
84
85
}
85
86
86
87
export default class ChatRoom extends Actor <State > {
87
- // initialize this._state
88
- _onInitialize() {
89
- return { messages: [] };
90
- }
91
-
92
- // receive an remote procedure call from the client
93
- sendMessage(rpc : Rpc <ChatRoom >, username : string , message : string ) {
94
- // save message to persistent storage
95
- this ._state .messages .push ({ username , message });
96
-
97
- // broadcast message to all clients
98
- this ._broadcast (" newMessage" , username , message );
99
- }
88
+ // initialize this._state
89
+ _onInitialize() {
90
+ return { messages: [] };
91
+ }
92
+
93
+ // receive an remote procedure call from the client
94
+ sendMessage(rpc : Rpc <ChatRoom >, username : string , message : string ) {
95
+ // save message to persistent storage
96
+ this ._state .messages .push ({ username , message });
97
+
98
+ // broadcast message to all clients
99
+ this ._broadcast (" newMessage" , username , message );
100
+ }
100
101
}
101
102
```
102
103
@@ -113,7 +114,7 @@ const chatRoom = await client.get<ChatRoom>({ name: "chat" });
113
114
114
115
// listen for new messages
115
116
chatRoom .on (" newMessage" , (username : string , message : string ) =>
116
- console .log (` Message from ${username }: ${message } ` ),
117
+ console .log (` Message from ${username }: ${message } ` )
117
118
);
118
119
119
120
// send message to room
@@ -131,9 +132,9 @@ Deploy to your platform of choice:
131
132
132
133
## Community & Support
133
134
134
- - Join our [ ** Discord** ] ( https://rivet.gg/discord )
135
- - Follow us on [ ** X** ] ( https://x.com/rivet_gg )
136
- - Follow us on [ ** Bluesky** ] ( https://bsky.app/profile/rivet-gg.bsky.social )
135
+ - Join our [ ** Discord** ] ( https://rivet.gg/discord )
136
+ - Follow us on [ ** X** ] ( https://x.com/rivet_gg )
137
+ - Follow us on [ ** Bluesky** ] ( https://bsky.app/profile/rivet-gg.bsky.social )
137
138
- File bug reports in [ ** GitHub Issues** ] ( https://github.com/rivet-gg/ActorCore/issues )
138
139
- Post questions & ideas in [ ** GitHub Discussions** ] ( https://github.com/orgs/rivet-gg/discussions )
139
140
0 commit comments