Self-host
Run your own case
Valise runs on one Cloudflare account: a Worker with D1, R2, KV, a Durable Object and a Workflow. A fork, a setup script and Workers Builds take it from an empty account to a deployed instance.
What it needs
- Node 22 or later.
- A Cloudflare account with R2 enabled. Cloudflare may ask for billing details to enable R2.
- A registered
workers.devsubdomain on that account. - The Workers Paid plan for the daily backup, which runs as a Workflow. On the free plan the backup fails and the workbench says so.
Workers, D1, KV and R2 have their own plan limits and charges, billed by Cloudflare to your account. Lexical search avoids inference charges, not hosting costs.
The steps
-
Fork and prepare. In your fork:
The script asks for your account ID, an app name and a search backend, shows what it will create and waits for you to typenpm ci npx wrangler login scripts/first-deploy.shsetup. It creates four resources for this installation: a D1 database, an R2 bucket for bundles and files, a KV namespace for OAuth state, and an R2 bucket for backups whose snapshots are retained for 30 days by Bucket Lock. It writeswrangler.self-host.jsonc. If it stops partway, rerun it; it finds what it already created by name. -
Choose search. Lexical is the default and needs nothing else.
If a reranking provider fails, search returns the lexical results.
VALISE_RERANKNeeds Where query and candidate text go lexicalNothing D1 only; no inference request clefWorkers AI binding Cloudflare Workers AI, at most 50 lexical candidates jevTYPESAFE_API_KEYTypeSafe's API, at most 50 lexical candidates - Set secrets. Create the Worker in the dashboard and add
VALISE_ADMIN_PASSWORD,SESSION_SECRETandTOKEN_PEPPERunder Settings. The administrator password works without Google or an email provider; owner-only use needs neither. -
Initialize the new database.
npx wrangler d1 migrations apply DB --remote --config wrangler.self-host.jsonc -
Deploy from
main. Connect the Worker to your fork in Workers Builds. The build runs the checks and builds; the deploy script applies pending migrations, then deploys. Migrations that only add things apply on deploy; one that drops or rewrites stops the build until a person runs it.Build: npm run verify:ci && VALISE_CONFIG=wrangler.self-host.jsonc npm run build Deploy: VALISE_CONFIG=wrangler.self-host.jsonc VALISE_ORIGIN=https://<app>.<subdomain>.workers.dev ./scripts/deploy.sh -
Check it.
Then sign in atscripts/smoke.sh https://<app>.<subdomain>.workers.dev/login, connect a client to your/mcpURL, save a test memory and fetch it from another client.
Background jobs
Setup asks whether to run background jobs every minute, on by default. They process Library files and fetch bookmarks on Workers AI, billed to your account, with bookmark fetching capped per owner per day by VALISE_SOURCE_DAILY_USD. With them off, capture, search, skills, memories and to-dos still work.
Backups
A daily Workflow inside the Worker writes the authoritative D1 rows and R2 originals to the locked backups bucket. scripts/backup.mjs captures and restores the same set from outside Cloudflare:
node scripts/backup.mjs capture /secure/valise-backups --config wrangler.self-host.jsonc --remote --keep 14
node scripts/backup.mjs status /secure/valise-backups --max-age-hours 26
The Library also has its own export, with original bytes, source revisions and relationships.
Documentation
- Self-hosting
- The full procedure: resources, secrets, Google sign-in, email, limits and the deploy.
- Backup and recovery
- Scheduled backups, restore, the search rebuild and the local restore drill.
- Library export
- Per-account export and import with originals.
- ADR-0008
- Which migrations a deploy applies on its own.
- README
- Local development, Google sign-in and connecting clients.