Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        





ActorCore


Stateful, Scalable, Realtime Backend Framework






GitHub Discussions
Discord
Rivet Twitter
Rivet Bluesky
License Apache-2.0

## 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