<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nurul Islam Rimon on Medium]]></title>
        <description><![CDATA[Stories by Nurul Islam Rimon on Medium]]></description>
        <link>https://medium.com/@nurulislamrimon?source=rss-2e9387733e30------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HQpndF_3ImDXxlhfyJYEJQ.png</url>
            <title>Stories by Nurul Islam Rimon on Medium</title>
            <link>https://medium.com/@nurulislamrimon?source=rss-2e9387733e30------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:18:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nurulislamrimon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Managing Multiple GitHub Accounts on Windows with SSH]]></title>
            <link>https://medium.com/@nurulislamrimon/managing-multiple-github-accounts-on-windows-with-ssh-e7cc228103ed?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7cc228103ed</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <category><![CDATA[git-multiple-account]]></category>
            <category><![CDATA[application-development]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Fri, 09 Oct 2026 15:26:20 GMT</pubDate>
            <atom:updated>2026-10-09T16:47:24.983Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVQ6x2CQEHoccJTnpix8LQ.png" /></figure><p>If you use separate GitHub accounts for personal and professional projects, you don’t need to switch accounts every time you change repositories.</p><p>The cleanest approach is to configure <strong>multiple SSH keys and host aliases</strong>, then assign Git identities at the appropriate configuration level.</p><h3>1. Generate Separate SSH Keys</h3><p>In PowerShell:</p><pre>ssh-keygen -t ed25519 -C &quot;personal@example.com&quot; -f &quot;$HOME\.ssh\id_ed25519_personal&quot;</pre><pre>ssh-keygen -t ed25519 -C &quot;work@example.com&quot; -f &quot;$HOME\.ssh\id_ed25519_work&quot;</pre><p>Add each public key (.pub) to its corresponding GitHub account under <a href="https://github.com/settings/keys">SSH Keys</a>.</p><h3>2. Configure SSH Aliases</h3><p>Create or edit ~/.ssh/config:</p><pre>Host github-personal<br>    HostName github.com<br>    User git<br>    IdentityFile ~/.ssh/id_ed25519_personal<br>    IdentitiesOnly yes</pre><pre>Host github-work<br>    HostName github.com<br>    User git<br>    IdentityFile ~/.ssh/id_ed25519_work<br>    IdentitiesOnly yes</pre><p>Each alias selects a specific SSH identity.</p><p>Test the connections:</p><pre>ssh -T git@github-personal<br>ssh -T git@github-work</pre><h3>3. Clone Repositories with the Correct Identity</h3><p>Use the appropriate alias in the repository URL:</p><pre>git clone git@github-personal:OWNER/REPOSITORY.git</pre><pre>git clone git@github-work:OWNER/REPOSITORY.git</pre><p>For existing repositories, update the remote if necessary:</p><pre>git remote set-url origin git@github-work:OWNER/REPOSITORY.git</pre><p>Verify it with git remote -v.</p><h3>4. Configure Commit Identity Separately</h3><p>SSH authentication and Git commit identity are independent.</p><p>Set a default identity:</p><pre>git config --global user.name &quot;Your Name&quot;<br>git config --global user.email &quot;personal@example.com&quot;</pre><p>Override it for a specific work repository:</p><pre>git config user.name &quot;Your Work Name&quot;<br>git config user.email &quot;work@example.com&quot;</pre><p>Run the second set inside the repository. Local configuration overrides global configuration.</p><p>Git records this name and email in new commits; SSH determines which GitHub account authenticates the connection. GitHub may associate commits with your profile when their email matches an address linked to your account.</p><h3>5. Commit and Push Normally</h3><pre>git add .<br>git commit -m &quot;Update feature&quot;<br>git push</pre><p>Git uses the repository’s configured remote URL, so the SSH alias selects the appropriate key automatically.</p><h3>Common Pitfall</h3><p>Using git@github.com:OWNER/REPOSITORY.git bypasses your custom aliases. Use github-personal or github-work explicitly to select the intended SSH identity.</p><p>If authentication succeeds but cloning fails, verify that the authenticated account has access to the private repository.</p><h3>Final Thoughts</h3><p>Multiple GitHub accounts on one machine require no complicated account switching. Separate SSH keys, explicit host aliases, and repository-level Git identities provide a simple, predictable setup for personal, professional, and client projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7cc228103ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You Can Run AI on Your Own PC]]></title>
            <link>https://medium.com/@nurulislamrimon/you-can-run-ai-on-your-own-pc-d0d05868b002?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0d05868b002</guid>
            <category><![CDATA[local-ai-model]]></category>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Mon, 24 Aug 2026 14:56:41 GMT</pubDate>
            <atom:updated>2026-08-25T05:21:35.018Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rWm9StHyRv8rKgdLsTO0Sw.gif" /></figure><h4>Here’s How Ollama Actually Works</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-_zMXaB3NL2CyDMV6gbeQ.png" /></figure><p>What if you could run an AI model on your own computer without an API key, a cloud server, or a monthly subscription?</p><p>You can.</p><p>And one of the easiest ways to do it is <strong>Ollama</strong>.</p><p>If you’ve heard terms like Llama, Qwen, Gemma, 7B, 32K context, or quantization and wondered what they actually mean, this article will give you the big picture without drowning you in AI theory.</p><p>Let’s start from the beginning.</p><h3>So, What Exactly Is Ollama?</h3><p>Ollama is a tool for running <strong>large language models (LLMs) locally</strong> on your computer.</p><p>Normally, when you use an AI service, your request travels to a company’s servers:</p><pre>Your Computer<br>      ↓<br>   Internet<br>      ↓<br>Cloud AI Server<br>      ↓<br>     Model</pre><p>With Ollama:</p><pre>Your Computer<br>      ↓<br>    Ollama<br>      ↓<br>   AI Model</pre><p>Your computer does the work.</p><p>That’s the interesting part.</p><p>You can download a model, run it locally, and interact with it from your terminal or your own applications.</p><h3>Ollama Isn’t the AI Model</h3><p>This is the first thing to understand.</p><p><strong>Ollama is the runtime. The model is the brain.</strong></p><p>For example:</p><pre>ollama run qwen3:4b</pre><p>Here:</p><ul><li>ollama → the runtime</li><li>qwen3 → the model family</li><li>4b → approximately 4 billion parameters</li></ul><p>You could instead run another model:</p><pre>ollama run gemma4:e4b</pre><p>Same Ollama.</p><p>Different brain.</p><p>Think of it like this:</p><blockquote><strong><em>Ollama is the player. The model is the music.</em></strong></blockquote><h3>What Does “4B” Actually Mean?</h3><p>You’ll see model names such as:</p><pre>3B<br>4B<br>7B<br>14B<br>32B<br>70B</pre><p>The B means <strong>billion parameters</strong>.</p><p>So a 7B model has roughly 7 billion parameters.</p><p>You don’t need to understand the mathematics behind every parameter.</p><p>For now, remember:</p><blockquote><strong><em>More parameters generally means a larger model with more capacity, but bigger doesn’t automatically mean better.</em></strong></blockquote><p>A smaller modern model can be surprisingly capable.</p><p>And there’s a catch.</p><p>Larger models usually need more memory.</p><h3>RAM, VRAM and Why Your Computer Matters</h3><p>Suppose your computer has:</p><pre>RAM  → 16 GB<br>VRAM → 8 GB</pre><p>RAM is your system memory.</p><p>VRAM is memory available to your GPU.</p><p>AI models can use both depending on your hardware and configuration, but having enough GPU memory can make local inference significantly faster.</p><p>This is why you can’t simply download the biggest model you find and expect it to run perfectly.</p><p>For a beginner, something in the smaller model range is a much better starting point.</p><h3>Your First Local AI</h3><h4>Download and Install Ollama</h4><p><a href="https://ollama.com/download/mac">Mac Terminal</a>:</p><pre>curl -fsSL https://ollama.com/install.sh | sh</pre><p><a href="https://ollama.com/download/linux">Linux Terminal</a>:</p><pre>curl -fsSL https://ollama.com/install.sh | sh</pre><p><a href="https://ollama.com/download/windows">Windows PowerShell</a>:</p><pre>irm https://ollama.com/install.ps1 | iex</pre><h4>Run a model</h4><p>Once Ollama is installed, running a model can be as simple as:</p><pre>ollama run qwen3:4b</pre><p>That’s it.</p><p>Ollama downloads the model if necessary and starts a conversation.</p><p>You can ask:</p><pre>Explain Docker to me like I&#39;m a beginner.</pre><p>And you’re chatting with a local AI model.</p><p>No API key.</p><p>No frontend.</p><p>No backend.</p><p>Just your computer.</p><h3>A Few Ollama Commands You’ll Actually Use</h3><p>You don’t need to memorize dozens of commands.</p><p>These are enough to get started:</p><pre># See installed models<br>ollama list</pre><pre># Download a model<br>ollama pull qwen3:4b</pre><pre># Run a model<br>ollama run qwen3:4b</pre><pre># Remove a model<br>ollama rm qwen3:4b</pre><pre># Inspect a model<br>ollama show qwen3:4b</pre><p>Once you start experimenting, these commands become second nature.</p><h3>Wait… What’s a Token?</h3><p>Here’s another term you’ll see everywhere in AI:</p><p><strong>tokens</strong>.</p><p>An AI model doesn’t exactly read text as words.</p><p>It processes text as smaller pieces called tokens.</p><p>For example, a sentence like:</p><pre>Ollama runs AI locally.</pre><p>is broken into tokens before the model processes it.</p><p>This matters because AI models have a <strong>context window</strong>.</p><h3>What’s a Context Window?</h3><p>Imagine you’re talking to an AI for an hour.</p><p>The model needs to keep track of the conversation to understand what you’re talking about.</p><p>The amount of information it can consider at once is its context window.</p><p>You’ll see values such as:</p><pre>8K<br>32K<br>64K<br>128K</pre><p>The K means approximately thousands of tokens.</p><p>So:</p><pre>32K ≈ 32,000 tokens</pre><p>A larger context window is especially useful for:</p><ul><li>long conversations</li><li>large documents</li><li>codebases</li><li>AI agents</li><li>tool calls</li></ul><p>And this becomes very important when we move from <strong>chatbots to agents</strong>.</p><h3>Ollama Isn’t Just for Chat</h3><p>Here’s where things get interesting.</p><p>Ollama provides an API, so your own application can communicate with the model.</p><p>For example:</p><pre>Next.js Application<br>        ↓<br>     Backend<br>        ↓<br>      Ollama<br>        ↓<br>    Qwen Model</pre><p>Now you’re not just chatting with AI.</p><p>You’re <strong>building with AI</strong>.</p><p>You can create:</p><ul><li>coding assistants</li><li>document assistants</li><li>private company chatbots</li><li>RAG applications</li><li>automation systems</li><li>AI agents</li></ul><p>And you don’t have to build everything from scratch.</p><h3>From Chatbot to AI Agent</h3><p>A chatbot mainly answers questions.</p><p>An AI agent can <strong>use tools to accomplish a task</strong>.</p><p>For example, imagine telling an agent:</p><blockquote><em>“Check my server and tell me why the application is down.”</em></blockquote><p>An agent could potentially:</p><pre>Understand the request<br>       ↓<br>Check server<br>       ↓<br>Read logs<br>       ↓<br>Analyze the problem<br>       ↓<br>Take an action<br>       ↓<br>Report the result</pre><p>This is where local models become particularly interesting.</p><p>You can use Ollama as the model provider and an agent framework such as <strong>OpenClaw</strong> to provide tools, memory, and the surrounding agent environment.</p><p>The architecture becomes:</p><pre>AI Agent<br>           ↓<br>        OpenClaw<br>           ↓<br>         Ollama<br>           ↓<br>       AI Model</pre><p>Now your local model isn’t just answering questions.</p><p>It can become the reasoning engine inside a larger system.</p><h3>Should You Run AI Locally?</h3><p>Not always.</p><p>Local AI has some great advantages:</p><p><strong>Privacy</strong> — your data can stay on your machine.</p><p><strong>Cost</strong> — you don’t necessarily pay for every request.</p><p><strong>Control</strong> — you choose the model and infrastructure.</p><p><strong>Experimentation</strong> — you can try different models without constantly managing API keys.</p><p>But cloud models can still be more capable, especially for difficult reasoning tasks.</p><p>So the best solution isn’t always “local” or “cloud.”</p><p>A hybrid approach can be even better:</p><pre>Simple tasks<br>     ↓<br>Local Ollama model</pre><pre>Complex tasks<br>     ↓<br>Cloud AI model</pre><h3>The Big Picture</h3><p>If you’re new to local AI, don’t worry about understanding everything at once.</p><p>Start with these five ideas:</p><pre>Ollama<br>  ↓<br>Runs AI models</pre><pre>Model<br>  ↓<br>The actual AI</pre><pre>Parameters<br>  ↓<br>Model capacity</pre><pre>Tokens<br>  ↓<br>How AI processes text</pre><pre>Context<br>  ↓<br>How much information AI can consider</pre><p>Once these make sense, the rest of the ecosystem becomes much easier to understand.</p><p>And the best part?</p><p>You can start experimenting right now.</p><pre>ollama run qwen3:4b</pre><p>One command can take you from <strong>“I’ve never run an AI model locally”</strong> to <strong>“I have an AI running on my own computer.”</strong></p><p>And from there, the next step is even more interesting:</p><p><strong>Turning that local model into an AI agent that can actually do things.</strong></p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0d05868b002" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Replace AWS S3 with MinIO in Development (Without Changing Your Code)]]></title>
            <link>https://medium.com/@nurulislamrimon/how-to-replace-aws-s3-with-minio-in-development-without-changing-your-code-38a4fde2fb79?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/38a4fde2fb79</guid>
            <category><![CDATA[minio]]></category>
            <category><![CDATA[file-upload]]></category>
            <category><![CDATA[object-storage]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Sat, 11 Jul 2026 12:55:00 GMT</pubDate>
            <atom:updated>2026-07-11T12:55:00.521Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to deploy MinIO with Docker, configure it as an S3-compatible object storage service, connect it to NestJS using the AWS SDK, and prepare it for production.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rWn8xUzMe1VCxxTdWTYxLw.png" /></figure><p>When building modern applications, object storage quickly becomes a necessity. Whether you’re storing user avatars, product images, invoices, videos, or backups, you need a reliable storage solution.</p><p>For most developers, Amazon S3 is the first choice , and for good reason. It’s scalable, reliable, and widely supported.</p><p>However, during local development or while working on self-hosted applications, relying on AWS isn’t always ideal. You may not want external dependencies, cloud costs, or internet access just to test file uploads.</p><p>That’s exactly why I started using <strong>MinIO</strong>.</p><p>MinIO provides an <strong>S3-compatible object storage server</strong> that you can run anywhere , on your laptop, a VPS, Docker, or Kubernetes. Even better, your application code remains almost identical to what you’d write for Amazon S3.</p><h3>What is MinIO?</h3><p>MinIO is an open-source, high-performance object storage server that’s fully compatible with the Amazon S3 API.</p><p>Instead of storing files on your local filesystem, applications store <strong>objects</strong> inside <strong>buckets</strong>.</p><p>Think of it like this:</p><pre>Application<br>      │<br>AWS SDK<br>      │<br>──────────────<br> AWS S3<br>    or<br> MinIO</pre><h4>The biggest advantage is simple:</h4><p>If your application already works with MinIO, switching to Amazon S3 later usually requires changing only the configuration , not your application logic.</p><h3>Why Choose MinIO?</h3><p>There are plenty of reasons developers love MinIO:</p><ul><li>Fully S3-compatible</li><li>Open source</li><li>Extremely fast</li><li>Docker-friendly</li><li>Self-hosted</li><li>Production-ready</li><li>Supports presigned URLs</li><li>Versioning</li><li>Replication</li><li>Encryption</li><li>Works with every AWS SDK</li></ul><p>Whether you’re building a SaaS platform, CMS, eCommerce application, or mobile backend, MinIO fits naturally into your architecture.</p><h3>Running MinIO with Docker</h3><p>Let’s start by running MinIO using Docker Compose.</p><pre>services:<br>  minio:<br>    image: minio/minio<br>    container_name: dev_minio<br>    restart: always<br><br>    environment:<br>      MINIO_ROOT_USER: root<br>      MINIO_ROOT_PASSWORD: adminpass<br><br>    command: server /data --console-address &quot;:9001&quot;<br><br>    ports:<br>      - &quot;9000:9000&quot;<br>      - &quot;8086:9001&quot;<br><br>    volumes:<br>      - minio_data:/data<br><br>volumes:<br>  minio_data:</pre><p>Start it:</p><pre>docker compose up -d</pre><p>Once it’s running:</p><p><strong>S3 API</strong></p><pre>http://localhost:9000</pre><p><strong>Web Console</strong></p><pre>http://localhost:8086</pre><p>Login using:</p><pre>Username: root<br>Password: adminpass</pre><h3>Creating Your First Bucket</h3><p>Inside the web console:</p><ol><li>Click <strong>Create Bucket</strong></li><li>Enter a bucket name</li></ol><p>Example:</p><pre>uploads</pre><p>Buckets are similar to top-level folders.</p><p>Inside buckets you’ll store objects:</p><pre>uploads<br>├── avatars<br>├── products<br>├── invoices<br>└── documents</pre><p>Although they look like folders, they’re actually object prefixes, just like Amazon S3.</p><h4>Use the official AWS SDK.</h4><pre>npm install @aws-sdk/client-s3</pre><h3>Connecting to MinIO</h3><p>Create an S3 client.</p><pre>import { S3Client } from &quot;@aws-sdk/client-s3&quot;;<br><br>export const s3 = new S3Client({<br>    endpoint: &quot;http://localhost:9000&quot;,<br>    region: &quot;us-east-1&quot;,<br><br>    forcePathStyle: true,<br><br>    credentials: {<br>        accessKeyId: &quot;root&quot;,<br>        secretAccessKey: &quot;adminpass&quot;,<br>    },<br>});</pre><p>Let’s understand these options.</p><h3>endpoint</h3><p>Instead of Amazon S3, we’re connecting to our local MinIO server.</p><pre>http://localhost:9000</pre><h3>region</h3><p>MinIO ignores regions, but the AWS SDK expects one.</p><pre>us-east-1</pre><p>is commonly used.</p><h3>forcePathStyle</h3><p>Amazon S3 supports virtual-hosted URLs like:</p><pre>https://bucket.s3.amazonaws.com/image.png</pre><p>MinIO generally uses:</p><pre>http://localhost:9000/bucket/image.png</pre><p>Setting</p><pre>forcePathStyle: true</pre><p>ensures maximum compatibility.</p><h3>Uploading Files</h3><p>Uploading an object is straightforward.</p><pre>import {<br>    PutObjectCommand,<br>} from &quot;@aws-sdk/client-s3&quot;;<br><br>await s3.send(<br>    new PutObjectCommand({<br>        Bucket: &quot;uploads&quot;,<br>        Key: &quot;avatars/user-1.png&quot;,<br>        Body: fileBuffer,<br>        ContentType: &quot;image/png&quot;,<br>    }),<br>);</pre><p>Here:</p><ul><li><strong>Bucket</strong> is the storage bucket.</li><li><strong>Key</strong> is the object’s path.</li><li><strong>Body</strong> contains the file data.</li><li><strong>ContentType</strong> helps browsers display files correctly.</li></ul><h3>Downloading Files</h3><p>Retrieving a file is just as easy.</p><pre>import {<br>    GetObjectCommand,<br>} from &quot;@aws-sdk/client-s3&quot;;<br><br>const object = await s3.send(<br>    new GetObjectCommand({<br>        Bucket: &quot;uploads&quot;,<br>        Key: &quot;avatars/user-1.png&quot;,<br>    }),<br>);</pre><p>The returned object contains a readable stream that can be sent directly to the client.</p><h3>Deleting Files</h3><pre>import {<br>    DeleteObjectCommand,<br>} from &quot;@aws-sdk/client-s3&quot;;<br><br>await s3.send(<br>    new DeleteObjectCommand({<br>        Bucket: &quot;uploads&quot;,<br>        Key: &quot;avatars/user-1.png&quot;,<br>    }),<br>);</pre><h3>Generating Presigned URLs</h3><p>One of the best features of S3-compatible storage is <strong>presigned URLs</strong>.</p><p>Instead of uploading files through your backend:</p><pre>Browser<br>    │<br>Backend<br>    │<br>MinIO</pre><p>You can upload directly:</p><pre>Browser<br>    │<br>    ▼<br>MinIO</pre><p>This reduces server load and improves upload performance.</p><p>Generate an upload URL:</p><pre>import { getSignedUrl } from &quot;@aws-sdk/s3-request-presigner&quot;;<br>import { PutObjectCommand } from &quot;@aws-sdk/client-s3&quot;;<br><br>const url = await getSignedUrl(<br>    s3,<br>    new PutObjectCommand({<br>        Bucket: &quot;uploads&quot;,<br>        Key: &quot;avatars/user-1.png&quot;,<br>    }),<br>    {<br>        expiresIn: 300,<br>    },<br>);</pre><p>For downloads:</p><pre>const url = await getSignedUrl(<br>    s3,<br>    new GetObjectCommand({<br>        Bucket: &quot;uploads&quot;,<br>        Key: &quot;avatars/user-1.png&quot;,<br>    }),<br>    {<br>        expiresIn: 300,<br>    },<br>);</pre><h3>Using the MinIO Client (mc)</h3><p>Although the web console is great for browsing objects, the <strong>MinIO Client (mc)</strong> is the preferred way to manage servers.</p><p>Configure your server:</p><pre>mc alias set local http://localhost:9000 root adminpass</pre><p>List buckets:</p><pre>mc ls local</pre><p>List objects:</p><pre>mc ls local/uploads</pre><p>Upload a file:</p><pre>mc cp image.png local/uploads</pre><p>Download a file:</p><pre>mc cp local/uploads/image.png .</pre><p>Generate a temporary download link:</p><pre>mc share download local/uploads/image.png</pre><p>Make a bucket publicly readable:</p><pre>mc anonymous set download local/uploads</pre><p>The CLI becomes especially useful when managing production servers or automating deployments.</p><p>My Package for object management: <a href="https://www.npmjs.com/package/nestjs-r2-storage">https://www.npmjs.com/package/nestjs-r2-storage</a></p><p>You can use it for complex object based file handling.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38a4fde2fb79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up MailHog with Docker for Local Email Testing]]></title>
            <link>https://medium.com/@nurulislamrimon/how-to-set-up-mailhog-with-docker-for-local-email-testing-478e9577aad0?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/478e9577aad0</guid>
            <category><![CDATA[backend-engineering]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[alternatives-to-mailchimp]]></category>
            <category><![CDATA[mail-server]]></category>
            <category><![CDATA[mailhog]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 08:16:13 GMT</pubDate>
            <atom:updated>2026-04-28T08:16:13.900Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s a must-have tool for any backend developer working with email systems.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PE8fzlelXvAgjIkfseP3PQ.gif" /></figure><p>When developing features like email verification, password reset, or notifications, sending real emails during development is risky and unnecessary.</p><p>That’s where MailHog comes in.</p><p>It captures outgoing emails locally so you can inspect them in a web UI — no real emails are sent.</p><p>In this guide, we’ll set it up using Docker.</p><h3>Step 1: Run MailHog using Docker</h3><p>Run the following command:</p><pre>docker run -d \<br>  -p 1025:1025 \<br>  -p 8025:8025 \<br>  --name mailhog \<br>  mailhog/mailhog</pre><p>This starts MailHog in the background.</p><h3>Step 2: Access the Web Interface</h3><p>Open your browser and go to:</p><p><a href="http://localhost:8025/">http://localhost:8025</a></p><p>This is where all captured emails will appear.</p><h3>Step 3: Understand the Ports</h3><ul><li><strong>1025 (SMTP)</strong> → Your application sends emails here</li><li><strong>8025 (Web UI)</strong> → You view emails here</li></ul><h3>Step 4: Configure Your Application</h3><p>Use these SMTP settings in your app:</p><pre>SMTP_HOST=localhost<br>SMTP_PORT=1025<br>SMTP_USER=<br>SMTP_PASS=</pre><p>Example using Nodemailer</p><pre>import nodemailer from &quot;nodemailer&quot;;<br><br>const transporter = nodemailer.createTransport({<br>  host: &quot;localhost&quot;,<br>  port: 1025,<br>  secure: false,<br>});</pre><p>Now, any email sent through this transporter will appear in MailHog.</p><h3>Step 5: Use Docker Compose (Recommended)</h3><p>For better project structure, create a docker-compose.yml:</p><pre>services:<br>  mailhog:<br>    image: mailhog/mailhog<br>    container_name: mailhog<br>    ports:<br>      - &quot;1025:1025&quot;<br>      - &quot;8025:8025&quot;</pre><p>Run:</p><pre>docker-compose up -d</pre><h3>Step 6: Test It</h3><p>Send a test email from your application.</p><p>Then open:</p><p><a href="http://localhost:8025/">http://localhost:8025</a></p><p>You should see the email instantly.</p><h3>Common Mistakes</h3><ul><li>Using port <strong>587 or 465</strong> instead of 1025</li><li>Adding SMTP credentials (not required)</li><li>Forgetting to run the container</li></ul><p>Check running containers:</p><pre>docker ps</pre><h3>Stop and Remove MailHog</h3><pre>docker stop mailhog<br>docker rm mailhog</pre><h3>Pro Tip</h3><p>Switch SMTP configs based on environment:</p><pre>const isDev = process.env.NODE_ENV !== &quot;production&quot;;<br><br>const config = {<br>  host: isDev ? &quot;localhost&quot; : &quot;your-production-smtp&quot;,<br>  port: isDev ? 1025 : 587,<br>};</pre><p>Using MailHog with Docker gives you:</p><ul><li>Safe email testing</li><li>Instant feedback</li><li>Zero risk of sending real emails</li></ul><p>It’s a must-have tool for any backend developer working with email systems.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=478e9577aad0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Ship Docker Images Without Registries Like a Pro]]></title>
            <link>https://medium.com/@nurulislamrimon/docker-ship-docker-images-without-registries-like-a-pro-17c648b28cba?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/17c648b28cba</guid>
            <category><![CDATA[container-orchestration]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 06:15:51 GMT</pubDate>
            <atom:updated>2026-06-28T12:59:53.390Z</atom:updated>
            <content:encoded><![CDATA[<h4>Stop Pulling Images in Production, A Better Alternative to Registries</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fX8-pgE0lZTrXye_HLHb4Q.png" /></figure><p>Most developers rely heavily on container registries when deploying Docker images. While this works well in many scenarios, it introduces hidden dependencies that can impact reliability, performance, and flexibility.</p><p>In production environments — especially in restricted, offline, or enterprise systems — this approach can become a bottleneck.</p><p>There’s a more portable and controlled way to distribute your Docker images.</p><h3>The Problem with Registry Dependency</h3><p>Pulling images from registries during deployment means:</p><ul><li>Your deployment depends on external availability</li><li>Network latency can slow down releases</li><li>Private registry access can introduce complexity</li><li>Offline or air-gapped environments become difficult to support</li></ul><p>For production-grade systems, reducing external dependencies is critical.</p><h3>A Portable Deployment Approach</h3><p>Instead of relying on registries, you can package and ship your Docker images directly.</p><h4>Step 1: Build Your Image</h4><pre>docker build -t my-app:prod .</pre><h4>Step 2: Export the Image</h4><pre>docker save -o app.tar my-app:prod</pre><p>This creates a portable .tar archive containing the full Docker image, including all layers.</p><h4>Step 3: Transfer the Image</h4><p>Move the archive to your target environment using any secure method:</p><ul><li>scp app.tar user@server:/path</li><li>Internal network transfer</li><li>Physical transfer (USB or restricted environments)</li></ul><p>This step works even in completely offline systems.</p><h4>Step 4: Load the Image</h4><pre>docker load -i app.tar</pre><p>The image is now available locally on the target machine.</p><h4>Step 5: Run the Container</h4><pre>docker run -d -p 3000:3000 --name my-app my-app:prod</pre><p>Your application is now running — without ever pulling from a registry.</p><h4>Handling Multiple Images</h4><p>If your stack includes multiple services (e.g., app, Redis, PostgreSQL), you can bundle them together:</p><pre>docker save -o stack.tar app:prod redis:7 postgres:15<br>docker load -i stack.tar</pre><p>This simplifies distribution and ensures consistency across environments.</p><h3>Why This Approach Matters</h3><p>This method provides several advantages:</p><ul><li><strong>Eliminates registry dependency</strong><br> No reliance on Docker Hub or private registries during deployment</li><li><strong>Supports offline environments</strong><br> Ideal for air-gapped systems and secure infrastructures</li><li><strong>Faster deployments</strong><br> No repeated image pulls over the network</li><li><strong>Full control over distribution</strong><br> Especially useful for SaaS delivery and client deployments</li></ul><h3>Practical Recommendation</h3><p>Always version your exported images:</p><pre>my-app-v1.0.0.tar</pre><p>This allows:</p><ul><li>Reliable rollbacks</li><li>Clear release tracking</li><li>Consistent deployments across environments</li></ul><p>Note: use docker compose to control production apps.</p><h3>Final Thoughts</h3><p>If you’re building serious production systems, your deployment pipeline should not depend on external services being available at the right time.</p><p>Shipping Docker images as portable artifacts gives you:</p><ul><li>Independence</li><li>Predictability</li><li>Control</li></ul><p>It’s a simple shift — but one that significantly improves the robustness of your deployment strategy.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17c648b28cba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic Custom Domain SSL in SaaS]]></title>
            <link>https://medium.com/@nurulislamrimon/dynamic-custom-domain-ssl-in-saas-f4d868ca1ce1?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4d868ca1ce1</guid>
            <category><![CDATA[saas-tools]]></category>
            <category><![CDATA[ssl-certificate]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[backend-engineering]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Wed, 08 Apr 2026 16:39:30 GMT</pubDate>
            <atom:updated>2026-04-08T16:39:30.554Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x_3aBzZWN_a8GisVol7mcQ.png" /></figure><h4>A Production-Ready Guide with Cloudflare Custom Hostnames</h4><p>Custom domains are a standard expectation in modern SaaS platforms. Users want to connect their own domains and have everything — routing, SSL, and performance — work instantly.</p><p>However, implementing this correctly is not trivial.</p><p>Many teams start with:</p><ul><li>Let’s Encrypt per domain</li><li>Manual DNS handling</li><li>Nginx reconfiguration</li></ul><p>This works initially — but quickly becomes a scaling and reliability problem.</p><p>This guide presents a <strong>production-grade approach</strong> using <strong>Cloudflare Custom Hostnames</strong>, including credential setup, backend integration, and system design.</p><h3>The Real Problem with Traditional SSL</h3><p>A typical setup involves:</p><ul><li>Generating SSL certificates per domain</li><li>Renewing certificates every 60–90 days</li><li>Reloading Nginx after each change</li><li>Maintaining per-domain configuration</li></ul><p>At scale, this leads to:</p><ul><li>Operational overhead</li><li>Increased failure points</li><li>Difficult debugging</li><li>Downtime risks</li></ul><p>For SaaS platforms handling hundreds or thousands of domains, this model is not sustainable.</p><h3>The Cloudflare Approach</h3><p>Cloudflare provides a different model:</p><blockquote><em>You delegate SSL management entirely to Cloudflare.</em></blockquote><p>Using <strong>Custom Hostnames</strong>, Cloudflare handles:</p><ul><li>Certificate issuance</li><li>Private key generation</li><li>Renewal</li><li>Edge deployment</li></ul><p>Your backend simply interacts via API.</p><h3>Architecture Overview</h3><pre>User Domain → Cloudflare (Custom Hostnames) → Your Backend</pre><ul><li>Users point their domain to your platform</li><li>Your backend registers the domain</li><li>Cloudflare validates and provisions SSL</li><li>Traffic is served securely without server changes</li></ul><h3>Required Credentials</h3><p>Before implementation, you need two Cloudflare credentials:</p><pre>CLOUDFLARE_DOMAIN_TOKEN=<br>CLOUDFLARE_ZONE_ID=</pre><h3>1. API Token (CLOUDFLARE_DOMAIN_TOKEN)</h3><p>This token allows your backend to interact with Cloudflare.</p><h4>Steps to generate:</h4><ol><li>Go to: <a href="https://dash.cloudflare.com/profile/api-tokens">https://dash.cloudflare.com/profile/api-tokens</a></li><li>Click <strong>Create Token</strong></li><li>Use template: <strong>Edit zone DNS</strong></li><li>Modify permissions:</li></ol><p><strong>Required Permissions:</strong></p><ul><li>Zone → DNS → Edit</li><li>Zone → Zone → Read</li><li>Zone → SSL and Certificates → Edit <em>(required for custom hostnames)</em></li></ul><p><strong>Zone Resources:</strong></p><ul><li>Include → Specific zone → your domain</li></ul><ol><li>Create and copy the token</li></ol><h3>2. Zone ID (CLOUDFLARE_ZONE_ID)</h3><p>The Zone ID uniquely identifies your domain.</p><h4>Steps:</h4><ol><li>Open Cloudflare dashboard</li><li>Select your domain</li><li>Locate <strong>Zone ID</strong> in the sidebar</li></ol><h3>How These Are Used</h3><pre>Authorization: `Bearer ${envConfig.cloudflare_domain_token}`</pre><pre>`${API}/zones/${ZONE_ID}/custom_hostnames`</pre><ul><li>Token → authentication</li><li>Zone ID → target domain</li></ul><h3>Domain Onboarding Flow</h3><ol><li>User submits domain (example.com)</li><li>Backend creates a custom hostname</li><li>Cloudflare begins validation</li><li>User configures DNS</li><li>SSL is issued automatically</li><li>Domain becomes active</li></ol><h3>Implementation (NestJS Service)</h3><h3>Create Custom Hostname</h3><pre>async createCustomHostname(<br>  hostname: string,<br>): Promise&lt;CloudflareCustomHostname&gt; {<br>  const res = await firstValueFrom(<br>    this.http.post&lt;CloudflareApiResponse&lt;CloudflareCustomHostname&gt;&gt;(<br>      `${this.API}/zones/${this.ZONE_ID}/custom_hostnames`,<br>      {<br>        hostname,<br>        ssl: {<br>          method: &#39;http&#39;,<br>          type: &#39;dv&#39;,<br>          settings: { http2: &#39;on&#39; },<br>        },<br>      },<br>      { headers: this.headers },<br>    ),<br>  );<br>  return res.data.result;<br>}</pre><p>This triggers:</p><ul><li>Domain onboarding</li><li>SSL provisioning</li><li>Validation process</li></ul><h3>Check Domain Status</h3><pre>async getCustomHostname(id: string): Promise&lt;CloudflareCustomHostname&gt; {<br>  const res = await firstValueFrom(<br>    this.http.get&lt;CloudflareApiResponse&lt;CloudflareCustomHostname&gt;&gt;(<br>      `${this.API}/zones/${this.ZONE_ID}/custom_hostnames/${id}`,<br>      { headers: this.headers },<br>    ),<br>  );<br>  return res.data.result;<br>}</pre><h3>Status Types</h3><pre>type CloudflareHostnameStatus =<br>  | &#39;pending&#39;<br>  | &#39;active&#39;<br>  | &#39;deleted&#39;<br>  | &#39;blocked&#39;<br>  | &#39;initializing&#39;<br>  | &#39;pending_validation&#39;;</pre><h3>Update SSL Settings</h3><pre>async updateSsl(id: string, settings: { http2?: &#39;on&#39; | &#39;off&#39; }) {<br>  const res = await firstValueFrom(<br>    this.http.patch&lt;CloudflareApiResponse&lt;CloudflareCustomHostname&gt;&gt;(<br>      `${this.API}/zones/${this.ZONE_ID}/custom_hostnames/${id}`,<br>      { ssl: { settings } },<br>      { headers: this.headers },<br>    ),<br>  );<br>  return res.data.result;<br>}</pre><h3>Retrieve by Hostname</h3><pre>async getByHostname(hostname: string) {<br>  const res = await firstValueFrom(<br>    this.http.get&lt;CloudflareApiResponse&lt;CloudflareCustomHostname[]&gt;&gt;(<br>      `${this.API}/zones/${this.ZONE_ID}/custom_hostnames?hostname=${hostname}`,<br>      { headers: this.headers },<br>    ),<br>  );<br>  return res.data.result?.[0] ?? null;<br>}</pre><h3>Delete Hostname</h3><pre>async deleteCustomHostname(id: string): Promise&lt;void&gt; {<br>  await firstValueFrom(<br>    this.http.delete(<br>      `${this.API}/zones/${this.ZONE_ID}/custom_hostnames/${id}`,<br>      { headers: this.headers },<br>    ),<br>  );<br>}</pre><h3>Error Handling</h3><pre>private handleError(err: unknown): InternalServerErrorException {<br>  if (typeof err === &#39;object&#39; &amp;&amp; err !== null &amp;&amp; &#39;response&#39; in err) {<br>    const response = (<br>      err as {<br>        response?: { data?: { errors?: { message: string }[] } };<br>      }<br>    ).response;<br>    const message = response?.data?.errors?.[0]?.message;<br>      if (message) {<br>        return new InternalServerErrorException(message);<br>      }<br>    }<br>    return new InternalServerErrorException(&#39;Cloudflare request failed&#39;);<br>}</pre><h3>SSL Key Management (Important Concept)</h3><p>Unlike traditional setups, you do <strong>not</strong> generate or manage SSL keys.</p><p>With:</p><pre>ssl: {<br>  method: &#39;http&#39;,<br>  type: &#39;dv&#39;,<br>}</pre><p>Cloudflare automatically handles:</p><ul><li>Private key generation</li><li>Certificate issuance</li><li>Renewal</li><li>Secure edge delivery</li></ul><p>Manual key management is only required for custom certificates (type: &#39;custom&#39;), which is uncommon in standard SaaS setups.</p><h3>Recommended System Design</h3><h4>Asynchronous Processing</h4><p>Use a queue (e.g., BullMQ) for:</p><ul><li>Domain creation</li><li>Status polling</li><li>Retry logic</li></ul><h3>Domain Lifecycle</h3><pre>pending → validating → active → failed</pre><p>Persist and sync status with Cloudflare.</p><h3>DNS Instructions</h3><p>Guide users clearly:</p><ul><li>CNAME → your platform domain</li><li>Or follow Cloudflare validation records</li></ul><h3>Idempotency</h3><p>Before creating:</p><ul><li>Check existing hostname</li><li>Avoid duplicate API calls</li></ul><h3>Security</h3><ul><li>Validate domain format</li><li>Restrict API token permissions</li><li>Never expose credentials client-side</li></ul><h3>Operational Advantages</h3><p>This approach provides:</p><ul><li>Scalable domain onboarding</li><li>Zero SSL maintenance</li><li>Reduced infrastructure complexity</li><li>Faster user activation</li></ul><h3>Conclusion</h3><p>Dynamic custom domain support is a foundational part of SaaS infrastructure. Implementing it with manual SSL management introduces long-term complexity and operational risk.</p><p>By leveraging Cloudflare Custom Hostnames, you adopt a system that is:</p><ul><li>Automated</li><li>Scalable</li><li>Reliable</li></ul><p>This allows your platform to grow without being constrained by infrastructure limitations.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4d868ca1ce1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NestJS Error Handling Is Messy — Until You Add a Global Exception Handler]]></title>
            <link>https://medium.com/@nurulislamrimon/nestjs-error-handling-is-messy-until-you-add-a-global-exception-handler-6a9586893d4d?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a9586893d4d</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Sat, 14 Mar 2026 07:58:22 GMT</pubDate>
            <atom:updated>2026-03-14T08:01:56.254Z</atom:updated>
            <content:encoded><![CDATA[<h4>Bring Consistency and Control to Error Handling in NestJS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBccJeH3OEHFUaXh4WIfBQ.png" /></figure><p>If you’ve built a serious backend with <strong>NestJS</strong>, you’ve probably faced this problem.</p><p>Error handling slowly starts spreading everywhere.</p><p>Controllers.</p><p>Services.</p><p>Interceptors.</p><p>Sometimes even utilities.</p><p>At first it looks harmless:</p><pre>try {<br>  await this.userService.createUser(dto)<br>} catch (error) {<br>  throw new InternalServerErrorException()<br>}</pre><p>But after a few months of development, your codebase starts looking like this everywhere.</p><p>Now debugging becomes harder.</p><p>Error responses become inconsistent.</p><p>And controllers start handling things they shouldn’t.</p><p>This is exactly the situation where <strong>a global exception handler becomes essential</strong>.</p><h3>The Real Developer Problem</h3><p>Most developers don’t struggle with writing exceptions.</p><p>They struggle with <strong>maintaining consistency across a growing codebase</strong>.</p><p>Consider what happens in a typical project.</p><p>One endpoint returns:</p><pre>{<br>  &quot;message&quot;: &quot;User not found&quot;<br>}</pre><p>Another endpoint returns:</p><pre>{<br>  &quot;statusCode&quot;: 400,<br>  &quot;message&quot;: [&quot;email must be valid&quot;]<br>}</pre><p>Another one returns:</p><pre>{<br>  &quot;error&quot;: &quot;Something went wrong&quot;<br>}</pre><p>From a developer perspective, this creates multiple problems:</p><ul><li>Frontend developers must handle different response formats</li><li>Logging becomes inconsistent</li><li>Debugging production issues becomes slower</li><li>Controllers become cluttered with defensive code</li></ul><p>This is where a <strong>global exception handler simplifies everything</strong>.</p><h3>Introducing nestjs-exception-handler</h3><p>nestjs-exception-handler is a <strong>global exception handler designed specifically for NestJS applications</strong>.</p><p>The goal is simple:</p><blockquote><em>Let developers focus on business logic, not error formatting.</em></blockquote><p>Instead of manually shaping error responses across the application, everything flows through a <strong>centralized exception layer</strong>.</p><p>You can check the package here:</p><p><a href="https://www.npmjs.com/package/nestjs-exception-handler">https://www.npmjs.com/package/nestjs-exception-handler</a></p><h3>What Changes for Developers</h3><p>The biggest improvement is <strong>how clean your code becomes</strong>.</p><p>Without centralized exception handling, developers often write defensive code like this:</p><pre>try {<br>  const user = await this.userService.find(id)<br>  return user<br>} catch (error) {<br>  throw new NotFoundException()<br>}</pre><p>With a global exception handler, your controller becomes much simpler:</p><pre>return this.userService.find(id)</pre><p>If something fails, the exception handler automatically formats the response.</p><p>Controllers stay focused on <strong>business logic instead of infrastructure concerns</strong>.</p><h3>Consistent Error Responses</h3><p>One of the most useful things for developers is <strong>predictable API responses</strong>.</p><p>With a global handler, every error follows the same format:</p><pre>{<br>  &quot;errors&quot;: [<br>    {<br>      &quot;code&quot;: &quot;USER_NOT_FOUND&quot;,<br>      &quot;message&quot;: &quot;User does not exist&quot;<br>    }<br>  ]<br>}</pre><p>This small change has a big impact:</p><ul><li>Frontend integration becomes easier</li><li>Logging becomes more structured</li><li>Monitoring tools become more useful</li></ul><p>Consistency saves developers a lot of time.</p><h3>Easier Debugging in Production</h3><p>When errors happen in production, developers want <strong>clear signals</strong>, not chaos.</p><p>A centralized exception handler ensures:</p><ul><li>predictable error structures</li><li>controlled error messages</li><li>no accidental stack trace leaks</li></ul><p>This improves both <strong>security and observability</strong>.</p><h3>Simple Setup</h3><p>The package is intentionally lightweight.</p><p>Installation:</p><pre>npm install nestjs-exception-handler</pre><p>Register the module:</p><pre>import { ExceptionHandlingModule } from &#39;nestjs-exception-handler&#39;<br><br>@Module({<br>  imports: [<br>    ExceptionHandlingModule.forRoot(&#39;http&#39;)<br>  ],<br>})<br>export class AppModule {}</pre><p>That’s it.</p><p>Your application now has a <strong>global exception handling system</strong>.</p><h3>Why This Matters in Real Projects</h3><p>Small demo projects rarely expose the pain of bad error handling.</p><p>But in real systems — especially those that grow over time — this becomes critical.</p><p>A global exception handler helps keep large codebases maintainable.</p><p>This is particularly useful when working with:</p><ul><li>large NestJS backends</li><li>SaaS platforms</li><li>microservices</li><li>multi-team projects</li></ul><p>In these environments, <strong>consistency is not optional — it’s essential</strong>.</p><h3>Final Thoughts</h3><p>Error handling is one of those things developers often postpone until the project grows.</p><p>But once the codebase becomes large, fixing inconsistent error handling becomes painful.</p><p>A global exception handler solves this early by introducing <strong>structure and consistency</strong>.</p><p>nestjs-exception-handler aims to provide a simple way for NestJS developers to achieve exactly that.</p><p>If you’re building backend systems with NestJS, it’s worth taking a look.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a9586893d4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Got Tired of Rewriting the Same Query Logic in NestJS — So I Built This]]></title>
            <link>https://medium.com/codetodeploy/nesti-got-tired-of-rewriting-the-same-query-logic-in-nestjs-so-i-built-this-da01328b3345?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/da01328b3345</guid>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[nestjs-query]]></category>
            <category><![CDATA[smart-query-nestjs]]></category>
            <category><![CDATA[best-tool]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 09:05:33 GMT</pubDate>
            <atom:updated>2026-03-12T14:36:16.480Z</atom:updated>
            <content:encoded><![CDATA[<h4>Every backend developer eventually faces the same problem.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aumMCWknJUUXLiWIIz2KPg.png" /></figure><p>You start building a simple API.</p><p>Everything is clean.</p><p>Everything is beautiful.</p><blockquote>🔥 <strong>Top Tech Jobs Are Hiring NOW — Don’t Miss Out.</strong></blockquote><blockquote>🚀 <strong>Multiple Roles Available<br> </strong><a href="https://sme.careers/apply?referral=rp--d8299f"><strong>👉 Apply &amp; Secure Your Job</strong></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkQFf0NUnzoFbVEVQCF5WQ.png" /></figure><p>Then the product manager says:</p><blockquote><em>“We need search.”</em></blockquote><p>So you add search.</p><p>Then they say:</p><blockquote><em>“Users should be able to filter results.”</em></blockquote><p>Then:</p><blockquote><em>“Add pagination.”</em></blockquote><p>Then:</p><blockquote><em>“We also need sorting.”</em></blockquote><p>And suddenly your once-beautiful service looks like this:</p><pre>const { page, limit, searchTerm, sortBy, sortOrder, role } = req.query<br><br>const pageNumber = Number(page) || 1<br>const limitNumber = Number(limit) || 10<br>const skip = (pageNumber - 1) * limitNumber<br><br>const filters: any = {}<br><br>if (role) {<br>  filters.role = role<br>}<br><br>if (searchTerm) {<br>  filters.OR = [<br>    { name: { contains: searchTerm } },<br>    { email: { contains: searchTerm } }<br>  ]<br>}</pre><p>Now repeat that logic for:</p><ul><li>Users</li><li>Orders</li><li>Products</li><li>Categories</li><li>Transactions</li><li>Logs</li></ul><p>Suddenly your backend is <strong>70% query parsing logic</strong>.</p><p>Not business logic.</p><p>Just <strong>plumbing</strong>.</p><p>I ran into this problem so many times that I decided to build a solution.</p><h3>Meet Smart Query for NestJS</h3><pre>npm i smart-query-nestjs</pre><p>A small but powerful library that automatically handles:</p><ul><li>Searching</li><li>Filtering</li><li>Pagination</li><li>Sorting</li></ul><p>For your <strong>NestJS APIs</strong>.</p><p>Package:</p><p><a href="https://www.npmjs.com/package/smart-query-nestjs">https://www.npmjs.com/package/smart-query-nestjs</a></p><p>The goal is simple:</p><blockquote><em>Turn messy query parameters into a clean structured query object.</em></blockquote><h3>The Problem With Most Backend APIs</h3><p>Typical REST endpoints start simple:</p><pre>GET /users</pre><p>Then they evolve into monsters like this:</p><pre>GET /users?page=2&amp;limit=10<br>GET /users?searchTerm=john<br>GET /users?role=admin<br>GET /users?sortBy=createdAt&amp;sortOrder=desc</pre><p>Now your backend has to:</p><ul><li>Parse query parameters</li><li>Validate them</li><li>Convert types</li><li>Build filter objects</li><li>Apply pagination</li><li>Apply sorting</li></ul><p>Every developer eventually writes <strong>the same 200 lines of code</strong>.</p><p>Again.</p><p>And again.</p><p>And again.</p><h3>What Smart Query Does</h3><p>Smart Query automatically converts request query parameters into a <strong>structured query object</strong> your service can directly use.</p><p>Instead of manually parsing everything…</p><p>Your controller becomes extremely clean.</p><h3>Example</h3><h4>Controller</h4><pre>@Get()<br>@UseInterceptors(SmartQueryInterceptor)<br>async getUsers(@Req() req: Request) {<br>  return this.userService.findAll(req.smartQuery)<br>}</pre><p>That’s it.</p><p>No query parsing.</p><p>No pagination math.</p><p>No filter building.</p><h3>What the Service Receives</h3><p>Your service now receives something like this:</p><pre>{<br>  filters: {<br>    role: &quot;admin&quot;<br>  },<br>  searchTerm: &quot;john&quot;,<br>  pagination: {<br>    page: 1,<br>    limit: 10,<br>    skip: 0<br>  },<br>  sort: {<br>    sortBy: &quot;createdAt&quot;,<br>    sortOrder: &quot;desc&quot;<br>  }<br>}</pre><p>Everything is already <strong>clean, typed, and structured</strong>.</p><h3>Supported Query Features</h3><h4>Search</h4><pre>/users?searchTerm=john</pre><p>Search across defined fields.</p><h3>Filtering</h3><pre>/users?role=admin<br>/users?age=25<br>/users?isActive=true</pre><p>Supports multiple types:</p><ul><li>string</li><li>number</li><li>boolean</li><li>date</li></ul><h4>Pagination</h4><pre>/users?page=2&amp;limit=10</pre><p>Smart Query automatically calculates:</p><pre>skip = (page - 1) * limit</pre><p>Sorting</p><pre>/users?sortBy=createdAt&amp;sortOrder=desc</pre><h3>Works With Any ORM</h3><p>Smart Query is <strong>ORM-agnostic</strong>.</p><p>You can use it with:</p><ul><li>Prisma</li><li>Mongoose</li><li>TypeORM</li><li>Sequelize</li><li>Raw SQL</li></ul><p>Your service simply maps the structured query to your database query.</p><h3>Why I Built This</h3><p>After building several backend systems, I noticed something frustrating.</p><p>The same pattern kept repeating:</p><p>Search logic.<br> Filter logic.<br> Pagination logic.<br> Sorting logic.</p><p>Every project had it.</p><p>Every module had it.</p><p>Every developer rewrote it.</p><p>So I extracted that pattern into a reusable NestJS package.</p><h3>The Result</h3><p><strong>smart-query-nestjs</strong></p><p>A small utility that removes a <strong>huge amount of repetitive backend code</strong>.</p><p>It keeps your controllers clean and lets you focus on what actually matters:</p><p>Your application logic.</p><h4>Installation</h4><pre>npm i smart-query-nestjs</pre><p>Explore the package:</p><p><a href="https://www.npmjs.com/package/smart-query-nestjs">smart-query-nestjs</a></p><h3>Final Thoughts</h3><p>Backend frameworks should help us <strong>move faster</strong>, not repeat ourselves.</p><p>If you’re building APIs with <strong>NestJS</strong>, Smart Query can eliminate hundreds of lines of repetitive code.</p><p>Sometimes the best developer tools are the ones that simply remove friction.</p><p>And that’s exactly what Smart Query does.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da01328b3345" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/nesti-got-tired-of-rewriting-the-same-query-logic-in-nestjs-so-i-built-this-da01328b3345">I Got Tired of Rewriting the Same Query Logic in NestJS — So I Built This</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Writing S3 Boilerplate in NestJS, Use This Instead]]></title>
            <link>https://medium.com/codetodeploy/stop-writing-s3-boilerplate-in-nestjs-use-this-instead-bf79046f404d?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf79046f404d</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 09:06:33 GMT</pubDate>
            <atom:updated>2026-06-28T13:00:43.600Z</atom:updated>
            <content:encoded><![CDATA[<h4>A simple NestJS module that makes Cloudflare R2 uploads clean, injectable, and production-ready.</h4><figure><img alt="How to Upload Files to Cloudflare R2 in NestJS (Clean Architecture Approach)" src="https://cdn-images-1.medium.com/max/1024/1*c71NATjryJHHzKF3L1-D1w.jpeg" /></figure><p>You need to upload files.</p><p>Maybe it’s:</p><ul><li>user avatars</li><li>product images</li><li>invoices</li><li>documents</li><li>media files</li></ul><p>At first it sounds simple.</p><p>Then you start implementing it.</p><p>And suddenly you’re dealing with:</p><ul><li>multer</li><li>S3 configuration</li><li>credentials</li><li>bucket permissions</li><li>upload logic</li><li>file streams</li><li>error handling</li></ul><p>What should be a <strong>10-line feature turns into a 200-line mess</strong>.</p><p>If you’re using <strong>NestJS</strong>, this feels even worse because NestJS encourages <strong>clean architecture and dependency injection</strong>.</p><p>But S3 integrations usually end up looking like this everywhere in your codebase:</p><pre>const client = new S3Client({<br>  endpoint: &#39;https://xxxx.r2.cloudflarestorage.com&#39;,<br>  credentials: {<br>    accessKeyId: process.env.ACCESS_KEY,<br>    secretAccessKey: process.env.SECRET_KEY,<br>  },<br>});</pre><p>Then every service starts duplicating upload logic.</p><p>At some point I thought:</p><blockquote><em>“Why doesn’t NestJS have a clean storage module for Cloudflare R2?”</em></blockquote><p>So I built one.</p><h3>Introducing nestjs-r2-storage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NElBBxpoRHKeumliAqimMg.gif" /></figure><p>nestjs-r2-storage is a <strong>simple NestJS module for uploading files to Cloudflare R2</strong>.</p><p>It follows <strong>NestJS best practices</strong>:</p><p>✔ Dependency Injection<br> ✔ Modular architecture<br> ✔ Clean service layer<br> ✔ Minimal configuration</p><p>Instead of managing storage clients manually, you just <strong>inject a service and upload files</strong>.</p><h3>Why Cloudflare R2?</h3><p>Before we dive into the package, let’s talk about <strong>R2</strong>.</p><p>Cloudflare R2 is an <strong>object storage service compatible with S3 APIs</strong>, but it fixes one of the biggest pain points of AWS S3.</p><h3>The problem with S3</h3><p>S3 charges <strong>egress fees</strong>.</p><p>That means every time a user downloads a file from your storage, you pay.</p><p>For SaaS platforms or apps serving many images, this becomes expensive very quickly.</p><h3>What makes R2 different</h3><p>Cloudflare R2 offers:</p><ul><li><strong>Zero egress fees</strong></li><li>S3-compatible API</li><li>Global edge integration</li><li>Great performance</li><li>Lower cost for startups</li></ul><p>This is why many modern apps are migrating from S3 to R2.</p><h3>Installing the Package</h3><p>Installation is simple.</p><pre>npm install nestjs-r2-storage</pre><h3>Configuring the Module</h3><p>Now register the module in your NestJS application.</p><pre>// app.module.ts<br>import { Module } from &quot;@nestjs/common&quot;;<br>import { R2StorageModule } from &quot;nestjs-r2-storage&quot;;<br><br>@Module({<br>  imports: [<br>    R2StorageModule.forRoot({<br>      endpoint: process.env.R2_ENDPOINT,<br>      accessKeyId: process.env.R2_ACCESS_KEY,<br>      secretAccessKey: process.env.R2_SECRET_KEY,<br>      bucketName: process.env.R2_BUCKET,<br>      region: &quot;auto&quot;,<br>      publicUrlBase: `https://${process.env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com/${process.env.R2_BUCKET}`,<br>      signedUrlExpiry: 3600,<br>    }),<br>  ],<br>})<br>export class AppModule {}</pre><p>That’s it.</p><p>Your storage service is now <strong>globally available through dependency injection</strong>.</p><h3>Uploading Files</h3><p>Now let’s upload a file using the service.</p><pre>import { Injectable } from &quot;@nestjs/common&quot;;<br>import {<br>  PhotoManagerService,<br>  PhotoField,<br>  CloudflareService,<br>} from &quot;nestjs-r2-storage&quot;;<br><br>@Injectable()<br>export class ProductService {<br>  constructor(<br>    private readonly photoManager: PhotoManagerService,<br>    private readonly cloudflare: CloudflareService,<br>  ) {}<br><br>  async createProduct(payload: any) {<br>    const photoFields: PhotoField[] = [      { field: &quot;image&quot;, urlField: &quot;image_url&quot;, sizeField: &quot;image_size&quot; },      {        field: &quot;gallery[].photo&quot;,        urlField: &quot;photo_url&quot;,        sizeField: &quot;photo_size&quot;,      },    ];<br><br>    const result = await this.photoManager.createObjectWithPhotos(<br>      payload,<br>      photoFields,<br>    );<br><br>    // Return upload URLs to client for direct upload<br>    return {<br>      product: result.updatedPayload,<br>      uploadUrls: result.uploadUrls,<br>      totalStorageUsed: result.totalStorageUsed,<br>    };<br>  }<br><br>  async getProduct(id: string) {<br>    const product = await this.findProduct(id);<br><br>    const photoFields: PhotoField[] = [      { field: &quot;image&quot;, urlField: &quot;image_url&quot; },      { field: &quot;gallery[].photo&quot;, urlField: &quot;photo_url&quot; },    ];<br><br>    return this.photoManager.appendPhotoUrls(product, photoFields);<br>  }<br><br>  async updateProduct(id: string, payload: any) {<br>    const existing = await this.findProduct(id);<br><br>    const photoFields: PhotoField[] = [      { field: &quot;image&quot;, urlField: &quot;image_url&quot;, sizeField: &quot;image_size&quot; },    ];<br><br>    const result = await this.photoManager.updateObjectWithPhotos(<br>      payload,<br>      existing,<br>      photoFields,<br>    );<br><br>    return {<br>      product: result.updatedPayload,<br>      uploadUrls: result.uploadUrls,<br>      storageIncrease: result.storageIncrease,<br>      storageDecrease: result.storageDecrease,<br>    };<br>  }<br><br>  async deleteProduct(id: string) {<br>    const product = await this.findProduct(id);<br><br>    const photoFields: PhotoField[] = [      { field: &quot;image&quot;, urlField: &quot;image_url&quot; },    ];<br><br>    await this.photoManager.deletePhotosFromObject(product, photoFields);<br>    await this.removeProduct(id);<br>  }<br>}</pre><p>No client setup.</p><p>No configuration logic.</p><p>Just <strong>clean NestJS service code</strong>.</p><h3>Cloudflare Service</h3><p>Direct R2 operations.</p><pre>// Generate upload URL<br>const uploadUrl = await cloudflare.getUploadUrl(&quot;avatar.png&quot;, 1024000);<br><br>// Generate download URL<br>const downloadUrl = await cloudflare.getDownloadUrl(&quot;uploads/avatar_123.png&quot;);<br><br>// Delete file<br>await cloudflare.deleteFile(&quot;uploads/avatar.png&quot;);<br><br>// Check if file exists<br>const exists = await cloudflare.fileExists(&quot;uploads/avatar.png&quot;);</pre><h3>Why I Built This Package</h3><p>Most storage libraries are designed for <strong>Express or plain Node.js</strong>.</p><p>They don’t integrate well with NestJS.</p><p>So developers often end up writing:</p><ul><li>custom wrappers</li><li>helper utilities</li><li>repeated upload logic</li><li>poorly structured services</li></ul><p>This package removes all that friction.</p><p>It turns file storage into something that feels <strong>native to NestJS</strong>.</p><h3>Perfect For These Projects</h3><p>nestjs-r2-storage works great for:</p><ul><li>SaaS platforms</li><li>E-commerce APIs</li><li>media upload services</li><li>document storage systems</li><li>profile image hosting</li><li>CMS platforms</li></ul><p>Basically <strong>any NestJS backend that needs file uploads</strong>.</p><h3>Final Thoughts</h3><p>Good frameworks should <strong>reduce complexity</strong>, not increase it.</p><p>NestJS already gives us an amazing architecture for building scalable APIs.</p><p>File storage shouldn’t break that architecture.</p><p>nestjs-r2-storage keeps things <strong>simple, modular, and clean</strong>.</p><p>If you’re building a NestJS backend that needs file uploads, give it a try.</p><pre>npm install nestjs-r2-storage</pre><p>⭐ If you enjoy the package, consider starring the project and sharing it with other NestJS developers.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf79046f404d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/stop-writing-s3-boilerplate-in-nestjs-use-this-instead-bf79046f404d">Stop Writing S3 Boilerplate in NestJS, Use This Instead</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nginx + Docker + Let’s Encrypt: A Battle-Tested Reverse Proxy Architecture]]></title>
            <link>https://blog.devops.dev/nginx-docker-lets-encrypt-a-battle-tested-reverse-proxy-architecture-91d8e9ed7f9d?source=rss-2e9387733e30------2</link>
            <guid isPermaLink="false">https://medium.com/p/91d8e9ed7f9d</guid>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Nurul Islam Rimon]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 09:52:02 GMT</pubDate>
            <atom:updated>2026-07-29T13:47:43.639Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RhqiacA69l9yYNCTXZtBrQ.jpeg" /><figcaption>Nginx + Docker + Let’s Encrypt: A Battle-Tested Reverse Proxy Architecture</figcaption></figure><h4>After debugging crash loops, broken SSL, and Docker networking issues, here’s the clean reverse-proxy setup I’d actually trust in production.</h4><p>If you search for:</p><blockquote><em>A real-world guide based on actual debugging, not copy-paste tutorials.</em></blockquote><p>you’ll find <strong>hundreds</strong> of tutorials — and most of them:</p><ul><li>mix app + proxy in one compose file</li><li>break SSL renewal</li><li>crash nginx on startup</li><li>or magically “work” without explaining <em>why</em></li></ul><p>This article documents a <strong>clean, production-grade approach</strong>:</p><ul><li>Reverse proxy isolated from the app</li><li>Docker networking done properly</li><li>Let’s Encrypt SSL without race conditions</li><li>Zero hacks, zero guesswork</li></ul><p>Everything here was <strong>tested, broken, fixed, and verified</strong>.</p><pre>Internet<br>   ↓<br>VPS (Ports 80 / 443)<br>   ↓<br>Nginx Reverse Proxy (Docker)<br>   ↓<br>Docker Bridge Network<br>   ↓<br>Application Container (separate stack)</pre><h3>Key principles:</h3><ul><li>App is NOT exposed publicly</li><li>App is NOT included in proxy compose</li><li><strong>Proxy is reusable for multiple apps</strong></li><li><strong>SSL is automatic and renewable</strong></li></ul><h4>Directory Structure</h4><pre>/home/proxy<br>├── docker-compose.yml<br>├── nginx<br>│   └── conf.d<br>│       └── appname.conf<br>├── certbot<br>│   └── www<br>└── certs</pre><h4>Step 1: Create a Shared Docker Network</h4><p>This allows <strong>multiple stacks</strong> to communicate safely.</p><pre>docker network create proxy</pre><h4>Step 2: Proxy Stack (Nginx + Certbot)</h4><p><em>docker-compose.yml</em></p><pre>services:<br>  nginx:<br>    image: nginx:alpine<br>    container_name: main-nginx-proxy<br>    restart: always<br>    ports:<br>      - &quot;80:80&quot;<br>      - &quot;443:443&quot;<br>    volumes:<br>      - ./nginx/conf.d:/etc/nginx/conf.d:ro<br>      - ./certbot/www:/var/www/certbot<br>      - ./certs:/etc/letsencrypt<br>    networks:<br>      - proxy<br><br>  certbot:<br>    image: certbot/certbot<br>    container_name: certbot<br>    volumes:<br>      - ./certbot/www:/var/www/certbot<br>      - ./certs:/etc/letsencrypt<br>    entrypoint: &gt;<br>      sh -c &quot;trap exit TERM;<br>             while :; do<br>               certbot renew --webroot -w /var/www/certbot;<br>               sleep 12h &amp; wait $${!};<br>             done&quot;<br>    networks:<br>      - proxy<br><br>networks:<br>  proxy:<br>    external: true</pre><h4>📌Important design choice</h4><p>Certbot container is <strong>renewal-only</strong>. Initial certificate issuance is done manually (once).</p><h4>Step 3: App Stack (Separate, Isolated)</h4><p>Your application runs in its <strong>own compose file</strong>:</p><pre>services:<br>  appname:<br>    image: app-image-name<br>    container_name: appname<br>    restart: always<br>    expose:<br>      - &quot;3000&quot;<br>    networks:<br>      - proxy<br><br>networks:<br>  proxy:<br>    external: true</pre><p><em>App has </em><strong><em>no public ports</em></strong></p><p><em>Only accessible via Nginx</em></p><h4>Step 4: HTTP-Only Nginx Config (Critical)</h4><p>Before SSL, Nginx <strong>must run on HTTP only</strong>.</p><p><em>nginx/conf.d/appname.conf</em></p><pre>server {<br>  listen 80;<br>  server_name yourdomain.com www.yourdomain.com;<br><br>  location /.well-known/acme-challenge/ {<br>    root /var/www/certbot;<br>  }<br><br>  location / {<br>    proxy_pass http://appname:3000;<br>    proxy_set_header Host $host;<br>    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>    proxy_set_header X-Forwarded-Proto $scheme;<br>  }<br>}</pre><p><em>Enabling HTTPS </em><strong><em>before certificates exist</em></strong><em> will crash Nginx.</em></p><h4>Step 5: Start the Stack</h4><pre>docker compose up -d</pre><p>Verify:</p><pre>curl http://yourdomain.com</pre><p>NOTE: If HTTP doesn’t work — <strong>stop here</strong>.</p><h4>Step 6: Issue SSL Certificate (One-Time)</h4><p>Run this <strong>command (your domain and email should be replaced)</strong>:</p><pre>docker run --rm -v /home/proxy/certs:/etc/letsencrypt -v /home/proxy/certbot/www:/var/www/certbot certbot/certbot certonly --webroot --webroot-path=/var/www/certbot -d yourdomain.com -d www.yourdomain.com --email yourmail@gmail.com --agree-tos --no-eff-email</pre><p>If it doesn’t work, then:</p><pre>docker exec -it certbot certbot certonly --webroot --webroot-path=/var/www/certbot -d yourdomain.com -d www.yourdomain.com --email yourmail@gmail.com --agree-tos --no-eff-email</pre><p>Verify:</p><pre>ls /home/proxy/certs/live/yourdomain.com</pre><p>You should see:</p><pre>fullchain.pem<br>privkey.pem</pre><h4>Step 7: Enable HTTPS (Final Config)</h4><pre>server {<br>  listen 80;<br>  server_name yourdomain.com www.yourdomain.com;<br><br>  location /.well-known/acme-challenge/ {<br>    root /var/www/certbot;<br>  }<br><br>  location / {<br>    return 301 https://$host$request_uri;<br>  }<br>}<br><br>server {<br>  listen 443 ssl http2;<br>  server_name yourdomain.com www.yourdomain.com;<br><br>  ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;<br>  ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;<br><br>  ssl_protocols TLSv1.2 TLSv1.3;<br><br>  location / {<br>    proxy_pass http://appname:3000;<br>    proxy_set_header Host $host;<br>    proxy_set_header X-Forwarded-Proto https;<br>    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>  }<br>}</pre><p>Reload safely:</p><pre>docker exec main-nginx-proxy nginx -s reload</pre><p>Final Verification</p><pre>curl https://yourdomain.com</pre><p>Congratulations! Hope you did it.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Code. Scale. Repeat.</strong></p><p>— Nurul Islam Rimon,</p><p>Fullstack Dev at <a href="http://expertsquad.net/">ExpertSquad.net</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91d8e9ed7f9d" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/nginx-docker-lets-encrypt-a-battle-tested-reverse-proxy-architecture-91d8e9ed7f9d">Nginx + Docker + Let’s Encrypt: A Battle-Tested Reverse Proxy Architecture</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>