A JAMstack storefront that runs on Cloudflare Workers
Serverless platforms promise to free developers from the operational burden of scaling infrastructure, and Cloudflare Workers has spent years proving that thesis under the heaviest load the internet produces: Black Friday. The approach has seen production use from platforms like Cordial, which offloaded API latency onto Workers to survive the holiday shopping rush. But scale alone isn't what makes a platform worth building on — developer experience matters too. With tooling like Wrangler and Workers KV, Workers is a reasonable environment for hacking together a full application in a few weeks.
The result is an open-source e-commerce template for selling software, educational products, and bundles, built entirely on Workers and modeled loosely on Humble Bundle. The stack pairs Workers Sites for hosting, Nuxt.js for the frontend, Sanity.io as a headless CMS, and Stripe for payments. A live demo is deployed at ecommerce-example.signalnerve.workers.dev.
One codebase, three jobs
The project leans into Workers as more than a static host. The same deployment acts as a static site hosting platform via Workers Sites, an API server for checkout sessions, and a webhook consumer — all in a single codebase that gets deployed across Cloudflare's network. That convergence is what makes Workers a viable JAMstack platform: you don't need a separate serverless function provider just to handle the dynamic parts of a site.
The frontend is a Nuxt.js static site. Product and bundle data lives in Sanity.io, a headless CMS, and is retrieved client-side from Sanity's CDN using its standard JavaScript client. Managing the content happens inside the Sanity studio interface, while the storefront fetches it and renders a list of products per bundle with a Stripe checkout button.


Checkout without a Node SDK
Stripe's Node SDK doesn't yet run inside Workers (a fix is being discussed in this open issue), but the Stripe API is plain REST underneath. The template makes direct HTTP requests to create checkout sessions when a customer clicks buy on a bundle. That request flows to a route in the Worker, which securely creates a new Stripe session and returns it to the browser.
import { json, stripe } from '../helpers'
export default async (request) => {
const body = await request.json()
const { price_id } = body
const session = await stripe('/checkout/sessions', {
payment_method_types: ['card'],
line_items: [{
price: price_id,
quantity: 1,
}],
mode: 'payment'
}, 'POST')
return json({ session_id: session.id })
}
Webhooks that do real work
Once Stripe successfully charges the customer, it fires a webhook back to the Worker. That single webhook handler is responsible for completing the transaction end-to-end:
- Validating the payload — every incoming webhook is verified against the Stripe account before any action is taken, so forged requests are rejected outright.
- Distributing revenue with Stripe Connect — when a $20 bundle sells, the worker divides the proceeds among the bundle's authors after Stripe fees, issuing the payout transfer requests itself.
- Delivering the goods — a unique token tied to the customer's email is stored in Workers KV, and a download email is composed and sent via Mailgun over REST APIs.
That sequence touches four distinct external APIs — Stripe for payments and Connect, Sanity for serving the storefront data, and Mailgun for transactional email — with record persistence in Workers KV. The entire API is type-checked and validated before it ships, thanks to the TypeScript Worker template.

This pattern is portable beyond e-commerce. The Workers application decomposes a complex workflow into small, composable functions, executing them on-demand at the edge without any dedicated server between the storefront and the payment provider.
Buying it for yourself
The source is on GitHub, and the Workers KV free tier makes it possible to run the whole stack without paying for infrastructure. Fork the repository, plug in your own Sanity.io dataset and Stripe account, and it becomes a starting point for selling your own software, courses, or content bundles.



