https://github.com/opengamebackend/opengamebackend
🎭 Stateful serverless framework for Rivet, Cloudflare Workers, Bun, and Node.js. Build AI agents, realtime apps, game servers, and more.
https://github.com/opengamebackend/opengamebackend
actor actors agents ai ai-agents bun cloudflare-durable-objects cloudflare-workers durable-objects nodejs rivet supabase typescript vercel
Last synced: 11 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/opengamebackend/opengamebackend
- Owner: rivet-gg
- License: apache-2.0
- Created: 2024-02-07T01:06:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-11T00:55:39.000Z (12 days ago)
- Last Synced: 2025-04-11T23:19:46.719Z (11 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: 28.2 MB
- Stars: 552
- Watchers: 3
- Forks: 20
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Support: docs/support/enterprise.mdx
Awesome Lists containing this project
README
Stateful, Scalable, Realtime Backend Framework
## Intro
The modern way to build multiplayer, realtime, or AI agent backends.
Runs on [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). Integrates with [Hono](https://actorcore.org/integrations/hono) and [Redis](https://actorcore.org/drivers/redis).
### Architecture
- 💾 **Persistent, 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, actions, 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.
- 💻 [**Actions**](https://actorcore.org/concepts/actions): Callable functions 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.### Everything you need to build realtime, stateful backends
ActorCore provides a solid foundation with the features you'd expect for modern apps.
| Feature | ActorCore | Durable Objects | Socket.io | Redis | AWS Lambda |
| --------------- | --------- | --------------- | --------- | ----- | ---------- |
| In-Memory State | ✓ | ✓ | ✓ | ✓ | |
| Persisted State | ✓ | ✓ | | | |
| Actions (RPC) | ✓ | ✓ | ✓ | | ✓ |
| Events (Pub/Sub)| ✓ | - | ✓ | ✓ | |
| Scheduling | ✓ | - | | | - |
| Edge Computing | ✓ † | ✓ | | | ✓ |
| No Vendor Lock | ✓ | | ✓ | ✓ | |_\- = requires significant boilerplate code or external service_
_† = on supported platforms_
## Quickstart
Run this command:
```
npx create-actor@latest
```## Supported Platforms
- [**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)## Overview
**Create Actor**
```typescript
import { actor, setup } from "actor-core";const chatRoom = actor({
state: { messages: [] },
actions: {
// receive an action call from the client
sendMessage: (c, username: string, message: string) => {
// save message to persistent storage
c.state.messages.push({ username, message });// broadcast message to all clients
c.broadcast("newMessage", username, message);
},
// allow client to request message history
getMessages: (c) => c.state.messages
},
});export const app = setup({
actors: { chatRoom },
cors: { origin: "http://localhost:8080" }
});export type App = typeof app;
```**Connect to Actor**
```typescript
import { createClient } from "actor-core/client";
import type { App } from "../src/index";const client = createClient(/* manager endpoint */);
// connect to chat room
const chatRoom = await client.chatRoom.get({ channel: "random" });// 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.");
```## 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)
- File bug reports in [**GitHub Issues**](https://github.com/rivet-gg/actor-core/issues)
- Post questions & ideas in [**GitHub Discussions**](https://github.com/rivet-gg/actor-core/discussions)## License
Apache 2.0