Skip to content
Rowsafe

A Valkey (Redis) cache for your Next.js app

Valkey is the open-source Redis: a fast cache and session store for your Next.js app, with the Redis client you know.

Ask your agent

Claude Code, Cursor or Codex
Create a Valkey server for caching in this Next.js app on Rowsafe Cloud.

Your agent picks a size, tells you the price and waits for your yes, then creates the server as you. Once it's ready (5 to 10 minutes), click Create a login for your app on its page in the dashboard: you see the connection details once, for your .env.

First time? Connect Rowsafe to your agent once.

Or from the terminal

Terminal
rowsafe cloud create app-cache --engine valkey --wait
rowsafe db user add web --on app-cache

rowsafe cloud create shows the price and asks first. rowsafe db user add makes a login for your app and prints its rediss:// connection string once: put it in .env as REDIS_URL. (rowsafe env is for PostgreSQL only, for now.)

Connect your app

lib/cache.ts
import { createClient } from "redis";

// REDIS_URL starts with rediss://: encrypted, and the server's certificate is checked.
const client = createClient({ url: process.env.REDIS_URL });
client.on("error", (err) => console.error("Valkey:", err));
const ready = client.connect();

export async function cached<T>(key: string, seconds: number, load: () => Promise<T>): Promise<T> {
  await ready;
  const hit = await client.get(key);
  if (hit) return JSON.parse(hit) as T;
  const value = await load();
  await client.set(key, JSON.stringify(value), { expiration: { type: "EX", value: seconds } });
  return value;
}

npm install redis. ioredis works too: give it the same rediss:// URL. Valkey takes connections with TLS on port 6380 only.

Backups and restores

Rowsafe backs up every change, encrypted on the server with a key only you have, so you can restore to any second. Every week it restores a backup to prove it works. Restore a copy, bring back deleted keys or rewind the whole database, in one click. Before a risky change, save a Mark (rowsafe mark), or let your agent save one.

From $0.014 an hour, never more than $10 a month.

Questions

Why Valkey and not Redis?

Redis's license doesn't allow hosting it as a service. Valkey is the Linux Foundation's open-source fork, and Redis clients work with it.

Does it work on Vercel?

Yes. Vercel has no fixed addresses, so allow everyone: rowsafe cloud allow app-cache 0.0.0.0/0. Anyone can then try to connect, but they still need the password, and every connection is encrypted.

How does my app's server connect?

At first only your computer can. Add your server's address under Who can connect on the server's page, or run rowsafe cloud allow app-cache ADDRESS.

Your Valkey database, ready in minutes.

Compare prices