The Ultimate Multi-Tenancy

Persistent State for
Every Customer.

Don't leak data between rows. Give every tenant their own isolated Actor with private in-memory state. Zero latency, instant provisioning, and total data sovereignty.

tenant.ts
1import { actor } from "rivetkit";
2
3export const tenant = actor({
4 // Private state is just a JSON object
5 state: { settings: {}, data: [] },
6
7 actions: {
8 updateSettings: (c, newSettings) => {
9 // Direct in-memory modification
10 // Persisted automatically
11 Object.assign(c.state.settings, newSettings);
12 return c.state.settings;
13 },
14
15 addData: (c, item) => {
16 c.state.data.push(item);
17 return { count: c.state.data.length };
18 }
19 }
20});

The Silo Model

In a traditional SaaS, one bad query from Tenant A can slow down Tenant B. With Rivet, every tenant lives in their own process with their own resources.

Router
Tenant A
12MB • Active
Tenant B
1.4GB • Active
Tenant C
0MB • Sleeping

State Superpowers

The benefits of embedded state with the scale of the cloud.

Zero-Latency Access

The state lives hot in memory on the same node as the compute. No network hop to external cache.

Instant Provisioning

Create a new tenant store in milliseconds. Just spawn an actor; no Terraform required.

Schema Isolation

Every tenant can have a different state shape. Roll out data migrations gradually, tenant by tenant.

Connection Limits

Stop worrying about Postgres connection limits. Each actor has exclusive access to its own isolated state.

Data Sovereignty

Easily export a single tenant's state as a JSON file. Perfect for GDPR takeouts or backups.

Cost Efficiency

Sleeping tenants cost nothing. You only pay for active CPU/RAM when the state is being accessed.

Case Study

B2B CRM Platform

A CRM serving 10,000 companies. Each company has custom fields, unique workflows, and strict data isolation requirements.

  • Noisy Neighbor Protection: Large imports by Company A don't slow down Company B
  • Custom Schemas: Enterprise clients can add custom fields instantly
  • Easy Compliance: 'Delete all data for Company X' is just deleting one actor
Tenant: Acme Corp
DB Size: 450MB
Online
> GET /leads?status=new
< Result: 14,203 objects (Returned in 4ms)

Built for Scale

SaaS Platforms

Give every customer their own isolated environment. Scale to millions of tenants effortlessly.

Local-First Sync

Serve as the authoritative cloud replica for local state on user devices.

User Settings

Store complex user preferences and configurations JSON in a dedicated actor, not a giant shared table.

IoT Digital Twins

One actor per device. Store sensor history and configuration state in a dedicated micro-store.

Works with your stack

Drizzle
Kysely
Zod
Prisma (JSON)
TypeORM

Isolate your data.

Start building multi-tenant applications with the security and performance of single-tenant architecture.