Show HN: SQLite for Rivet Actors – one database per agent, tenant, or document

Introduction to Rivet Actors with SQLite Storage

As a developer, I'm always on the lookout for innovative solutions that can simplify my workflow and improve the performance of my applications. Recently, I came across Rivet Actors, an open-source alternative to Cloudflare Durable Objects, which has just released SQLite storage for actors. In this article, I'll dive into the details of this new feature and explore its potential use cases.

What are Rivet Actors?

Rivet Actors is an open-source platform that allows you to build scalable and concurrent applications using a simple actor model. Each actor is an independent unit of computation that can store its own state and communicate with other actors. With the new SQLite storage feature, every actor gets its own SQLite database, which means you can have millions of independent databases, one for each agent, tenant, user, or document.

Use Cases for Rivet Actors with SQLite Storage

The possibilities for using Rivet Actors with SQLite storage are vast. Here are some potential use cases:

  • AI agents: Each agent can have its own database for storing message history, state, and embeddings, making it easier to manage complex AI workflows.
  • Multi-tenant SaaS: With Rivet Actors, you can achieve real per-tenant isolation without relying on Row-Level Security (RLS) hacks, ensuring that each tenant's data is secure and separate.
  • Collaborative documents: Each document can have its own database with built-in multiplayer capabilities, enabling multiple users to collaborate on a document in real-time.
  • Per-user databases: Rivet Actors allows you to create isolated databases for each user, which can scale horizontally and run at the edge, reducing latency and improving performance.

How it Compares to Other Solutions

Rivet Actors with SQLite storage is not the first solution to offer scalability and concurrency. However, it differs from other solutions in several key ways:

  • Cloudflare Durable Objects & Agents: While similar to Rivet Actors, Cloudflare's solution is closed-source and vendor-locked, limiting flexibility and customization.
  • Turso Cloud: Turso Cloud is a great platform, but it's closed-source and has a different use case. Clients query over the network, which can result in slow or stale reads. Rivet's single-writer actor model keeps reads local and fresh.
  • D1, Turso (the DB), Litestream, rqlite, LiteFS: These tools are great for running a single SQLite database with replication, but Rivet is designed for running lots of isolated databases.

Under the Hood

So, how does Rivet Actors with SQLite storage work? Under the hood, SQLite runs in-process with each actor, and a custom VFS persists writes to HA storage (FoundationDB or Postgres). This approach ensures that data is persisted reliably and efficiently.

Additional Features

Rivet Actors also provides several other features that make it an attractive solution for building concurrent applications, including:

  • Realtime (WebSockets): Enables real-time communication between actors and clients.
  • React integration (useActor): Simplifies the process of building React applications with Rivet Actors.
  • Horizontal scalability: Allows you to scale your application horizontally, adding more actors as needed.
  • Actors that sleep when idle: Reduces resource usage and improves performance by putting actors to sleep when they're not actively processing requests.

Who is this for?

Rivet Actors with SQLite storage is ideal for developers who need to build scalable and concurrent applications with a simple actor model. If you're looking for a flexible and customizable solution that can handle millions of independent databases, Rivet Actors is definitely worth considering.

What do you think about Rivet Actors with SQLite storage? Have you worked with similar solutions in the past? Share your thoughts and experiences in the comments below!

🚀 Global, automated cloud infrastructure

Oracle Cloud is hard to get. I recommend Vultr for instant setup.

Get $100 in free server credit on Vultr →