DevTrendsDeveloper trends
Accent color

Product

A Background- remover finished by Ai

I Built a Free AI Background Remover Using Cloudflare Workers + D1 I spent my weekend building an AI background remover website, with both frontend and backend deployed on Cloudflare, costing almost nothing. Here's my deโ€ฆ

DTData & operationsDTWeb appDTWeb

About

I Built a Free AI Background Remover Using Cloudflare Workers + D1 I spent my weekend building an AI background remover website, with both frontend and backend deployed on Cloudflare, costing almost nothing. Here's my development journey and some lessons learned. ๐ŸŒŸ Project URL ๐Ÿ”ง Tech Stack Frontend: Static HTML + JavaScript (Cloudflare Pages) Backend: Cloudflare Workers Database: Cloudflare D1 AI Background Removal: Remove.bg API Payment: PayPal ๐Ÿš€ Features 1. Free to Use: 3 free uses per day, no login required 2. Google Login: Cross-device sync after login 3. Credit Packs: Purchase credits via PayPal 4. Membership: Monthly/Yearly unlimited plans ๐Ÿ’ก Key Highlights 1. Benefits of D1 Database Previously I used localStorage, so users would lose their data when switching devices. After switching to D1, once a user logs in, their credits and membership sync across all devices. sql User table structure CREATE TABLE users ( id INTEGER PRIMARY KEY, googleid TEXT UNIQUE, email TEXT, credits INTEGER DEFAULT 0, membership TEXT, membershipexpire TEXT, totalused INTEGER DEFAULT 0 ); 2. Interesting Uses of Workers Workers aren't just for APIs - they can also serve HTML pages directly. One Worker handles all routes: javascript // Home page if (path === '/') { return new Response(HOMEPAGE, { headers: { 'Content-Type': 'text/html' } }) } // Pricing page if (path === '/pro') { return new Response(PROPAGE, {...}) } // API endpoint if (path === '/purchase' && method === 'POST') { return handlePurchase(request, env) } 3. PayPal Integration Lessons Sandbox and production have different API addresses, and sandbox testing sometimes has weird CORS issues. The final solution was to provide a manual payment confirmation as a fallback, in case the automatic flow fails after user pays. ๐Ÿ“Š Cost Estimate | Service | Free Tier | Overage | |---------|-----------|---------| | Workers | 100,000 req/day | $0.50/million | | D1 | 5GB storage | $1/GB/month | | Pages | 500MB | Free | | Remove.bg | - | $0.07/image | Currently with a few hundred visits per day, everything is within the free tier. ๐Ÿ”œ Future Plans [ ] Add more AI features (background replacement, resize) [ ] Batch processing support [ ] Open API for developers ๐Ÿค” Reflection This project made me rethink Cloudflare's product capabilities. The Workers + D1 + Pages combo is amazing for small to medium web applications - easy deployment, global CDN, and extremely low cost. If you have similar ideas, try this stack! Feel free to ask questions in the comments! Feel free to try and leave your feedback in the comments!

Discovery history

  1. ้˜ฎไธ€ๅณฐๅ‘จๅˆŠยท็”จๆˆทๆŠ•็จฟ

    Mar 28, 2026 ยท 1 observations

Discuss this product