---
title: "Atomic Static Swaps on Cloudflare Workers"
description: "How this site ships HTML without a half-deployed middle state."
author: "Mohammad-Pouya Ghourchiani"
canonical: "https://ghourchiani.ir/blog/workers-atomic-static-swap"
date: "2026-09-11"
lang: "en"
---
# Atomic Static Swaps on Cloudflare Workers

## Direct answer

Build locally, validate, then upload a full asset set to Workers static assets so visitors never see a mixed old/new tree.

## Practical shape

1. `npm run gate` — typecheck/build/validate
2. `wrangler deploy` — atomic-ish publish of the new asset manifest
3. Purge only when a previously 404'd path was cached

No nginx in this stack. Origin is Workers + Cloudflare DNS.

## Links

- Writing: [/blog/atomic-static-releases](/blog/atomic-static-releases)
- Expertise: [/expertise/infrastructure](/expertise/infrastructure)
