Changelog · 2026-07-05
R2 file tree storage lands
Every deploy's file tree is now stored in Cloudflare R2. This unlocks patch deploys, rollback, and the future of in-browser file editing.
Released: 2026-07-05
Every deploy's file tree is now stored in Cloudflare R2. This unlocks patch deploys, rollback, and the future of in-browser file editing.
Added
- R2BucketAdapter — bridges CF's R2Bucket to our internal R2Like interface
- saveTree(deployId, files) — stores a file tree (Map<path, Uint8Array>) to R2
- getTree(deployId) — reads back the file tree as a list of
{path, size, sha256}entries - getFile(deployId, path) — fetches a single file's bytes
- Retention sweep endpoint —
POST /api/v1/cron/retentiondeletes R2 trees older than the configured TTL (default 90 days)
Why
Patch deploys need to read the current file tree before generating a diff. Rollback needs to ship an old tree as a new deploy. Both of those require the file tree to be stored somewhere queryable.
R2 was the right choice because:
- Cheap ($0.015/GB/month)
- Globally distributed reads (CDN-fast)
- Pairs naturally with Cloudflare Pages (where the deploys actually serve)
- Already integrated with our other Cloudflare services
Changed
- Deploy record schema — adds optional
files_keyfield referencing the R2 tree - Worker init — constructs
R2BucketAdapterfromc.env.KREXEL_R2and passes tocreateApp
Fixed
- /api/v1/deploys/:id/files — was returning 404 files_not_available for all deploys. Now returns the actual file tree.
Migration
No user-facing migration. Existing deploys (pre-R2-storage) return files_not_available because their trees weren't stored. New deploys store automatically.
What this unlocks
- Patch deploys — your AI reads the current tree, generates a patch, ships it (8 seconds)
- Rollback — re-ship any past deploy's tree as a new deploy
- Future: in-browser editing —
/dashboard/deploys/:idwill let you click any file and edit it
Performance
- R2 reads: typically <50ms globally (CF network)
- Tree size: ~150 bytes metadata per file + actual file bytes
- For a typical 50-file site: ~7KB metadata + files
Cost
At 100 customers × 50 deploys/month × 7KB metadata = ~35MB R2 metadata storage = ~$0.001/month.
File content storage scales with actual deploy size. Average ~500KB per deploy, so 2.5GB of file content for that workload = ~$0.04/month.
R2 is cheap. Don't worry about it.