展示 HN:Rivet Actors 的 SQLite – 每个代理、租户或文档一个数据库
Show HN: SQLite for Rivet Actors – one database per agent, tenant, or document

原始链接: https://github.com/rivet-dev/rivet

## Rivet Actors:无服务器状态化工作负载 Rivet Actors 是一种新的无服务器基础组件,专为构建状态化应用程序而设计。每个 actor 作为一个独立的、可扩展的单元,内置状态管理、存储(SQLite/JSON)、WebSockets、工作流和调度功能——无需复杂的后端基础设施。 Actors 提供即时读写速度,具有内存状态和持久化存储,并且可以从零扩展到数百万,高效处理突发工作负载。它们非常适合 AI 代理(具有持久化内存)、协作文档、聊天应用程序,甚至每个租户的数据库等用例。 Rivet 提供灵活的部署方式:使用 Rust 二进制文件或 Docker 自行托管,或利用其完全托管的全球边缘网络,与 Vercel 和 AWS 等现有云提供商集成。它是开源的(Apache 2.0),并支持 Hono、Elysia 和 tRPC 等流行框架,提供 JavaScript、React 和 Next.js 的客户端。

## Rivet Actors 添加 SQLite 存储 Rivet Actors,一个开源的 Cloudflare Durable Objects 替代方案,已推出 SQLite 存储,从而实现了一种独特的数据管理方法。每个“actor”(代表一个代理、租户或文档)都会收到其*自身*的专用 SQLite 数据库。 这允许大规模扩展(数百万个数据库),并具有标准 SQL 的灵活性,避免了像 Cassandra 或 DynamoDB 这样的系统中的模式限制和迁移难题。与 Cloudflare Durable Objects 或 Turso 等闭源替代方案不同,Rivet 是完全开源的,并优先通过其单写者 actor 模型实现本地、新鲜的读取。 SQLite 在每个 actor 的进程内运行,持久性由 FoundationDB 或 Postgres 处理。Rivet Actors 还提供实时通信(WebSockets)、React 集成和自动扩展等功能,使其适用于 AI 代理、多租户 SaaS 和协作文档等应用程序。 [https://github.com/rivet-dev/rivet](https://github.com/rivet-dev/rivet)
相关文章

原文

Rivet Actors are a serverless primitive for stateful workloads. Each actor has built-in state, storage, workflows, scheduling, and WebSockets — everything needed to build the next generation of software.

import { actor } from "rivetkit";

export const chatRoom = actor({
  // In-memory state, persisted automatically
  state: { messages: [] },

  // Type-safe RPC
  actions: {
    sendMessage: (c, user, text) => {
      c.state.messages.push({ user, text });
      c.broadcast("newMessage", { user, text });
    },
  },
});

One Actor per agent, per session, per user — each with everything it needs built in.

Every Rivet Actor comes with:

Feature Description
In-memory state Co-located with compute for instant reads and writes
SQLite or JSON persistence Storage that survives restarts and deploys
Runs indefinitely, sleeps when idle Long-lived when active, hibernates when idle
Scales infinitely, scales to zero Supports bursty workloads, cost-efficient
WebSockets Real-time bidirectional streaming built in
Workflows Multi-step operations with automatic retries
Queues Durable message queues for reliable async processing
Scheduling Timers and cron jobs within your actor

Rivet is one primitive that adapts to agents, workflows, collaboration, and more.

Use Case Description
AI Agent Each agent runs as its own actor with persistent context and memory
Sandbox Orchestration Coordinate sandbox sessions, queue work, and schedule cleanup
Workflows Multi-step operations with automatic retries and durable state
Collaborative Documents Real-time editing where each document is an actor
Per-Tenant Database One actor per tenant with low-latency in-memory reads
Chat One actor per room with in-memory state and realtime delivery

Start Local. Scale to Millions.

Three options, same API. Pick what works for you.

Single Rust binary or Docker container. Works with Postgres, file system, or FoundationDB.

docker run -p 6420:6420 rivetkit/engine

Self-hosting documentation →

Fully managed. Global edge network. Connects to your existing cloud — Vercel, Railway, AWS, wherever you already deploy.

Sign up →

Apache 2.0. Audit the code, contribute features, run it however you want.

View on GitHub →

Frameworks: HonoElysiatRPC

Clients: JavaScriptReactNext.js

Request an integration →

Projects in This Repository

Apache 2.0

联系我们 contact @ memedata.com