<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hakan</title>
    <description>The latest articles on DEV Community by Hakan (@omegion).</description>
    <link>https://dev.to/omegion</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3541342%2Fa8295911-6580-45ca-b39a-0a50abcbdab9.jpeg</url>
      <title>DEV Community: Hakan</title>
      <link>https://dev.to/omegion</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omegion"/>
    <language>en</language>
    <item>
      <title>How I Finally Fixed Rate Limiting Without Writing a Custom Rate Limiter</title>
      <dc:creator>Hakan</dc:creator>
      <pubDate>Wed, 01 Oct 2025 10:01:56 +0000</pubDate>
      <link>https://dev.to/omegion/how-i-finally-fixed-rate-limiting-without-writing-a-custom-rate-limiter-3aco</link>
      <guid>https://dev.to/omegion/how-i-finally-fixed-rate-limiting-without-writing-a-custom-rate-limiter-3aco</guid>
      <description>&lt;p&gt;If you’ve ever built an API, you’ve probably had this problem: rate limiting sounds simple, but it’s never simple in practice.&lt;/p&gt;

&lt;p&gt;At first, you just want to stop someone from hammering your server. But then you realize you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different limits per user or per plan (not everyone pays the same)&lt;/li&gt;
&lt;li&gt;Fair usage for paying customers&lt;/li&gt;
&lt;li&gt;A way to block bad API keys without breaking everyone else&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’ve been through this more times than I’d like to admit. Each time I hacked together some middleware or a Redis script. It worked… kind of. But it was messy, fragile, and slow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Most Solutions Don’t Cut It
&lt;/h2&gt;

&lt;p&gt;The usual tools give you a blunt instrument: “100 requests per second” for everyone or maybe a simple per-IP throttle.&lt;/p&gt;

&lt;p&gt;That’s not enough if you’re running a SaaS API. You want granular control:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Per user ID → User A gets 10 req/s, User B gets 100.&lt;/li&gt;
&lt;li&gt;Per API key → Different limits for different apps.&lt;/li&gt;
&lt;li&gt;Per plan → Free vs. Pro vs. Enterprise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without that, you’re either over-limiting good customers or under-protecting your infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Ended Up Building
&lt;/h2&gt;

&lt;p&gt;I wanted three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Speed → no big latency hit.&lt;/li&gt;
&lt;li&gt;Flexibility → define limits on any parameter, not just IPs.&lt;/li&gt;
&lt;li&gt;Easy integration → drop it in without rewriting the whole stack.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So I built it on top of Cloudflare Workers + KV + DO. The result: checks run in ~25ms, globally distributed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Outcome
&lt;/h2&gt;

&lt;p&gt;That project became &lt;strong&gt;&lt;a href="https://rately.dev" rel="noopener noreferrer"&gt;Rately&lt;/a&gt;&lt;/strong&gt; — a rate limiting service where you can set rules like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“This user gets 500 calls/day”&lt;/li&gt;
&lt;li&gt;“This API key gets 50 req/min”&lt;/li&gt;
&lt;li&gt;“Enterprise plan has no monthly cap”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s enterprise-grade, but with simple setup. If you’re curious: rately.dev&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;I know I’m not the only one who’s fought with this. How are you handling rate limiting in your project right now? Did you roll your own, or are you using a service?&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
