Host the Crunu server on Cloudflare Workers and D1
Deploy your own Crunu server to Cloudflare Workers with a D1 database in one script. Code and secrets ship as one version, and cleanup runs on a cron trigger.
- Support
- Works with Crunu today: Cloudflare Workers support is part of the product.
- Crunu features
- Self-hosting and CI/CD
- Checked
- Against Crunu 6.0.0 on October 28, 2026
Crunu features that work with Cloudflare Workers
Each feature below works the same way in every integration: the server keeps ciphertext, and only the people, machines and tokens you grant can decrypt.
Self-hosting
Run the same Crunu server on your own Docker host, Cloudflare Workers, Vercel or Google Cloud Run, and move between them with one archive.
Learn more
CI/CD
Give each pipeline a service token limited to its environments, and bind it to your CI provider with OIDC so a leaked token cannot sign in by itself.
Learn more
How it works with Cloudflare Workers
On this page
What Crunu does on Cloudflare
Crunu runs in the cloud at app.crunu.com, so you don't need to deploy anything to start. If you want your own server without managing a machine, the Crunu server has a build for Cloudflare Workers that stores its data in D1.
The server is blind on Workers as everywhere else: D1 holds ciphertext, public keys, signed documents and metadata, never a key that decrypts a value.
Deploy
You need Node.js 24, wrangler with wrangler login done, and a .env file created by server-init. The commands run from the Crunu server's directory, where the deploy scripts live.
node scripts/server-init.mjs --origin https://vault.company.example
sh deploy/cloudflare/deploy.sh --name vault-company --location weurThe script checks .env with the same code the server uses at startup, builds the Worker, creates the D1 database vault-company-db if it doesn't exist, and deploys the Worker together with its secrets as one version. Code and keys change at the same moment, and if the deploy fails, nothing on the Worker changes. Schema migrations run on the first request.
To build and inspect what would be deployed without deploying it, add --build-only. The script prints the build fingerprint and the names of the secrets it would send, then stops. The build is reproducible, so running the same command without the flag deploys exactly what you inspected.
Attach your own domain to the Worker in the Cloudflare dashboard and use it as the server's PUBLIC_ORIGIN. Cleanup of expired sessions and audit log trimming runs on a cron trigger every 5 minutes.
Choose the right plan
Settings to check after deploying
- Compression on API responses. The Worker answers
/v2/*uncompressed, so response sizes give nothing away. Rundoctoragainst your domain. If it reports compression, add a Compression Rule that disables compression for paths starting with/v2/. - Preview URLs. Every uploaded Worker version can have its own
workers.devaddress that works with the same database and secrets. Crunu's template turns preview URLs off, and the deploy script turns them off for the Worker's older versions too. Don't turn them back on. - Pseudo IPv4. For network restrictions, keep the zone's Pseudo IPv4 setting off or set to Add header. In Overwrite headers mode, IPv6 clients appear under substitute addresses and won't match IPv6 rules.
node scripts/doctor.mjs https://vault.company.exampleCloudflare Tunnel for your own machine
If you'd rather run the server on your own machine, Cloudflare Tunnel publishes it without open ports. That setup is part of the Docker integration.
Cloudflare secrets for your own apps
Crunu has no built-in sync into Cloudflare secrets. If a Worker of yours keeps its values in Cloudflare, a pipeline can push them with Cloudflare's own CLI running under crunu run, using a production token bound to main and the production deployment environment with OIDC. Each run appears in Crunu's audit log. The Vercel page shows the pattern with a concrete command.
Related
Questions and answers
Not covered here? Write to support@crunu.com and a person will answer.
Is the Workers Free plan enough?
For a trial. A team needs Workers Paid: on Free a heavy request can run out of CPU time, and cleanup needs more D1 queries than Free allows.
Can I check what would be deployed first?
Yes. The --build-only flag builds the Worker, prints its fingerprint and the names of the secrets it would send, and stops.
Does Crunu sync values into Cloudflare secrets?
No. A pipeline can push them with Cloudflare's own CLI running under crunu run.