Jazz
Run your app's Jazz core in a Rivet Actor and store app data in the Actor's SQLite database.
Jazz is a relational database that runs inside your backend, with real-time queries and built-in permissions. Its Rivet adapter runs your app’s Jazz core in a Rivet Actor. The Actor stores app data in its embedded SQLite database. Your Node.js backend authenticates users, serves clients at /jazz, and connects to the core through the rivet() store.
The Rivet adapter is experimental. Jazz can change it in any release. See Jazz’s Rivet guide for adapter options.
Quickstart
Install
Install the Jazz packages and the local Rivet control plane in your TypeScript app:
npm install jazz-tools ws
npm install --save-dev @rivetkit/engine-cli
The Jazz core is the jazz-rivet Rust binary. Install the version that matches your jazz-tools package. You need Rust 1.100 or newer and a C/C++ toolchain to build it:
version=$(node -p 'require("./node_modules/jazz-tools/package.json").version')
cargo install --locked "jazz-rivet@$version"
Start the Jazz core
Choose a shared secret of at least 32 characters for the core and your backend. Run jazz-rivet to start a local Rivet control plane at http://127.0.0.1:6420 and register the jazz Actor:
export JAZZ_CORE_SECRET='<your-shared-secret>'
export RIVET_ENGINE_BINARY_PATH="$(node -p 'require("@rivetkit/engine-cli").getEnginePath()')"
jazz-rivet
Connect your backend
Pass the rivet() store to createJazz. Set key to identify your app. Each key gets its own jazz Actor and database.
import { createServer } from "node:http";
import { createJazz, rivet } from "jazz-tools/backend";
import { app } from "./jazz.generated.js";
import permissions from "./jazz.permissions.json" with { type: "json" };
const jazz = createJazz({
app,
permissions,
store: rivet({
endpoint: process.env.JAZZ_RIVET_ENDPOINT!,
namespace: process.env.RIVET_NAMESPACE ?? "default",
token: process.env.RIVET_TOKEN!,
pool: "default",
key: "my-app",
blobs: "sqlite",
secret: process.env.JAZZ_CORE_SECRET!,
}),
authenticate, // Your app's session check.
});
const server = createServer(jazz.nodeHandler);
await jazz.attach(server);
server.listen(Number(process.env.PORT ?? 3000));
Run it
Start your backend in a second terminal with the same secret:
export JAZZ_RIVET_ENDPOINT=http://127.0.0.1:6420
export RIVET_TOKEN=default
export JAZZ_CORE_SECRET='<your-shared-secret>'
npx tsx server.ts
Clients connect to http://localhost:3000/jazz.
How it runs
| Event | What happens |
|---|---|
| First request for a key | The backend gets or creates the jazz Actor for that key. |
| Clients connected | Each open WebSocket keeps the Actor awake. |
| No clients | The Actor sleeps. The next request wakes it with its data. |
| Deploy or restart | Sessions reconnect automatically. Writes made during the disconnect stay queued on the client and sync when the Actor returns. |
| Actor destroyed | Destroying the Actor deletes the app’s data. The same key then opens an empty app. |
Keep the key stable across releases. A new key opens a new, empty database.
Large values
The required blobs option sets where the core stores large values:
blobs | Storage location |
|---|---|
"sqlite" | The Actor’s SQLite database, alongside the rows |
s3({ bucket, region }) | An S3-compatible bucket |
vercelBlob({ storeId }) | A private Vercel Blob store |
Set S3 and Vercel Blob credentials in the jazz-rivet environment, not in your backend. You can move an app from "sqlite" to a bucket later, which also moves existing values. After you move to a bucket, you cannot move back to "sqlite".
Deploy to Rivet Cloud
Package jazz-rivet and your backend in one image and run both from one entry point. Jazz’s guide provides the Dockerfile and start script. Set the shared secret and deploy:
npx @rivetkit/cli login
npx @rivetkit/cli link --org my-org --cluster my-cluster
npx @rivetkit/cli cluster secret set JAZZ_CORE_SECRET
npx @rivetkit/cli deploy --pool default --secret JAZZ_CORE_SECRET \
--env "JAZZ_RIVET_ENDPOINT=https://<cluster-slug>-api.onrivet.dev"
Rivet Cloud sets RIVET_TOKEN and PORT. It serves your backend at the URL that deploy prints. See Rivet Cloud for clusters and pools.