<?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: Hesham Mohamed</title>
    <description>The latest articles on DEV Community by Hesham Mohamed (@mubtikr).</description>
    <link>https://dev.to/mubtikr</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%2F1063792%2F655ebe98-e2b1-48e1-b8d3-1a3ee9213244.jpg</url>
      <title>DEV Community: Hesham Mohamed</title>
      <link>https://dev.to/mubtikr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mubtikr"/>
    <language>en</language>
    <item>
      <title>How I Turned My Personal Storage Accounts Into a Massive S3 Bucket for $0</title>
      <dc:creator>Hesham Mohamed</dc:creator>
      <pubDate>Fri, 19 Jun 2026 15:20:48 +0000</pubDate>
      <link>https://dev.to/mubtikr/how-i-turned-my-personal-storage-accounts-into-a-massive-s3-bucket-for-0-2m2a</link>
      <guid>https://dev.to/mubtikr/how-i-turned-my-personal-storage-accounts-into-a-massive-s3-bucket-for-0-2m2a</guid>
      <description>&lt;p&gt;As developers, we’ve all been there: you’re building a hobby project, a side hustle, or a microservice, and you need object storage. You look at AWS S3 or dedicated cloud providers, and the costs start adding up. Meanwhile, most of us have hundreds of gigabytes of idle, wasted space sitting in our personal Google Drive, Dropbox, or Mega accounts.&lt;/p&gt;

&lt;p&gt;I wanted to find a way to use that personal cloud storage programmatically—specifically as an S3-compatible bucket—without paying premium storage fees.&lt;/p&gt;

&lt;p&gt;But I had one strict rule for myself: &lt;strong&gt;The solution had to be 100% stateless.&lt;/strong&gt; No caching files on my servers, no data retention, and zero storage costs on my end. Security and privacy meant that files had to exist on my infrastructure &lt;em&gt;only in-flight&lt;/em&gt; as streaming data packets.&lt;/p&gt;

&lt;p&gt;Here is a deep technical breakdown of the architecture I built to make this happen using &lt;strong&gt;NestJS, Fastify, OpenDAL, and BullMQ&lt;/strong&gt; in a monorepo structure.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Core Architecture: A Monorepo Approach
&lt;/h2&gt;

&lt;p&gt;To keep performance blazing fast and maintain a clean separation of concerns, I broke the system down into three distinct, decoupled services inside a monorepo, sharing underlying core modules.&lt;/p&gt;

&lt;p&gt;Because raw Node.js HTTP overhead can become a bottleneck when proxying heavy streams, I swapped out Express for &lt;strong&gt;Fastify&lt;/strong&gt; as the underlying HTTP provider for NestJS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;               ┌────────────────────────────────────────┐
               │              Main API Server           │
               │  (Handles Auth, Web Dashboard, OAuth)  │
               └───────────────────┬────────────────────┘
                                   │
                                   │ (Pushes Sync/Heavy Tasks)
                                   ▼
                             ┌───────────┐
                             │  BullMQ   │
                             └─────┬─────┘
                                   │
                                   ▼
               ┌────────────────────────────────────────┐
               │             Worker Server              │
               │      (Processes Heavy Background Jobs) │
               └────────────────────────────────────────┘

─────────────────────────────────────────────────────────────────────────

               ┌────────────────────────────────────────┐
               │          S3-Compatibility Server       │
               │  (Streams Data / Translates S3 XML)   │
               └────────────────────────────────────────┘

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Main API Server:&lt;/strong&gt; Handles user authentication, the web dashboard management, and OAuth flows. To ensure high availability, this server &lt;strong&gt;does not&lt;/strong&gt; handle raw file processing or synchronization jobs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Worker Server:&lt;/strong&gt; When a heavy asynchronous task or sync job is triggered, the Main API pushes it to a &lt;strong&gt;BullMQ&lt;/strong&gt; queue. The Worker server listens and processes these background jobs safely without blocking incoming API traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The S3-Compatibility Server:&lt;/strong&gt; A dedicated standalone server focused entirely on parsing standard AWS S3 API signatures, handling S3-specific XML payloads, and streaming object data directly.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  2. Decoupling Providers with the Adapter Pattern &amp;amp; OpenDAL
&lt;/h2&gt;

