<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ye's Blog]]></title><description><![CDATA[Hi there! I'm a full-stack web developer and I love building things that people use.]]></description><link>https://blog.yelwinsoe.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 02:36:45 GMT</lastBuildDate><atom:link href="https://blog.yelwinsoe.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to protect your API?]]></title><description><![CDATA[Have you deployed your Websites or Mobile Apps and got hit in the face with thousands of dollar worth of bills from your SMS provider after a few months? I have. Today I’m going to share how to protect your API especially that might cost you a lot of...]]></description><link>https://blog.yelwinsoe.dev/how-to-protect-your-api</link><guid isPermaLink="true">https://blog.yelwinsoe.dev/how-to-protect-your-api</guid><category><![CDATA[APIs]]></category><category><![CDATA[backend]]></category><dc:creator><![CDATA[Ye Lwin Soe]]></dc:creator><pubDate>Wed, 26 Jul 2023 05:38:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690349721766/9d0e6754-87cb-4a23-add6-501c16337bb1.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Have you deployed your Websites or Mobile Apps and got hit in the face with thousands of dollar worth of bills from your SMS provider after a few months? I have. Today I’m going to share how to protect your API especially that might cost you a lot of money such as SMS OTP, Email sending API, File Upload API, etc. I’m going to talk only about “Rate Limiting” in this article while there are so many things you can do to protect your API such as preventing SQL injection, using a queue system to delay processing, etc.</p>
<p>Here are the steps you can take to prevent your API from attacks using rate limiting, especially from DDOS.</p>
<h1 id="heading-rate-limiting"><strong>Rate Limiting</strong></h1>
<p>Rate limiting can improve your API performance as well as save you money. Here’re 4 ways you can rate limit sort by the strictness of it.</p>
<h2 id="heading-1-request-per-secondminutehour"><strong>1. Request per second/minute/hour</strong></h2>
<p>This is the easiest and the most basic way of implementing rate limits but also the easiest to bypass. Depending on your application, you can think of a rate to limit. Very useful for API that has read/write heavy to your Database. You can use CDN such as Cloudflare to easily add such rate limiting.</p>
<h2 id="heading-2-rate-limit-by-ip"><strong>2. Rate limit by IP</strong></h2>
<p>This is a stricter version of rate limiting, the limit is based on the IP of the user. For example, only allow 30 requests per minute from a single IP. This is very similar to Number 1 but stricter. This is harder for attackers to bypass but is still possible by using a proxy server. You can implement this using pretty much all the CDN.</p>
<h2 id="heading-3-adding-captcha"><strong>3. Adding CAPTCHA</strong></h2>
<p>Adding a CAPTCHA is especially useful when your API call cost money, such as OTP, Email notification. The most common CAPTCHA is Google reCAPTCHA. By integrating with reCAPTCHA, google will try to verify if your client is valid so your Mobile Apps or Web Frontend will have to do the integration too. This way it’s harder for attackers to call the API without rendering your frontend properly, eliminating most of the DOS attack. This will take a little bit more time to implement but well worth it.</p>
<h2 id="heading-4-rate-limit-based-on-unique-identifier-id-email-phone"><strong>4. Rate limit based on Unique Identifier (ID, Email, Phone)</strong></h2>
<p>An example of this is, only allowing users to request OTP 3 times a day. This is the strictest rate-limiting strategy and you wouldn’t need it unless you are working for a really big company where your API users are making your API call multiple times a second such as Stock/Crypto Exchange. You probably wouldn’t need to read this article if you are working for such a company :).</p>
<p>Feel free to reach out if you have any questions!</p>
]]></content:encoded></item><item><title><![CDATA[REST vs GraphQL — How to choose your API architecture?]]></title><description><![CDATA[Having been working on both REST and GraphQL API, I’ve accumulated a mental checklist on how to choose which one to use depending on the specific use case. I’m writing them down here for my reference as well as sharing them with you.
Things I conside...]]></description><link>https://blog.yelwinsoe.dev/rest-vs-graphql-how-to-choose-your-api-architecture</link><guid isPermaLink="true">https://blog.yelwinsoe.dev/rest-vs-graphql-how-to-choose-your-api-architecture</guid><category><![CDATA[APIs]]></category><category><![CDATA[REST API]]></category><category><![CDATA[GraphQL]]></category><dc:creator><![CDATA[Ye Lwin Soe]]></dc:creator><pubDate>Wed, 26 Jul 2023 03:26:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690341841839/58d9b592-3ec7-4fd6-afe4-a6be39b3608a.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Having been working on both REST and GraphQL API, I’ve accumulated a mental checklist on how to choose which one to use depending on the specific use case. I’m writing them down here for my reference as well as sharing them with you.</p>
<h1 id="heading-things-i-consider-while-choosing-api-architecture"><strong>Things I consider while choosing API architecture</strong></h1>
<h2 id="heading-1-is-it-a-demo-app"><strong>1. Is it a demo app?</strong></h2>
<p>If it’s a demo aka proof of concept apps or websites without any plan to make it to production, it’s easy, just go with GraphQL. It’ll make your development faster and cheaper as well.</p>
<h2 id="heading-2-has-multiple-clients"><strong>2. Has multiple clients?</strong></h2>
<p>Will your Api access by multiple clients? In my case my Api were consumed by multiple Websites, mobile Apps as well as multiple kiosks, it’s a no-brainer to choose REST. Updating data or tweaking a bit of business logic that can be done in the API (backend) can take a very long time with GraphQL since you’ll have to update every client.</p>
<h2 id="heading-3-has-complex-authorisation"><strong>3. Has complex Authorisation?</strong></h2>
<p>If Api has a very complex Authorisation with multiple roles and different types of users, REST will be better suited as you’ll have full control of your data in the backend. With a simple Authorisation in mind, GraphQL can speed up the development process.</p>
<p>I hope to add more things that need to be considered to better improve decision-making. Let me know in the comment what you think.</p>
]]></content:encoded></item></channel></rss>