Payload on Workers: a full-fledged CMS, running entirely on Cloudflare’s stack

This post details the technical implementation of deploying Payload CMS, a Node.js/Express.js and Next.js application, entirely on Cloudflare's Developer Platform. It covers the creation of custom adapters for Cloudflare D1 (SQLite-based managed database) and R2 (object storage) to integrate with Payload's existing database and storage mechanisms. Key technical contributions include: a custom D1 adapter that maps D1 results to the format expected by libSQL/Drizzle ORM, enabling database migrations via Wrangler remote bindings; a custom R2 storage adapter that leverages the R2 binding for uploads and downloads, addressing Miniflare compatibility issues; and the use of Hyperdrive to front an external Postgres database for connection pooling and query caching. It also discusses performance optimizations for D1 using read replicas with the 'first-primary' session type and the serverless benefits of running a CMS on Cloudflare Workers.
More from the Content Management System (CMS) Evolution trail
- EmDash 1.0: the stable CMS with a secure plugin registry
- The Cloudflare Blog – Brought to you by EmDash
- Redirects for AI Training enforces canonical content
- Introducing EmDash — the spiritual successor to WordPress that solves plugin security
- Open source all the way down: Upgrading our developer documentation