Build AI agents, realtime apps, game servers, and more.
Supports Rivet, Cloudflare Workers, Bun, and Node.js.
- ๐ Batteries Included: State, RPC, events, & scheduling included out of the box.
- ๐พ Persistent & In-Memory: Supports storing actor state in-memory that's automatically persisted for high-performance workloads.
- โก Multiplayer & Realtime: Build realtime or multiplayer applications on top of actors. ๐พ
- โ๏ธ Serverless & Scalable: Built on your serverless runtime of choice to make deploying, scaling, and cost management easy. :microchip:
ActorCore is ideal for applications that need coordinated state across multiple clients. Some common use cases include:
- AI agents
- Game Servers
- Collaborative applications
- Local-first apps
- Discord Activities
- Chat Apps
- Yjs Sync & Storage
- Sandboxed Code Execution
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.
# npm
npm add actor-core
# pnpm
pnpm add actor-core
# Yarn
yarn add actor-core
# Bun
bun add actor-core
import { Actor, type Rpc } from "actor-core";
export interface State {
messages: { username: string; message: string }[];
}
export default class ChatRoom extends Actor<State> {
// initialize this._state
_onInitialize() {
return { messages: [] };
}
// receive an remote procedure call from the client
sendMessage(rpc: Rpc<ChatRoom>, username: string, message: string) {
// save message to persistent storage
this._state.messages.push({ username, message });
// broadcast message to all clients
this._broadcast("newMessage", username, message);
}
}
import { Client } from "actor-core/client";
import type ChatRoom from "../src/chat-room.ts";
const client = new Client(/* manager endpoint */);
// connect to chat room
const chatRoom = await client.get<ChatRoom>({ name: "chat" });
// listen for new messages
chatRoom.on("newMessage", (username: string, message: string) =>
console.log(`Message from ${username}: ${message}`),
);
// send message to room
await chatRoom.sendMessage("william", "All the world's a stage.");
Deploy to your platform of choice:
- Join our Discord
- Follow us on X
- Follow us on Bluesky
- File bug reports in GitHub Issues
- Post questions & ideas in GitHub Discussions
Apache 2.0