DEV Community

周唯
周唯

Posted on

I Built 3 Developer APIs with $0 Hosting — Here's How

I Built 3 Developer APIs with $0 Hosting — Here's How
I wanted to see if I could build and monetize useful developer APIs with literally zero hosting costs. Here's what I built and how it works.

The APIs
SEO Analyzer — Analyze any webpage's SEO in real-time. Title, meta, headings, images, OG tags, word count, scored 0-100.
QR Code Generator — Customizable QR codes with colors, sizes, margins. Returns PNG.
Email Validator — Syntax check, MX records, disposable domain detection (150+), role account detection.
All three live at a single endpoint: https://api-market.wei04459.workers.dev

The Stack ($0/month)
Cloudflare Workers — Serverless compute, 100k requests/day free
Cloudflare KV — Key-value storage for API keys and usage tracking
No database, no VPS, no Docker — Just JavaScript edge functions
The entire thing is a single Worker file. No frameworks, no build steps.

How I Built It

  1. Unified Gateway Pattern Instead of three separate deployments, I built one Worker that routes by path:

/ → Landing page
/api/seo → SEO analyzer
/api/qr → QR generator

/api/email → Email validator
/keys → Key management

  1. Free Tier with Rate Limiting Free users get 100 requests/month. Usage is tracked in KV with monthly keys:

const monthKey = 2026-05;
const usageKey = usage:${apiKey}:${monthKey};
let usage = await env.API_KEYS.get(usageKey, { type: 'json' });
if (usage.count >= 100) {
return error('Limit reached. Upgrade to Pro.');
}

  1. SEO Analyzer — The Hardest One Parsing arbitrary HTML for SEO elements at the edge is tricky. Key decisions:

Use regex, not DOM parser (Workers don't have DOMParser)
Strip scripts/styles before word counting
Handle both and formats
Score 0-100 with clear breakdown (title 15pts, meta 15pts, viewport 10pts, etc.)

  1. Email Validator — Actually Useful Most email validators just check regex. This one goes further:

MX record lookup via Cloudflare DNS-over-HTTPS
150+ disposable domain blacklist
Common typo detection (gmial.com → gmail.com)
Role account detection (admin@, info@, etc.)

  1. QR Generator — Simple but Critical Uses Google Charts API as a backend. The Worker just proxies and caches:

const qrUrl = https://chart.googleapis.com/chart?cht=qr&chl=${data}&chs=${size};
const resp = await fetch(qrUrl);
return new Response(resp.body, {
headers: { 'Content-Type': 'image/png', 'Cache-Control': 'public, max-age=86400' }
});

The Business Model
Free: 100 requests/month — enough to evaluate
Pro: $5/month — unlimited requests, commercial use
Simple math: 20 Pro subscribers = $100/month.

Lessons Learned
Cloudflare Workers are faster than you think — Cold start is literally 1ms.
KV is fine for API keys — Not Redis speed, but good enough and free.
Google Charts API still works — For QR codes, it's simpler than bundling a QR library.
Regex HTML parsing is fragile but sufficient — For an SEO checker that gives directional scores, not pixel-perfect audits.
Free tier = marketing — Every free user is a potential Pro upgrade.
Try It
curl -X POST https://api-market.wei04459.workers.dev/keys

Get your free key and start building.

Source code on GitHub | API Docs

Top comments (0)