Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

How I Built an Automated Serverless Print-on-Demand Studio on Cloudflare Workers, R2 & KV

Building a fast, zero-bloat custom apparel and developer mug storefront usually requires paying $39+/month for heavy e-commerce SaaS themes. Instead, I built a serverless Cloudflare Workers + R2 + KV Print-on-Demand Stud

How I Built an Automated Serverless Print-on-Demand Studio on Cloudflare Workers, R2 & KV

Building a fast, zero-bloat custom apparel and developer mug storefront usually requires paying $39+/month for heavy e-commerce SaaS themes. Instead, I built a serverless Cloudflare Workers + R2 + KV Print-on-Demand Studio paired with a Python numpy cylindrical porcelain-glaze mockup compositor.

👉 Live Storefront: https://wittycraft-studio.tranhoangtu-it.workers.dev

Explain It To The Duck — Developer Debugging Tee & Porcelain Mug

How the Mockup & Edge Pipeline Works

  1. Floodfill Alpha Extraction + Multiply Fabric & Glaze Blending: Instead of slapping rectangular stickers onto flat vector polygons, our Python pipeline strips solid #FFFFFF backgrounds via border BFS floodfill, applies a subtle cosine cylindrical warp (numpy) matching the curvature of an 11oz ceramic mug, and blends ink using ImageChops.multiply so real studio cotton folds and porcelain reflections shine directly through the print.
  2. Cloudflare R2 + Workers KV Persistence: Every 30-minute batch pushes crisp .jpg studio mockups directly into an R2 bucket (MEDIA_BUCKET) with immutable Cache-Control edge headers and updates the product index in Workers KV (CATALOG_KV), complete with dynamic /sitemap.xml and Schema.org/Product JSON-LD routes (/item/WC-028, /item/WC-025, /item/WC-026).

Unbothered & Caffeinated Capybara Hot Spring Espresso

Per My Last Email Goose Iced Coffee

Developer & Tech Desk Favorites on the Shelf

Feel free to browse the full 32-piece studio catalog at WittyCraft Apparel & Mug Co. — happy to answer questions about the R2 + KV edge architecture or numpy cylindrical warping in the comments!

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.