<?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: Sovan Kandar</title>
    <description>The latest articles on DEV Community by Sovan Kandar (@sovan_kandar_cfc10d231218).</description>
    <link>https://dev.to/sovan_kandar_cfc10d231218</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4024173%2Fc97fdeed-5e75-4ad4-a6f8-c5e18a5674a1.png</url>
      <title>DEV Community: Sovan Kandar</title>
      <link>https://dev.to/sovan_kandar_cfc10d231218</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sovan_kandar_cfc10d231218"/>
    <language>en</language>
    <item>
      <title>Stop writing the same custom HTTP wrapper in every project</title>
      <dc:creator>Sovan Kandar</dc:creator>
      <pubDate>Sun, 23 Aug 2026 07:54:28 +0000</pubDate>
      <link>https://dev.to/sovan_kandar_cfc10d231218/stop-writing-the-same-custom-http-wrapper-in-every-project-1gka</link>
      <guid>https://dev.to/sovan_kandar_cfc10d231218/stop-writing-the-same-custom-http-wrapper-in-every-project-1gka</guid>
      <description>&lt;p&gt;&lt;em&gt;Every time I start a new frontend or full-stack project, the same ritual happens.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We install axios or grab native fetch, and within a few weeks, we find ourselves building a massive layer of custom wrappers, interceptors, and helpers around it. Why? Because out-of-the-box HTTP clients handle basic data fetching fine, but they completely ignore real-world app constraints like rapid user actions, state duplication, and client-side payload security.&lt;/p&gt;

&lt;p&gt;Later, every project codebase ends up with its own "homegrown" network utility to solve four specific headaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. In-Flight Request Flooding
&lt;/h2&gt;

&lt;p&gt;Typical HTTP clients make repeated parallel requests to an API when a user double clicks a button or UI re-renders multiple times. You end up needing to write your own AbortController business logic and/or custom flag locks to avoid wasting any server CPU cycles.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Payload Security Boilerplate
&lt;/h2&gt;

&lt;p&gt;In the event that you're handling sensitive customer information, medical records, or financial payloads, using HTTPS just in transit may not be sufficient. Typically, one has to import large cryptographic libraries and build a lot of request/response interceptors to implement the AES-GCM payload encryption on the client-side.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Basic TTL Caching
&lt;/h2&gt;

&lt;p&gt;It doesn't have to be a 3 second GET double hit. However, implementing a simple in-memory cache for short-lived often requires adding on a whole state management library or complicated caching layers for something as simple as a request freshness.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Boilerplate HMAC Signing
&lt;/h2&gt;

&lt;p&gt;If you need to sign requests for API security, you have to manually manipulate the header on all requests you send out, which is a bit cumbersome.&lt;/p&gt;

&lt;p&gt;I was sick of duplicating and re-architecting the same 4 mechanisms into various codebases. I thought of combining everything into a single helper utility for each use case, but it seemed like too much work to me, so I just copied them into a single helper utility that was written first in TypeScript: PHTPS.&lt;/p&gt;

&lt;p&gt;Let's look at how these common patterns look when incorporated into the network layer natively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;phtps&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;phtps&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Deduplication, TTL caching, and AES payload encryption out of the box&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;phtps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.example.com/sensitive-data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;12345&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;encrypt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;       &lt;span class="c1"&gt;// Native AES-GCM client-side encryption&lt;/span&gt;
  &lt;span class="na"&gt;dedupe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// Automatically merges identical in-flight requests&lt;/span&gt;
  &lt;span class="na"&gt;ttl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;            &lt;span class="c1"&gt;// In-memory cache for 5 seconds&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Not only these 4, PHTPS has 11 official plugin with proper documentation.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Interactive Playground &amp;amp; Documentation: &lt;a href="https://phtps-app.vercel.app" rel="noopener noreferrer"&gt;https://phtps-app.vercel.app&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;How are you currently handling request deduplication and client-side encryption in your apps? Do you rely on custom wrappers, or do you handle it at the state management layer? I'd love to hear your approach in the comments below!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>phtps</category>
      <category>javascript</category>
    </item>
    <item>
      <title>I built an HTTP client in TypeScript that handles auth, encryption, caching, dedup, and pagination - all without any extra packages.

Here is @pings/phtps

Github - https://github.com/sovankandar/Phtps

let me know what is missing. I read all the comments!</title>
      <dc:creator>Sovan Kandar</dc:creator>
      <pubDate>Fri, 10 Jul 2026 13:48:36 +0000</pubDate>
      <link>https://dev.to/sovan_kandar_cfc10d231218/i-built-an-http-client-in-typescript-that-handles-auth-encryption-caching-dedup-and-pagination-44o7</link>
      <guid>https://dev.to/sovan_kandar_cfc10d231218/i-built-an-http-client-in-typescript-that-handles-auth-encryption-caching-dedup-and-pagination-44o7</guid>
      <description>&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.com/sovankandar/Phtps" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fopengraph.githubassets.com%2F7b658ffb28880cb7204abbf3ad9456ea630c5e9845e87c69d0bfd010aebf4f33%2Fsovankandar%2FPhtps" height="600" class="m-0" width="1200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.com/sovankandar/Phtps" rel="noopener noreferrer" class="c-link"&gt;
            GitHub - sovankandar/Phtps · GitHub
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Contribute to sovankandar/Phtps development by creating an account on GitHub.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicons%2Ffavicon.svg" width="32" height="32"&gt;
          github.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>opensource</category>
      <category>showdev</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
