Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rivet-gg/actor-core
🎭 Stateful serverless framework for Rivet, Cloudflare Workers, Bun, and Node.js. Build AI agents, realtime apps, game servers, and more.
https://github.com/rivet-gg/actor-core
actor actors agents ai ai-agents bun cloudflare-durable-objects cloudflare-workers durable-objects nodejs rivet supabase typescript vercel
Last synced: 3 days ago
JSON representation
🎭 Stateful serverless framework for Rivet, Cloudflare Workers, Bun, and Node.js. Build AI agents, realtime apps, game servers, and more.
- Host: GitHub
- URL: https://github.com/rivet-gg/actor-core
- Owner: rivet-gg
- License: apache-2.0
- Created: 2024-02-07T01:06:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-14T05:52:50.000Z (6 days ago)
- Last Synced: 2025-02-16T21:46:06.157Z (4 days ago)
- Topics: actor, actors, agents, ai, ai-agents, bun, cloudflare-durable-objects, cloudflare-workers, durable-objects, nodejs, rivet, supabase, typescript, vercel
- Language: TypeScript
- Homepage: https://actorcore.org
- Size: 25.7 MB
- Stars: 199
- Watchers: 2
- Forks: 7
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Stateful, Scalable, Realtime Backend Framework
## Intro
The modern way to build multiplayer, realtime, or AI agent backends.
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).
### Architecture
- 💾 **Durable, In-Memory State**: Fast in-memory access with built-in durability — no external databases or caches needed.
- ⚡ **Ultra-Fast State Updates**: Real-time state updates with ultra-low latency, powered by co-locating compute and data.
- 🔋 **Batteries Included**: Integrated support for state, RPC, events, scheduling, and multiplayer — no extra boilerplate code needed.
- 🖥️ **Serverless & Scalable**: Effortless scaling, scale-to-zero, and easy deployments on any serverless runtime.### Features
- 💾 [**State**](https://actorcore.org/concepts/state): Fast in-memory access with built-in durability.
- 💻 [**RPC**](https://actorcore.org/concepts/rpc): Remote procedure calls for seamless client-server communication.
- 📡 [**Events**](https://actorcore.org/concepts/events): Real-time event handling and broadcasting.
- ⏰ [**Scheduling**](https://actorcore.org/concepts/schedule): Timed tasks and operations management.
- 🌐 [**Connections & Multiplayer**](https://actorcore.org/concepts/connections): Manage connections and multiplayer interactions.
- 🏷️ [**Metadata**](https://actorcore.org/concepts/metadata): Store and manage additional data attributes.### What makes ActorCore different?
ActorCore is the modern way to build realtime, stateful backends.
| Feature | ActorCore | Durable Objects | AWS Lambda | Redis | Socket.io |
| --------------- | --------- | --------------- | ---------- | ----- | --------- |
| In-Memory State | ✓ | ✓ | | ✓ | ✓ |
| Durable State | ✓ | ✓ | | | |
| RPC | ✓ | ✓ | ✓ | | ✓ |
| Events | ✓ | | | | ✓ |
| Scheduling | ✓ | | | | |
| Edge Computing | ✓ † | ✓ | ✓ | | |
| No Vendor Lock | ✓ | | | ✓ | ✓ |† = on supported platforms
## Getting Started
### Step 1: Installation
```bash npm
# npm
npm add actor-core# pnpm
pnpm add actor-core# Yarn
yarn add actor-core# Bun
bun add actor-core
```### Step 2: Create an Actor
```typescript
import { Actor, type Rpc } from "actor-core";export interface State {
messages: { username: string; message: string }[];
}export default class ChatRoom extends Actor {
// initialize this._state
_onInitialize() {
return { messages: [] };
}// receive an remote procedure call from the client
sendMessage(rpc: Rpc, 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);
}
}
```### Step 3: Connect to Actor
```typescript
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({ 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.");
```### Step 4: Deploy
Deploy to your platform of choice:
- [**Rivet**](https://actorcore.org/platforms/rivet)
- [**Cloudflare Workers**](https://actorcore.org/platforms/cloudflare-workers)
- [**Bun**](https://actorcore.org/platforms/bun)
- [**Node.js**](https://actorcore.org/platforms/nodejs)## Community & Support
- Join our [**Discord**](https://rivet.gg/discord)
- Follow us on [**X**](https://x.com/rivet_gg)
- Follow us on [**Bluesky**](https://bsky.app/profile/rivet-gg.bsky.social)
- File bug reports in [**GitHub Issues**](https://github.com/rivet-gg/ActorCore/issues)
- Post questions & ideas in [**GitHub Discussions**](https://github.com/orgs/rivet-gg/discussions)## License
Apache 2.0