DEV Community

miccho27
miccho27

Posted on

From 25 to 43 APIs: Scaling Cloudflare Workers for Fun and Profit

Six months ago, I had 25 APIs running on Cloudflare Workers. Today, I have 43. All on the free tier. Zero hosting costs.

Here's what I learned scaling from 25 to 43 APIs, what worked, and what I'd do differently.

Why Cloudflare Workers?

  • Free tier: 100,000 requests/day per account
  • Global edge: Low latency everywhere (I'm based in Paraguay, my users are worldwide)
  • Zero cold starts: Unlike AWS Lambda, Workers are always warm
  • Simple deployment: wrangler deploy and done

The APIs I Built

Here's a sample of what's running:

API What It Does Use Case
QR Code Generator Text/URL → QR image Mobile apps, marketing
Email Validator Syntax + MX check Lead gen, forms
SEO Analyzer Full technical audit Bloggers, agencies
Text Analytics Sentiment + keywords Content tools
Currency Converter Real-time rates Fintech, e-commerce
Readability Score 6 readability metrics Writers, education
Password Generator Configurable secure passwords Security tools
URL Shortener Shorten + track clicks Marketing
Markdown to HTML CommonMark conversion CMS, editors
JSON Formatter Validate + prettify Developer tools

All 43 are listed on RapidAPI.

Architecture Patterns That Scale

1. Shared Utility Layer

I extracted common patterns into reusable modules:

// Shared CORS handler
function corsHeaders(origin) {
  return {
    'Access-Control-Allow-Origin': origin || '*',
    'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
    'Access-Control-Allow-Headers': 'Content-Type, X-RapidAPI-Key',
  };
}

// Shared error response
function errorResponse(message, status = 400) {
  return new Response(
    JSON.stringify({ success: false, error: message }),
    { status, headers: { 'Content-Type': 'application/json' } }
  );
}
Enter fullscreen mode Exit fullscreen mode

2. Input Validation Pattern

Every API validates input the same way:

function validateRequired(params, required) {
  const missing = required.filter(key => !params[key]);
  if (missing.length > 0) {
    return errorResponse(`Missing required fields: ${missing.join(', ')}`);
  }
  return null;
}
Enter fullscreen mode Exit fullscreen mode

3. Rate Limiting with KV

For APIs that need rate limiting beyond RapidAPI's built-in limits:

async function checkRateLimit(env, key, maxRequests = 100, windowSeconds = 3600) {
  const current = parseInt(await env.RATE_LIMIT.get(key) || '0');
  if (current >= maxRequests) {
    return errorResponse('Rate limit exceeded', 429);
  }
  await env.RATE_LIMIT.put(key, String(current + 1), {
    expirationTtl: windowSeconds,
  });
  return null;
}
Enter fullscreen mode Exit fullscreen mode

Lessons Learned

What Worked

  1. Template-driven development: I created a Worker template with CORS, error handling, and input validation baked in. New APIs take 30 minutes to build.
  2. RapidAPI as distribution: I don't need to build a marketing site. RapidAPI handles discovery, billing, and documentation.
  3. Free tier is generous: 100K requests/day is more than enough for a side project portfolio.

What I'd Do Differently

  1. Better monitoring: I should have set up Cloudflare Analytics dashboards from day one.
  2. Automated testing: Some APIs broke silently after Wrangler updates. CI/CD with tests would have caught this.
  3. Bundle related APIs: Instead of 43 separate APIs, I could have grouped them into 10-15 "suites" for a better user experience.

The Numbers

  • Total APIs: 43
  • Hosting cost: $0/month
  • Time to build each: 30-60 minutes (with template)
  • Total development time: ~40 hours over 6 months

What's Next

I'm working on:

  • API suites: Bundling related APIs (all text tools together, all SEO tools together)
  • Premium tiers: Adding advanced features behind paid plans
  • Documentation: Auto-generating OpenAPI specs

Try Them Out

All 43 APIs are available on RapidAPI with free tiers:

👉 Browse all APIs

If you're thinking about building your own API side project, Cloudflare Workers + RapidAPI is a solid zero-cost stack to start with.


I'm a developer based in Paraguay, building digital products and APIs as a solo entrepreneur. Follow me for more posts about serverless architecture and indie hacking.

Top comments (0)