- Category: D. Site Factory System Design
- English term: Workers Builds vs. Direct Upload
- Related: Static Site Delivery (SSG) · Free Tier as an Architectural Constraint · Dual Write · Self-hosted Runner · Architectural Fitness Function
General Meaning
In modern edge serverless platforms like Cloudflare Workers, deploying websites and APIs generally follows one of two primary architectural approaches. The first is automated cloud builds, commonly known as Workers Builds. In this pipeline, the hosting platform monitors a designated repository branch, automatically triggers a cloud-based build runner upon new commits, and deploys the resulting static assets or compiled worker scripts directly across edge nodes. This approach minimizes developer setup and provides a hands-off deployment lifecycle.
The second pipeline is direct deployment, or Direct Upload. In this architecture, developers or private CI runners execute the build pipeline and run rigorous static checks in their local environment. The resulting pre-built artifacts are then pushed directly to the cloud edge using deployment CLIs such as Wrangler (npx wrangler deploy). While direct upload requires local build tooling and secure credentials, it completely bypasses cloud runner execution limits and grants full control over the exact bits being published.
Why It Matters
- Preventing cloud build quota exhaustion: Free hosting tiers impose monthly build minute caps such as 3,000 minutes; frequent automated commits can rapidly exhaust this quota, whereas direct upload consumes zero cloud build minutes.
- Enforcing rigorous local pre-publication verification: Running automated tests, link checks, and compliance filters on the build runner ensures that broken pages or policy violations are intercepted before files ever reach the public edge.
- Recording indisputable deployment evidence: Verifying site content hashes and capturing the originating Git commit hash into a database prior to deployment guarantees an audit trail for every production release.
How the Site Factory Uses It
The Site Factory implements a pragmatic hybrid strategy where new or low-churn sites initially utilize Workers Builds, while high-frequency and critical infrastructure sites transition to Direct Upload managed by the local unkou service (unkou), as established in decisions.md on 2026-10-19. For sites remaining on Workers Builds, automated triggers are restricted to specific paths like dashboard/** to block wasteful rebuilds caused by unrelated repository updates.
For Direct Upload targets registered in dispatch/direct-upload-targets.json, the local operator runs trusted_upload.py on Mac mini to build artifacts, verify deterministic integrity, and deploy directly via Wrangler. Every release records a dual-write audit trail capturing the SHA-256 site hash and deployment identifier into both Cloudflare D1 and local trusted-upload-evidence.json, maintaining resilient edge operations while preserving free-tier quotas.
Caveats & Operational Rules
- Automated commit cascades exhausting build limits: Pushing frequent operational logs or state ledgers to GitHub can repeatedly fire Workers Builds; teams must restrict watched path patterns or immediately transition to direct uploads.
- Deployment race conditions across dual pipelines: Concurrently enabling both Workers Builds and Direct Upload on the same repository creates conflicting releases; automatic build hooks must be deactivated once direct uploading is activated.
Related Terms
- Static Site Delivery (SSG)
- Free Tier as an Architectural Constraint
- Dual Write
- Self-hosted Runner
- Architectural Fitness Function
References
- Book: Mark Richards & Neal Ford, *Fundamentals of Software Architecture*, Chapter 16 (Serverless Architecture)
Verified: 2026-11-08