&lt;p&gt;Every cloud storage provider has a completely different API ecosystem. To prevent my codebase from turning into spaghetti code, I heavily relied on the &lt;strong&gt;Adapter Pattern&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I defined a unified &lt;code&gt;StorageAdapter&lt;/code&gt; interface. Whether a user connects Google Drive or Mega, the core engine interacts with them identically. To abstract away the low-level file system operations, I utilized &lt;strong&gt;OpenDAL&lt;/strong&gt; (Open Data Access Layer), which provides a brilliant data access abstraction layer.&lt;/p&gt;

&lt;p&gt;Here is a simplified look at how the adapters are structured:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;StorageAdapter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;uploadFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ReadableStream&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;UploadResult&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;downloadFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ReadableStream&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;deleteFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;listFiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;FileObject&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Authentication Split: OAuth vs. Credentials
&lt;/h3&gt;

&lt;p&gt;Implementing this pattern threw a major curveball when dealing with provider authentication. The providers essentially split into two categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The OAuth Providers (Google Drive, Dropbox):&lt;/strong&gt; These use standard OAuth 2.0 flows. The Main API handles the redirect, grabs the refresh token, and securely manages access tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Credential Providers (Mega):&lt;/strong&gt; Mega doesn't have an OAuth layer; it strictly requires a username and password.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because we are 100% stateless, we &lt;em&gt;must&lt;/em&gt; store these credentials to authenticate requests on the fly. To do this safely, the credentials undergo strong encryption before hitting our database and are decrypted strictly in-flight within the isolated adapter instance during runtime execution.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Google Drive Blockblock: Fighting Permissions
&lt;/h2&gt;

&lt;p&gt;If you ever try to build a platform that hooks into Google Drive for programmatic developer access, you will run into a massive security UX roadblock.&lt;/p&gt;

&lt;p&gt;Initially, I requested the standard &lt;code&gt;drive&lt;/code&gt; access scope. However, Google treats full drive access as a highly restricted permission. If you use it, Google aggressively flags your application with a terrifying &lt;strong&gt;"This app is not secure / Not authorized"&lt;/strong&gt; warning screen for any external user attempting to connect their account. Bypassing this requires a lengthy, expensive independent security verification process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Fix:&lt;/strong&gt; I downgraded the requested scope to strictly &lt;code&gt;drive.file&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This scope only grants our application access to files and folders that &lt;em&gt;the app itself creates&lt;/em&gt;. It completely resolved the security verification warning, making the onboarding flow seamless while executing perfect least-privilege security. The user gets a secure sandbox within their own Google Drive, and our app gets immediate authorization.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Keeping it 100% Stateless via Streaming
&lt;/h2&gt;

&lt;p&gt;The magic of this gateway is that it doesn't scale with disk space; it scales with network throughput. When an S3 request comes into the S3-compatible server, we don't download the file to our disk and then upload it to the provider.&lt;/p&gt;

&lt;p&gt;Instead, we use Node.js and Fastify's native streaming capabilities. We pipe the incoming S3 request stream directly into the OpenDAL abstraction layer for the respective adapter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// A high-level conceptual example of pass-through streaming&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;handleS3Upload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FastifyRequest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FastifyReply&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;targetAdapter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;adapterFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Pipe the raw incoming request payload directly to the cloud provider&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&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;targetAdapter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uploadFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filepath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Reply with standard S3 XML format&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/xml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;xmlBuilder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What I Learned &amp;amp; What’s Next
&lt;/h2&gt;

&lt;p&gt;Building an infrastructure tool like this taught me that the hardest part isn't writing the code; it's mapping completely mismatched paradigms (like translating S3 XML APIs into standard REST JSON responses used by consumer cloud drives).&lt;/p&gt;

&lt;p&gt;I've packaged this entire architecture into a managed platform called &lt;strong&gt;Uploom&lt;/strong&gt; (&lt;code&gt;uploom.io&lt;/code&gt;). It lets you spin up an S3-compatible gateway on top of your personal cloud storage in less than 2 minutes without hosting anything yourself.&lt;/p&gt;

&lt;p&gt;I’d love to hear your thoughts on this setup!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How would you handle credential encryption for non-OAuth providers differently?&lt;/li&gt;
&lt;li&gt;Have you run into similar streaming bottlenecks with Node.js/Fastify under heavy loads?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's discuss in the comments below!&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>architecture</category>
      <category>typescript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
