Skip to main content
Databases

SQLite

Every Rivet Actor has its own embedded SQLite database.

SQLite is built into Rivet Actors: every Actor owns a database that lives and moves with it, so there is nothing to provision or connect. Declare db on the Actor, create your tables in onMigrate, and run SQL from any action with c.db.execute(...).

Each Actor’s database is isolated from every other Actor’s, and its rows persist across sleep, crashes, and upgrades like the rest of the Actor’s state. Keep one Actor per thing you would otherwise give its own table, such as a user, a document, or an agent conversation, so each database stays small and close to the code that uses it.

Use Drizzle when you want a typed query builder over the same database. For a hosted SQLite-compatible database you reach over the network, see Turso.

The SQLite feature page covers queries, transactions, migrations, and limits.