Start here
Quick start
Create the Access application, deploy the Worker, and connect valkey-cli or ioredis. About ten minutes on Workers Paid.
1. Create the Access application
Watching the dashboard is public; changing anything needs signing in with Cloudflare Access. In Zero Trust, add a self-hosted application for the Worker's hostname with the path signin, and a policy that allows you. Note two values:
- Its Application Audience (AUD) tag, which becomes
ACCESS_AUD. - Your team domain,
https://<team>.cloudflareaccess.com, which becomesACCESS_TEAM_DOMAIN.
Protect only /signin. The WebSockets (/live, /ws) stay open, and the Worker checks the Access token on every change.
2. Deploy
The button copies the repository into your GitHub account, asks for three settings, builds and deploys. The Worker's URL is the dashboard.
| Setting | What to enter |
|---|---|
VALKEY_PASSWORD | The password clients send with AUTH <database> <password>. It also opens /ws. Generate one with openssl rand -hex 32. |
ACCESS_TEAM_DOMAIN | https://<team>.cloudflareaccess.com |
ACCESS_AUD | The audience tag of the Access application on /signin. |
Or from a checkout:
npm install
npx wrangler secret put VALKEY_PASSWORD
npm run deploy -- --var ACCESS_TEAM_DOMAIN:https://<team>.cloudflareaccess.com --var ACCESS_AUD:<tag>3. Connect valkey-cli
The AUTH username picks the database; a new one is created on first use. There are two ways in from outside Cloudflare.
Over TCP: add a Spectrum application of type Workers (tcp) with this Worker as origin, on port 6379, with TLS on (flexible). Spectrum doesn't pass a hostname, so the database comes from AUTH.
valkey-cli --tls -h valkey.example.com -p 6379 --user mydb --pass "$VALKEY_PASSWORD"Over a WebSocket: the shim turns /ws into a local TCP port for any client.
npx vado-shim wss://<your-worker>.workers.dev/ws 6379
valkey-cli -p 6379 --user mydb --pass "$VALKEY_PASSWORD"4. Connect from a Worker
Bind this Worker as a service. env.VALKEY.connect("mydb:6379") returns a raw RESP socket, and the dialed host names the database. For ioredis, use bindingConnector from @vado/client:
"services": [{ "binding": "VALKEY", "service": "vado" }]import Redis from "ioredis";
import { bindingConnector } from "@vado/client";
const redis = new Redis({
Connector: bindingConnector(env.VALKEY, "mydb"),
password: env.VALKEY_PASSWORD,
});
await redis.set("greeting", "hello");The connection stays inside Cloudflare, and failed AUTHs aren't rate limited. With VALKEY_PASSWORD set, a binding still has to AUTH, and that password opens every database, including ones with their own password (security).
Run it locally
cp .dev.vars.example .dev.vars
npm run dev # http://localhost:5173
npx vado-shim ws://localhost:5173/ws 6379 # in another terminalThe local dev server has no TCP port, so clients go through the shim. Placement and replicas need a real deployment.