<?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 Rushen Samodya on Medium]]></title>
        <description><![CDATA[Stories by Rushen Samodya on Medium]]></description>
        <link>https://medium.com/@rushenssamodya?source=rss-29c1a0896776------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tkefuX8BuywRn2FG6DemBg.png</url>
            <title>Stories by Rushen Samodya on Medium</title>
            <link>https://medium.com/@rushenssamodya?source=rss-29c1a0896776------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:18:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rushenssamodya/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[Database Replica vs Database Backup]]></title>
            <link>https://medium.com/@rushenssamodya/database-replica-vs-database-backup-db07ab17ca5d?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/db07ab17ca5d</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <category><![CDATA[backup]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Sun, 30 Aug 2026 04:21:15 GMT</pubDate>
            <atom:updated>2026-08-30T04:21:15.141Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5jbLRqesciJDQvZlCHiN_Q.png" /></figure><p>Database replications and database backups are two different functionalities. Often people think they are the same thing and screw up a lot of opportunities.</p><p>We usually keep 2 replicas of our database as a best practice. Basically we have 3 different databases running on 3 completely separate machines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*4sP6kUIhfnik2fvHaQlB1A.png" /></figure><p>The primary DB is connected with the other two DBs with a persistent connection. So, every change made to the primary database, the same change is copied to the replicas. So, that those two would be in sync with the primary database. The use case of that is, when the primary database crashes and fails, a replica can replace the primary database quickly so that users won’t notice there’s an issue and they would be able to smoothly run everything.</p><p>The problem arrives in this situation. What if, a developer mistakenly deletes 100,000 rows in the primary database or in this modern AI era, an AI agent could have done that. In such kind of a situation, you might think we can use the database replica. But the issue there is that, every single change which is done to the primary database, is replicated in the replicas as well. So, if 100,000 rows got deleted mistakenly, it would be replicated in the other tow replica DBs as well. So, we couldn’t replace the primary with them. Replication never protects data, it protects uptime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*03AKwAXGtHsxK_zl5eFK7Q.png" /></figure><p>Here’s where we get the use of a Database backup. We take a snapshot of our live database in particular time periods and then store it in a completely disconnected from your live system. Maybe in a blob storage, in an s3 bucket. So, incase of an emergency data loss, we can switch back to the backup and then start from there.</p><p>Source: KodeKloud</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db07ab17ca5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We Got a New HTTP Request Method Before GTA 6]]></title>
            <link>https://medium.com/@rushenssamodya/we-got-a-new-http-request-method-before-gta-6-33400da2271e?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/33400da2271e</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[dev]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 17:02:35 GMT</pubDate>
            <atom:updated>2026-07-23T17:02:35.038Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OSl_DZ6TN4LhFozXicxnPQ.png" /></figure><blockquote>Some things feel like they will never actually ship. GTA 6 is one of them. A brand-new HTTP method is another. HTTP, the language your browser uses to talk to websites, has been running on basically the same handful of verbs for over a decade. And yet, here we are in 2026, and the internet got something new before Rockstar handed us GTA 6.</blockquote><p>Meet QUERY, the newest official HTTP method. Let me explain what it is, why it matters, and why developers are quietly excited about it.</p><h3>First, what is an “HTTP method” anyway?</h3><p>Every time you open a website, your browser sends a request to a server. That request comes with a “method,” which is basically a verb that tells the server what you want to do.</p><p>You have probably heard of the two big ones:</p><ul><li>GET — “Give me this data.” Used when you read or fetch something, like loading a web page or a search result.</li><li>POST — “Here, take this data and do something with it.” Used when you submit a form, create an account, or make a payment.</li></ul><p>There are a few others (PUT, DELETE, PATCH), but GET and POST are the two everyone knows. And for years, they have quietly been causing a problem.</p><h3>The problem: GET and POST both fall short for search</h3><p>Say you are building a search feature. Something like an online store where people filter by brand, price, size, color, rating, and ten other things at once.</p><p>Naturally, you would reach for GET, because searching is just reading data. The trouble is that GET puts everything into the URL, the web address at the top of your browser. That works fine for something small like:</p><pre>GET /shoes?color=black&amp;size=42</pre><p>But when your search gets huge, with dozens of filters or a long list of IDs, the URL becomes a monster. And this is not just a hypothetical. Take a look at a real product URL from Daraz (a popular online store in Sri Lanka). This is a single link to <em>one</em> computer mouse:</p><pre>https://www.daraz.lk/products/mouse-logitech-mx-master-4-wl-1y-i1761565627-s12925393676.html?c=&amp;channelLpJumpArgs=&amp;clickTrackInfo=query%253Amouse%253Bnid%253A1761565627%253Bsrc%253ALazadaMainSrp%253Brn%253A3361ddabfa54a2929e04d7d0f3a31c3e%253Bregion%253Alk%253Bsku%253A1761565627_LK%253Bprice%253A79372%253Bclient%253Adesktop%253Bsupplier_id%253A1000298880030%253Bsession_id%253A%253Bbiz_source%253Ahttps%253A%252F%252Fwww.daraz.lk%252F%253Bslot%253A16%253Butlog_bucket_id%253A470687%253Basc_category_id%253A7848%253Bitem_id%253A1761565627%253Bsku_id%253A12925393676%253Bshop_id%253A366858%253BtemplateInfo%253A&amp;freeshipping=0&amp;fs_ab=1&amp;fuse_fs=&amp;lang=en&amp;location=Western&amp;price=79372&amp;...</pre><p>And that is the <em>shortened</em> version. The real thing goes on even longer. All that gibberish after the ? is data being crammed into the URL: search terms, prices, region, session info, tracking codes, and more. Now imagine a search page trying to stuff dozens of user-chosen filters in there too. It gets ugly fast.</p><p>Worse, browsers and servers have limits on how long a URL can be. Some cap out around 2,000 characters, others higher, but there is no universal rule. Cross that invisible line and your request just breaks.</p><p>So developers did the obvious workaround: they used POST instead, because POST lets you send data in the “body” of the request (a hidden space that has no size limit) instead of cramming it into the URL.</p><p>Problem solved? Not really.</p><h3>Why the POST workaround is a “small lie”</h3><p>Here is the catch. POST is meant for actions that <em>change</em> things, like creating or updating data. But a search does not change anything. It just reads.</p><p>When you use POST for a search, you are basically telling the whole internet, “Hey, this request might change something important!” even though it does not. And that little lie has real costs:</p><ul><li>No caching. Caching is when a system saves a copy of a result so it can serve it instantly next time instead of doing all the work again. It makes things fast. But systems refuse to cache POST requests because they assume something might have changed. So your identical searches get re-run from scratch, every single time.</li><li>No safe retries. If your connection drops mid-request, a system can safely re-send a GET (reading twice is harmless). But it will not automatically re-send a POST, because re-sending “charge my card” twice would be a disaster. So POST searches are treated as risky even when they are not.</li></ul><p>For years, everyone just lived with this. Search worked, but it was pretending to be something it was not.</p><h3>Enter QUERY: the best of both worlds</h3><p>QUERY is the fix, and it is beautifully simple in concept. It combines the good parts of GET and POST:</p><ul><li>Like POST, it can carry a big request body, so you can send massive, complicated searches without touching the URL.</li><li>Like GET, it is officially “safe” and repeatable, so the internet knows it is just reading data and treats it accordingly.</li></ul><p>In plain terms: QUERY is a GET that can carry a body. You get to send a huge structured search, and everything downstream, browsers, servers, CDNs, gateways, knows it is safe to cache and safe to retry.</p><p>Here is what it looks like:</p><pre>QUERY /products<br>Content-Type: application/json</pre><pre>{<br>  &quot;brand&quot;: [&quot;Nike&quot;, &quot;Adidas&quot;],<br>  &quot;priceRange&quot;: { &quot;min&quot;: 50, &quot;max&quot;: 200 },<br>  &quot;sizes&quot;: [40, 41, 42, 43],<br>  &quot;sortBy&quot;: &quot;rating&quot;<br>}</pre><p>Clean, readable, no giant URL, and the server knows exactly what is going on. It was officially published by the IETF (the group that sets internet standards) as RFC 10008 in June 2026.</p><h3>This has been “coming soon” for over a decade</h3><p>The idea behind QUERY is not new. Its roots go back to 2015, and a related concept existed as far back as 2008. It bounced around in draft form, got discussed at workshops, got renamed, got debated, and slowly crawled through the standards process for roughly eleven years before finally becoming official in 2026.</p><p>Eleven years of “it’s coming.” Sound like any open-world crime game you know?</p><h3>The catch: it works, but not everywhere yet</h3><p>Before you rush to use QUERY on your website tomorrow, here is the honest reality: the rulebook is finished, but the world has not caught up.</p><ul><li>Servers are getting there. Tools like Node.js, .NET, and Apache Tomcat have already added support, so server-to-server communication can use QUERY today.</li><li>Browsers are not ready. As of now, no major web browser fully supports QUERY. You also cannot yet make an HTML form submit a QUERY request.</li><li>The plumbing needs updates. A lot of internet infrastructure, security firewalls, gateways, CDNs, was set up before QUERY existed. Many of these will simply reject a method they do not recognize. Teams need to update their settings first.</li></ul><p>So for now, QUERY is genuinely useful in controlled setups where you own both ends of the connection. Public, browser-facing use will come, but it will take a while.</p><h3>A quick word of caution</h3><p>QUERY being “safe” means it does not <em>change</em> data. It does not mean the data inside it is harmless. A malicious search body can still carry an attack, just like a POST body can. So developers still need to validate and clean everything that comes in. “Safe” is a promise about intent, not a security guarantee.</p><h3>Why this actually matters</h3><p>At first glance, “new HTTP verb” sounds like the most boring news in the world. But QUERY quietly fixes something that has annoyed developers for over a decade. It lets the internet finally tell the difference between “I want to read some data” and “I want to change something,” without hacks and workarounds.</p><p>Over time, that means faster searches (thanks to caching), more reliable requests (thanks to safe retries), and cleaner, more honest APIs. It is a small change with a big ripple effect.</p><p>It will not roll out overnight. Full adoption is probably a couple of years away. But it is real, it is official, and it is here.</p><p>We got a new HTTP method before GTA 6. Take the wins where you can get them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33400da2271e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Add a Column to a Massive Table Without Taking Down Prod]]></title>
            <link>https://medium.com/@rushenssamodya/how-to-add-a-column-to-a-massive-table-without-taking-down-prod-3d314998cf16?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d314998cf16</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[learn]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[production-code]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 15:43:38 GMT</pubDate>
            <atom:updated>2026-07-22T15:49:04.834Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GCLMgCrR9uWFpx5oPqq1Kw.png" /></figure><p>Imagine a scenario where you have 50 million transaction records in a table, and it’s being read from, updated, and written to every single second, 24/7. How can we add a new column to such a table without breaking your prod environment?</p><p>First, let’s think about what we <em>shouldn’t</em> do here. Say we create the column and try to backfill all 50 million rows at once. The table gets locked while the data is being updated, which directly affects the ongoing transactions. Or worse, you end up putting a huge load on the server and take the whole thing down in one shot.</p><p>So we need a systematic approach. Instead of doing everything instantly, we follow a stagewise process. Let’s break it down and get a clear picture.</p><h3>Step 1: Add the column as nullable</h3><p>First, we add the column to the table and leave every existing row’s value as NULL (with no default value).</p><p><em>example:</em></p><pre>ALTER TABLE orders<br>ADD COLUMN discount_code text NULL;</pre><p>Since this is just a metadata change, it only takes milliseconds. There’s no harm to the current flow because we’re not touching any of the 50 million records yet.</p><p>With that, all the new incoming rows will have the column, but the column itself will be empty. So now we need to fill in that value for the records.</p><h3>Step 2: Populate the column for new records first</h3><p>Usually, we’d think the next step is to fill in the value from the beginning, starting at the top of the table. But because new records keep being created at the same time, we’d never actually finish, more rows would keep arriving. It becomes a never-ending process.</p><p>So instead, we handle the new records first. For that, we update the application logic itself, teaching the app to set the new column on every new transaction.</p><p>Once we push that change, all new transactions start writing a value for the new column. That’s one problem solved.</p><h3>Step 3: Backfill the old records in batches</h3><p>Now we deal with the existing records. For this, we use a batch process. If we try to update all 50 million rows at once, the earlier problem comes right back. So we pick a batch size and update the records batch by batch.</p><p>Between each batch, we check the database load and decide whether it’s healthy enough to run the next one. If it’s not, we wait until the load settles down, then continue.</p><p>And that’s how we solve this like professionals, with zero downtime and zero breakdowns.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d314998cf16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Sanity: The CMS That Finally Made Me Stop Spinning Up WordPress Sites]]></title>
            <link>https://medium.com/@rushenssamodya/meet-sanity-the-cms-that-finally-made-me-stop-spinning-up-wordpress-sites-f6fd51d17132?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6fd51d17132</guid>
            <category><![CDATA[sanity]]></category>
            <category><![CDATA[content-management]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[blog]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 03:13:37 GMT</pubDate>
            <atom:updated>2026-04-27T03:13:37.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S22dnScKYsPCOkJX3vf0jg.png" /></figure><p><em>Let me tell you something embarrassing. For the longest time, every time we wanted a blog for one of our projects, we’d spin up a whole separate WordPress site just to write posts. A completely different domain. A different admin panel. A different hosting bill. All just to publish content for what was essentially a static app.</em></p><p><em>A. Separate. WordPress. Installation. For. A. Blog.</em></p><p><em>Yeah. That was us. Until we discovered Sanity — and now our content editors can publish without ever leaving our own domain. Here’s exactly what Sanity is, why we picked it,and how you can wire it into your own Next.js project from scratch.</em></p><h3>1. What the Heck is Sanity?</h3><p><a href="http://sanity.io/">Sanity.io</a> is a headless CMS — and if that phrase makes your eyes glaze over, let’s break it down fast.</p><p>A traditional CMS (think WordPress) bundles two things together: the place where you manage content, and the place where it’s displayed. They’re married. Inseparable. You get the frontend whether you want it or not.</p><p>A headless CMS decouples these. It gives you a content backend — a studio where editors write and manage content — and then exposes that content via an API for <em>any</em> frontend to consume. Your Next.js app, your mobile app, your smartwatch app. Whatever.</p><p>Sanity specifically has three things you need to understand:</p><ul><li>Sanity Studio — the content editing UI. Fully customisable. It lives at /studio right inside your Next.js app.</li><li>Dataset — where your actual content lives (think: a database).</li><li>GROQ — Sanity’s query language. Like SQL, but for JSON documents. Once it clicks, you’ll never want to go back.</li></ul><p>That’s it. Three concepts. Now you’re dangerous.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LpcMiJ6sPAPA4RGD3u-YSw.png" /></figure><h3>2. Why We Picked Sanity (And Not the Others)</h3><p>We evaluated a few options before committing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jr7Brd7hXJKAiDMoQTTd5g.png" /></figure><p>The thing that actually sold us? The embedded Studio. We didn’t want to send our content team to a separate domain to write posts. With Sanity, the studio lives at yourdomain.com/studio. One product. One URL. Done.</p><h3>3. Let’s Build It — Step by Step</h3><p>Alright, enough talk. Let’s wire this up.</p><h4>Step 1: Install Sanity in Your Next.js Project</h4><pre>npm install next-sanity @sanity/client @sanity/image-url<br>npm install - save-dev sanity</pre><h4>Step 2: Configure Sanity</h4><p>Create sanity.config.ts at your project root:</p><pre>import { defineConfig } from &#39;sanity&#39;<br>import { structureTool } from &#39;sanity/structure&#39;<br>import { schemaTypes } from &#39;./sanity/schemaTypes&#39;<br><br>export default defineConfig({<br>  name: &#39;your-blog&#39;,<br>  title: &#39;Your Blog Studio&#39;,<br>  projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID ?? &#39;&#39;,<br>  dataset: process.env.NEXT_PUBLIC_SANITY_DATASET ?? &#39;production&#39;,<br>  basePath: &#39;/studio&#39;,<br>  plugins: [structureTool()],<br>  schema: {<br>    types: schemaTypes,<br>  },<br>})</pre><p>basePath: &#39;/studio&#39; is the magic line. That&#39;s where your Studio will live.</p><h4>Step 3: Define Your Schemas</h4><p>Schemas are how you tell Sanity what your content looks like. Create sanity/schemaTypes/authorType.ts:</p><pre>import { defineField, defineType } from &#39;sanity&#39;<br><br>export const authorType = defineType({<br>  name: &#39;author&#39;,<br>  title: &#39;Author&#39;,<br>  type: &#39;document&#39;,<br>  fields: [<br>    defineField({ name: &#39;name&#39;, type: &#39;string&#39; }),<br>    defineField({<br>      name: &#39;slug&#39;,<br>      type: &#39;slug&#39;,<br>      options: { source: &#39;name&#39; },<br>    }),<br>    defineField({<br>      name: &#39;image&#39;,<br>      type: &#39;image&#39;,<br>      options: { hotspot: true },<br>    }),<br>  ],<br>})</pre><p>Then sanity/schemaTypes/post.ts — your blog post shape:</p><pre>import { defineField, defineType } from &#39;sanity&#39;<br><br>export const post = defineType({<br>  name: &#39;post&#39;,<br>  title: &#39;Post&#39;,<br>  type: &#39;document&#39;,<br>  fields: [<br>    defineField({<br>      name: &#39;title&#39;,<br>      type: &#39;string&#39;,<br>      validation: (Rule) =&gt; Rule.required(),<br>    }),<br>    defineField({<br>      name: &#39;slug&#39;,<br>      type: &#39;slug&#39;,<br>      options: { source: &#39;title&#39;, maxLength: 96 },<br>      validation: (Rule) =&gt; Rule.required(),<br>    }),<br>    defineField({ name: &#39;publishedDate&#39;, type: &#39;datetime&#39; }),<br>    defineField({<br>      name: &#39;author&#39;,<br>      type: &#39;reference&#39;,<br>      to: [{ type: &#39;author&#39; }],<br>    }),<br>    defineField({<br>      name: &#39;tag&#39;,<br>      type: &#39;string&#39;,<br>      options: {<br>        list: [<br>          { title: &#39;Tutorial&#39;, value: &#39;Tutorial&#39; },<br>          { title: &#39;Insights&#39;, value: &#39;Insights&#39; },<br>          { title: &#39;Product&#39;, value: &#39;Product&#39; },<br>          { title: &#39;Guide&#39;, value: &#39;Guide&#39; },<br>        ],<br>      },<br>    }),<br>    defineField({ name: &#39;excerpt&#39;, type: &#39;text&#39;, rows: 3 }),<br>    defineField({<br>      name: &#39;coverImage&#39;,<br>      type: &#39;image&#39;,<br>      options: { hotspot: true },<br>    }),<br>    defineField({<br>      name: &#39;body&#39;,<br>      type: &#39;array&#39;,<br>      of: [{ type: &#39;block&#39; }, { type: &#39;image&#39;, options: { hotspot: true } }],<br>    }),<br>  ],<br>})</pre><p>Export them from sanity/schemaTypes/index.ts:</p><pre>import { authorType } from &#39;./authorType&#39;<br>import { post } from &#39;./post&#39;<br><br>export const schemaTypes = [authorType, post]</pre><h4>Step 4: Wire Up the Sanity Client in Next.js</h4><p>Create lib/sanity.ts:</p><pre>import { createClient } from &#39;@sanity/client&#39;<br>import { createImageUrlBuilder } from &#39;@sanity/image-url&#39;<br>import type { SanityImageSource } from &#39;@sanity/image-url&#39;<br><br>export const sanityClient = createClient({<br>  projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!,<br>  dataset: process.env.NEXT_PUBLIC_SANITY_DATASET ?? &#39;production&#39;,<br>  apiVersion: &#39;2024-01-01&#39;,<br>  useCdn: true,<br>})<br><br>const builder = createImageUrlBuilder(sanityClient)<br><br>export function urlFor(source: SanityImageSource) {<br>  return builder.image(source)<br>}</pre><p>Two exports. sanityClient for querying. urlFor for images. That&#39;s all you&#39;ll ever need day-to-day.</p><h4>Step 5: Write Your First GROQ Queries</h4><p>Create lib/blog.ts with your data-fetching functions:</p><pre>import { sanityClient } from &#39;./sanity&#39;<br><br>export async function getAllPosts() {<br>  return sanityClient.fetch(`<br>    *[_type == &quot;post&quot;] | order(publishedDate desc) {<br>      title,<br>      &quot;slug&quot;: slug.current,<br>      publishedDate,<br>      &quot;author&quot;: author-&gt;name,<br>      tag,<br>      excerpt,<br>      &quot;coverImage&quot;: coverImage.asset-&gt;url<br>    }<br>  `)<br>}<br><br>export async function getPostBySlug(slug: string) {<br>  return sanityClient.fetch(`<br>    *[_type == &quot;post&quot; &amp;&amp; slug.current == $slug][0] {<br>      title,<br>      &quot;slug&quot;: slug.current,<br>      publishedDate,<br>      &quot;author&quot;: author-&gt;name,<br>      tag,<br>      excerpt,<br>      &quot;coverImage&quot;: coverImage.asset-&gt;url,<br>      body<br>    }<br>  `, { slug })<br>}</pre><p>Let’s decode the GROQ syntax quickly:</p><ul><li>*[_type == &quot;post&quot;] — fetch all documents of type post</li><li>| order(publishedDate desc) — sort newest first</li><li>author-&gt;name — the -&gt; dereferences a reference. It&#39;s like a JOIN, but readable.</li><li>&quot;slug&quot;: slug.current — rename slug.current to just slug in the response</li></ul><h4>Step 6: Render Posts in Your Next.js Page</h4><p>app/blog/page.tsx:</p><pre>import { getAllPosts } from &#39;@/lib/blog&#39;<br><br>export const revalidate = 60 // ISR: refresh every 60 seconds<br><br>export default async function BlogPage() {<br>  const posts = await getAllPosts()<br><br>  return (<br>    &lt;main&gt;<br>      {posts.map((post) =&gt; (<br>        &lt;article key={post.slug}&gt;<br>          &lt;h2&gt;{post.title}&lt;/h2&gt;<br>          &lt;p&gt;{post.excerpt}&lt;/p&gt;<br>          &lt;a href={`/blog/${post.slug}`}&gt;Read more →&lt;/a&gt;<br>        &lt;/article&gt;<br>      ))}<br>    &lt;/main&gt;<br>  )<br>}</pre><p>And for dynamic post pages, app/blog/[slug]/page.tsx:</p><pre>import { getPostBySlug, getAllSlugs } from &#39;@/lib/blog&#39;<br><br>export async function generateStaticParams() {<br>  const slugs = await getAllSlugs()<br>  return slugs.map((s) =&gt; ({ slug: s.slug }))<br>}<br><br>export default async function PostPage({ params }: { params: { slug: string } }) {<br>  const post = await getPostBySlug(params.slug)<br>  return (<br>    &lt;article&gt;<br>      &lt;h1&gt;{post.title}&lt;/h1&gt;<br>      {/* render post.body with @portabletext/react */}<br>    &lt;/article&gt;<br>  )<br>}</pre><h3>Step 7: Mount the Studio</h3><p>Add a catch-all route so Next.js serves the Sanity Studio at /studio. Create app/studio/[[...tool]]/page.tsx:</p><pre>&#39;use client&#39;<br><br>import { NextStudio } from &#39;next-sanity/studio&#39;<br>import config from &#39;../../../sanity.config&#39;<br><br>export default function StudioPage() {<br>  return &lt;NextStudio config={config} /&gt;<br>}</pre><p>Navigate to localhost:3000/studio. Your Studio is live.</p><h3>4. The Tricky Parts Nobody Tells You</h3><h4>useCdn: true — the silent cache</h4><p>With useCdn: true, Sanity serves content from a global CDN. Fast. But it has a propagation delay — freshly published content might take a few seconds to appear. For a blog that&#39;s fine. For real-time data, set useCdn: false.</p><h4>Images need urlFor() — not a raw URL</h4><p>Sanity stores images as references, not direct URLs. Always use urlFor():</p><pre>import { urlFor } from &#39;@/lib/sanity&#39;<br><br>&lt;img src={urlFor(post.coverImage).width(800).url()} alt=&quot;Cover&quot; /&gt;</pre><p>Chain .width(), .height(), .fit() — Sanity transforms images on the fly through their CDN. It&#39;s genuinely excellent.</p><h4>Slug-based routing needs slug.current</h4><p>In GROQ, the slug field is an object { current: &quot;my-post-slug&quot; }. Always project it with &quot;slug&quot;: slug.current so your frontend gets a plain string, not an object.</p><h3>5. What You Can Build From Here</h3><p>You’ve got the foundation. Here’s what naturally comes next:</p><ul><li>Tag filtering — GROQ filter by tag == $tag, wire up a client-side filter component</li><li>Author pages — /blog/author/[slug] with *[_type == &quot;post&quot; &amp;&amp; author-&gt;slug.current == $slug]</li><li>Related posts — fetch by matching tag, fall back to latest</li><li>Sitemap generation — getAllSlugs() feeds directly into Next.js sitemap.ts</li><li>Search — Sanity has a native embeddings/semantic search feature if you need it</li></ul><h3>Wrapping Up</h3><p>Here’s the MECE summary of what you just learned:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jr7Brd7hXJKAiDMoQTTd5g.png" /></figure><p>The whole thing — from npm install to a working CMS-powered blog — takes about an afternoon. And from that point forward, your content team ships without ever touching your codebase.</p><p>That’s the deal.</p><p><em>If you’re thinking about integrating Sanity into your own project and want a hand getting started, feel free to reach out — we’re always happy to help.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6fd51d17132" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your AI has been living in a sealed box. MCP breaks it open.]]></title>
            <link>https://medium.com/@rushenssamodya/your-ai-has-been-living-in-a-sealed-box-mcp-breaks-it-open-22b48af2a3a6?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/22b48af2a3a6</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 03:23:35 GMT</pubDate>
            <atom:updated>2026-03-18T03:26:22.456Z</atom:updated>
            <content:encoded><![CDATA[<p>You’ve heard the buzz. MCP servers. AI tools. Agents doing things. But nobody’s explained it from it’s first principles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*Bz9g-lsUXcK8oKntrUtq3Q.png" /></figure><h3>The brilliant analyst locked in a room with no windows</h3><p>Imagine you hire the smartest analyst on the planet. Reads everything. Remembers everything. Can reason through any problem you throw at her.</p><p>There’s one catch. She’s been in a sealed room since the day she started. No internet. No phone. No access to your company’s systems. She knows everything she read before she walked in — but she has no idea what happened yesterday. She can’t check your database. She can’t see your emails. She can’t even tell you today’s date with confidence.</p><p>You ask her: <strong>“What’s our revenue for Q1?”</strong></p><p>She stares at you. Not because she’s not smart. Because she literally cannot see the data.</p><p>That analyst? <strong>That’s your AI.</strong> ChatGPT. Claude. Gemini. Every one of them. Brilliant. Frozen. Isolated.</p><blockquote>It’s 2023. A developer at a startup gets a request from their CEO: <em>“I want our AI to check the customer’s order from Shopify, look up their tickets in Zendesk, draft a reply in Gmail, and log a task in Asana — all in one go.”</em></blockquote><blockquote>The developer nods. Then goes back to his desk and has a quiet existential crisis. Because to connect the AI to each of those services, he has to write four separate custom integrations. Different auth. Different APIs. Different response formats. Different everything.</blockquote><blockquote>And if he ever switches AI providers? He rewrites all four. From scratch.</blockquote><blockquote>He calls this Tuesday.</blockquote><p>This is the world before MCP. Every team that wanted a tool-connected AI was essentially building the same painful plumbing from scratch. Nobody was sharing solutions. Nobody had a standard. It was the software equivalent of every city designing its own electrical system and then being surprised when your laptop doesn’t charge in a different country</p><blockquote>The AI was powerful. The plumbing was a disaster.</blockquote><h3>Enter MCP</h3><p>In November 2024, Anthropic released something called the Model Context Protocol — MCP for short. And the best way to understand it is to think about USB.</p><p>Before USB, every peripheral had its own proprietary connector. Your keyboard had a PS/2 port. Your printer had a parallel port. Your scanner had its own weird cable that came in the box and you lost immediately.</p><p>Then USB showed up and said: <em>“What if everything just used the same plug?”</em></p><p>Manufacturers didn’t have to write custom drivers for each computer. Computers didn’t have to know the internal specs of every device. They all just agreed on one standard. One connector. One handshake. Infinite devices.</p><p>MCP is USB for AI models and tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*d_HKlenudoMb0Egl-FqOyQ.png" /></figure><p>Anthropic made it fully open-source. Free for anyone to implement. No licensing fees, no vendor lock-in. The bet was: if they make this the standard, the whole industry benefits — including us. And it worked. Within months, OpenAI, Google, VS Code, Cursor, and dozens of other tools had adopted it.</p><blockquote><em>A protocol turns an N×M problem into an N+M problem. Write a tool once. Every AI benefits from it forever.</em></blockquote><h3>The restaurant that explains<br>everything</h3><p>Okay, stay with me. We’re going to a restaurant.</p><p>You (the customer) want food. You don’t walk into the kitchen yourself. The kitchen doesn’t come to your table. There’s a waiter in between — taking your order, carrying it to the kitchen, bringing back your meal. The waiter is the communication layer.</p><p>MCP works exactly the same way, with three named pieces:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*j7qL8yFzrCnq-rAH418GQw.png" /></figure><h3>What actually happens when<br>you type “check my calendar”</h3><p>Let’s slow down time. You type: <em>“What meetings do I have tomorrow afternoon?”</em> and hit send. What happens in the next 800 milliseconds?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*bcyPCBOtFzzoUM0MPPxLZg.png" /></figure><p>The AI never directly called Google Calendar. It never knew your OAuth token. It just said <em>“I want to call this tool with these arguments”</em> — and the MCP machinery handled everything else. This separation is intentional. The AI stays focused on reasoning. The servers stay focused on doing.</p><p>And here’s what’s genuinely wild about this: the AI didn’t know in advance that you had a Calendar server connected. It <em>discovered</em> it at the start of the session through a handshake — like asking a new colleague <em>“what’s your role here?”</em> before working with them. You can add new tools without touching any AI code. The AI finds out about them automatically next session.</p><h3>So what’s an MCP server,<br>really?</h3><p>Here’s what trips people up. They hear “server” and picture nginx running on a Linux box in a data center somewhere, fielding thousands of requests per second. Racks. Cooling systems. A DevOps engineer on call.</p><p>An MCP server is nothing like that. It’s closer to a calculator app on your machine. It’s just a process. It sits there, waits for input, does a job, returns output. In most cases the host application <em>starts it</em> when it needs it and kills it when it’s done. No open ports. No cloud infrastructure. Just two processes talking through pipes on your own laptop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*kEfjj7JbLspRSMy7LbuCWA.png" /></figure><p>That’s the whole thing. A name. A list of tools. A handler that runs when a tool is called. A transport to wire it up. The MCP SDK handles all the JSON-RPC plumbing underneath — you just write the business logic.</p><p>And here’s what makes this genuinely exciting for developers: once you’ve written one MCP server, writing the next takes a fraction of the time. The structure is identical. Only the business logic changes. The day you understand how to build one, you understand how to build all of them.</p><p><strong><em>The AI stops being a smart autocomplete. It becomes a capable colleague who can actually do things in your world.</em></strong></p><p>That’s the real shift MCP enables. Not fancier answers. Not more impressive demos. But AI that can <em>act</em> — checking your real calendar, querying your real database, pushing to your real GitHub repo, deploying to your real infrastructure — all from a conversation, all through a standardized protocol that any AI can speak.</p><p>The sealed room finally has a door. And behind that door are as many tools as the world of developers decides to build.</p><p>Which, as it turns out, is a lot.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22b48af2a3a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SSH Explained: The Secret Tunnel Your Terminal Uses Every Day (And How It Actually Works)]]></title>
            <link>https://medium.com/@rushenssamodya/ssh-explained-the-secret-tunnel-your-terminal-uses-every-day-and-how-it-actually-works-2fe118173d9d?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fe118173d9d</guid>
            <category><![CDATA[ssh-protocol]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[remote-server-access]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Mon, 02 Mar 2026 07:56:53 GMT</pubDate>
            <atom:updated>2026-03-02T07:56:53.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ltMxtlqgP0LkoLyU6pQ2A.jpeg" /></figure><p>You’ve typed ssh user@someserver.com a hundred times. The cursor blinks. A few milliseconds later, you&#39;re inside a machine that could be sitting in a data center on the other side of the planet.</p><p>Magic, right?</p><p>Not quite. It’s actually a beautifully designed system of cryptography, protocols, and handshakes working in concert — and once you understand what’s happening under the hood, you’ll never look at that blinking cursor the same way again.</p><p>Let’s pull back the curtain.</p><h3>First: Why Does SSH Even Exist?</h3><p>Before SSH, developers used something called <strong>Telnet</strong> to connect to remote servers. It worked fine — except for one catastrophic problem: it sent <em>everything in plain text</em>.</p><p>Your username. Your password. Every command you typed. All of it streamed across the network as readable text, just waiting for anyone in between to scoop it up.</p><p>It was the digital equivalent of shouting your bank PIN across a crowded café.</p><p>SSH (Secure Shell) was built in the 1990s to fix exactly this. It encrypts <em>everything</em> — your commands, your passwords, your file transfers. To anyone snooping on the network, it all looks like gibberish.</p><h3>Okay, But What Even Is a “Protocol”?</h3><p>Before we go deeper, let’s get one foundational concept out of the way.</p><p>A <strong>protocol</strong> is just a set of rules that computers agree to follow when talking to each other. Think of it like a formal handshake ritual — both parties need to know the steps, or the conversation breaks down.</p><p>HTTP is a protocol (for web pages). WebSockets is a protocol (for real-time connections). SSH is a protocol (for secure remote access).</p><p>They’re all just agreements. Rules. A shared language that lets machines communicate reliably.</p><h3>The Port System: How Your Computer Juggles Thousands of Conversations</h3><p>Here’s something that surprises most people: your computer doesn’t just have one “door” for network traffic. It has <strong>65,535 of them</strong>.</p><p>These are called <strong>ports</strong>, and each one can host a different service. Think of your computer as a massive apartment building, where each apartment (port) houses a different tenant (service).</p><ul><li><strong>Port 22</strong> → SSH lives here</li><li><strong>Port 80</strong> → HTTP (regular web traffic)</li><li><strong>Port 443</strong> → HTTPS (secure web traffic)</li><li><strong>Port 3000</strong> → probably your local dev server at 2am</li></ul><p>SSH defaults to port 22. But here’s the thing — you can move it. If you edit /etc/ssh/sshd_config, change the Port 22 line to something like Port 2222, restart the SSH service, and update your firewall rules, you&#39;ve effectively moved SSH to a different apartment.</p><p>Why bother? Mostly to reduce automated bot attacks that constantly hammer port 22. It’s not bulletproof security, but it cuts a lot of noise.</p><p>To connect to a custom port, you just tell SSH which door to knock on:</p><pre>ssh -p 2222 user@yourserver.com</pre><p>And speaking of firewalls — a <strong>firewall</strong> is the building security guard. It decides which ports are open to the public and which are locked. Change your SSH port without updating your firewall, and you’ve just locked yourself out. Don’t do that.</p><h3>TCP: The Reliable Delivery Service Underneath It All</h3><p>SSH doesn’t just float through the internet on vibes. It rides on top of <strong>TCP (Transmission Control Protocol)</strong>, and so does basically everything else you care about — HTTP, HTTPS, WebSockets.</p><p>TCP is obsessed with reliability. When it sends data, it:</p><ol><li><strong>Splits it into packets</strong> — small chunks that travel independently</li><li><strong>Numbers each packet</strong> — so they can be reassembled in order</li><li><strong>Confirms delivery</strong> — the receiver sends back acknowledgments</li><li><strong>Retransmits lost packets</strong> — if something goes missing, TCP notices and resends it</li></ol><p>It’s the postal service that actually tracks your package, follows up when it’s lost, and won’t rest until your data arrives intact and in order.</p><p>Without TCP, SSH would be like trying to have a secure conversation where half your sentences get dropped at random.</p><h3>The Real Magic: How SSH Authentication Actually Works</h3><p>This is where it gets genuinely interesting. Most people know SSH uses “keys,” but the actual mechanism is elegant in a way that’s worth understanding.</p><p>SSH uses <strong>asymmetric cryptography</strong>, which means it uses a <em>pair</em> of mathematically linked keys:</p><ul><li><strong>Your private key</strong> — stays on your machine, never leaves, never gets shared</li><li><strong>Your public key</strong> — can be shared freely, lives on the server</li></ul><p>Here’s the clever part: <strong>data encrypted with the public key can only be decrypted with the private key</strong>. And you can <em>sign</em> data with the private key, and anyone with the public key can verify that signature.</p><h3>The Authentication Flow (Step by Step)</h3><p>When you SSH into a server using key-based auth, here’s what happens:</p><ol><li><strong>You tell the server who you are</strong> (send your public key)</li><li><strong>The server sends you a challenge</strong> — a random value called a <em>nonce</em></li><li><strong>Your SSH client signs that challenge with your private key</strong></li><li><strong>You send the signature back</strong></li><li><strong>The server verifies the signature using your public key</strong></li></ol><p>If the math checks out? You’re in.</p><p>Notice what never happened: <strong>your private key never left your machine</strong>. Not even a byte of it. The server never needed it — it just needed proof that you <em>have</em> it.</p><p>It’s like proving you own a house key without ever handing it over. The lock manufacturer can verify your key’s signature without you giving anyone a copy.</p><h3>The SSH Handshake: What Happens in Those First Milliseconds</h3><p>Before any of the authentication above happens, there’s a <strong>handshake</strong> — a negotiation between your client and the server that sets up the rules for the conversation.</p><p>During the handshake, both sides agree on:</p><ul><li><strong>Which encryption algorithms to use</strong> (there are several options)</li><li><strong>How to exchange cryptographic keys securely</strong></li><li><strong>Identity verification</strong> (server proves it’s who it claims to be, too)</li></ul><p>Here’s an important nuance: after authentication, SSH doesn’t keep using asymmetric encryption for the whole session. Asymmetric crypto is computationally expensive. Instead, once you’re authenticated, SSH switches to <strong>symmetric encryption</strong> — where both sides share a single session key. It’s faster, and it’s fine because the key was established securely during the handshake.</p><p>Think of it this way: the handshake is like two spies using a complex code to safely agree on a simpler passphrase — then using that passphrase for the rest of the conversation.</p><h3>How to Generate Your Own SSH Keys</h3><p>If you’re on Linux or macOS, you’re already covered — OpenSSH comes pre-installed on all Unix-based systems (Linux, macOS, BSD). Windows users can use OpenSSH (now built into Windows 10+) or WSL (Windows Subsystem for Linux).</p><p>Generating a key pair is a single command:</p><pre>ssh-keygen</pre><p>This creates two files:</p><ul><li>~/.ssh/id_rsa — your <strong>private key</strong> (guard this with your life)</li><li>~/.ssh/id_rsa.pub — your <strong>public key</strong> (this goes on servers)</li></ul><p>You copy the public key to a server, and from that point on, you authenticate with your private key instead of a password.</p><p>No more typing passwords. No more passwords being transmitted at all.</p><h3>Other Ways to Authenticate</h3><p>Key-based auth is the gold standard, but SSH supports other methods too:</p><ul><li><strong>Password authentication</strong> — the classic, less recommended option</li><li><strong>Multi-factor authentication (MFA)</strong> — adds a second factor on top of keys or passwords</li><li><strong>Passphrase-protected private keys</strong> — you encrypt your private key itself, so even if someone steals the file, they can’t use it without your passphrase</li></ul><p>For anything production-facing, key-based auth with a passphrase is the way to go.</p><h3>The Big Picture: What Actually Happens When You SSH</h3><p>Let’s zoom all the way out. Here’s the full journey of a single ssh user@server.com:</p><ol><li><strong>DNS resolves the hostname</strong> to an IP address</li><li><strong>TCP connection opens</strong> on port 22</li><li><strong>SSH handshake begins</strong> — algorithm negotiation, key exchange, server identity verified</li><li><strong>Authentication</strong> — you prove you own your private key via the challenge-signature flow</li><li><strong>Session established</strong> — symmetric encryption kicks in for performance</li><li><strong>You get a shell</strong> — every command you type is encrypted, sent, executed, and the output is encrypted and sent back</li></ol><p>All of that happens in under a second.</p><h3>Why This All Matters</h3><p>You could go your entire career treating SSH as a black box — type the command, get a shell, don’t ask questions.</p><p>But understanding the layers underneath makes you better at everything: debugging connection issues, designing secure systems, explaining to non-technical stakeholders why “we use SSH keys, not passwords” is the right call.</p><p>Plus, when you understand that TCP is doing reliable packet delivery, that asymmetric crypto is letting you prove identity without sharing secrets, and that port 22 is just a convention you can change — SSH stops being magic and starts being <em>engineering</em>.</p><p>And engineering, unlike magic, is something you can actually control.</p><p><em>Got questions about SSH, networking, or anything else in this post? Drop them in the comments — let’s dig deeper.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fe118173d9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How AWS Textract Turned 46 Hours of Data Entry Into 5 Minutes]]></title>
            <link>https://medium.com/@rushenssamodya/how-aws-textract-turned-46-hours-of-data-entry-into-5-minutes-7124516309b6?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/7124516309b6</guid>
            <category><![CDATA[data-extraction]]></category>
            <category><![CDATA[aws-textract]]></category>
            <category><![CDATA[ocr]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[text-extraction]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Sat, 15 Nov 2025 13:53:02 GMT</pubDate>
            <atom:updated>2025-11-15T13:53:02.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oDe3D00p5gqfQzrDYlLlDQ.png" /></figure><h3>That Awkward Moment When Your Boss Asks “Can We Automate This?”</h3><p>You know what’s worse than manually typing invoice data into spreadsheets?</p><p>Having to explain to your boss why you’re <em>still</em> manually typing invoice data into spreadsheets in 2025.</p><p>Look, we’ve all been there. Mountains of receipts. Endless PDFs. Tables that refuse to copy-paste properly. And that one supplier who <em>still</em> faxes invoices like it’s 1997. The whole thing is exhausting, repetitive, and honestly? A complete waste of human brain power.</p><p>So when someone suggests “let’s just use OCR,” you nod enthusiastically. Simple, right? Scan the document, extract the text, job done.</p><p>Except it’s never that simple.</p><p>Because real-world documents are chaos. Blurry photos taken under terrible lighting. Multi-page invoices where the table continues across three different pages. Handwritten notes scribbled in margins. Invoice numbers hiding in the weirdest places. And don’t even get me started on tax IDs that look like they were printed by a drunk printer.</p><p>This is where AWS Textract comes in. And honestly? It’s one of those tools that seems almost boring until you actually use it. Then you realize it’s solving problems you didn’t even know you had.</p><h3>What Even Is Textract?</h3><p>Think about regular OCR for a second. It looks at a document and goes, “Right, I see letters. I-N-V-O-I-C-E. There you go.”</p><p>Cool. Thanks for that.</p><p>Now imagine a tool that actually <em>understands</em> what it’s reading. It sees “INVOICE” and thinks, “Okay, this is an invoice. Let me find the invoice number, the date, the supplier details, extract this table with all the line items, grab the tax ID, calculate totals, and figure out what type of document this actually is.”</p><p>That’s Textract.</p><p>It’s not just reading text off a page — it’s comprehending the <em>structure</em> and <em>meaning</em> of documents. Tables stay as tables. Forms get parsed into key-value pairs. Handwritten notes get picked up (well, most of them). Everything comes back as nice, structured JSON data your systems can actually use.</p><p>And the best part? It’s a managed AWS service, which means you don’t have to worry about scaling, servers, or any of that nonsense. You just send documents, get data back, pay per page, and move on with your life.</p><h3>Why This Actually Matters (A Real Example)</h3><p>Here’s the thing — everyone talks about document processing in theory. Let me tell you how it works in practice.</p><p>I built a production system for processing receipts, invoices, and timesheets. Not a demo. Not a proof-of-concept. An actual live system handling thousands of real documents.</p><p>The challenge? These documents need to be processed accurately, quickly, and — this is the critical bit for this particular client — they can <em>never</em> leave Australian soil. Data sovereignty requirements meant everything had to stay within Australia’s borders. (Your requirements might be different — maybe it’s GDPR compliance in Europe, or keeping data within the US. The point is Textract works within whatever regional constraints you have.)</p><p>The architecture uses Textract alongside AWS Bedrock (AI models) in a pretty clever way. Here’s how:</p><p><strong>Single-page documents</strong> (like most receipts) go straight to Bedrock’s vision models. Why? Because AI models can look at the image directly and extract everything in one go. Fast, clean, done.</p><p><strong>Multi-page documents</strong> (those 20-page invoices that suppliers love) hit Textract first. It rips through all the pages, extracts text and tables, preserves structure. <em>Then</em> we feed that clean, structured data to Bedrock for intelligent analysis.</p><p>Why not just send everything to Textract? Because Bedrock’s the one that actually <em>understands</em> context and business rules. It knows what makes a valid tax invoice in your jurisdiction. It can validate tax IDs and registration numbers. It spots when documents are missing mandatory elements. Textract gets you the data; Bedrock makes sense of it.</p><p>The result? Structured JSON with validated business numbers, proper document classification, extracted line items, calculated totals — everything an accounting system needs to ingest documents automatically.</p><h3>What Makes Textract Different from “Just OCR”</h3><p>Let me break down what Textract actually does that makes it worth using:</p><h3>It Handles Messy Reality</h3><p>Real documents are <em>horrible</em>. Crumpled receipts photographed in dim lighting. Invoices where the table formatting is completely broken. Forms where someone ticked boxes AND wrote in the margins AND crossed things out.</p><p>Traditional OCR sees this chaos and basically gives up. Textract? It just deals with it.</p><p>Feed it a 30-page contract with complex tables, handwritten annotations, signatures, stamps, random coffee stains — it extracts the lot. Text blocks with their positions. Complete tables with rows and columns intact. Form fields matched to their values. Even handwritten text (though the mileage varies depending on handwriting quality).</p><h3>Tables Stay Tables</h3><p>This is huge for invoices and anything with structured data.</p><p>An invoice isn’t random text floating on a page. It’s structured information. Header details at the top. Line items in a table. Totals at the bottom. That structure <em>matters</em>.</p><p>Textract preserves it. You get back proper table objects with columns, headers, rows, cells — everything in the right place. When you’re processing hundreds of invoices, having the data already structured is the difference between “this works” and “I want to quit my job.”</p><h3>Forms Get Parsed Properly</h3><p>Forms are basically structured documents with labels and values. “Invoice Number: 12345. Date: 15/03/2025. Supplier: Acme Corp.”</p><p>Textract understands these relationships. It doesn’t just see “Invoice Number” and “12345” as random text — it knows they belong together. You get back key-value pairs, which is exactly what databases want.</p><p>This is a lifesaver for processing government forms, applications, timesheets, or anything where field extraction matters.</p><h3>It Scales Without You Thinking About It</h3><p>Whether you’re processing 100 documents or 5,000 in a day, Textract doesn’t care. AWS handles the scaling. You just pay per page and keep going.</p><p>No “oh crap, traffic spike crashed everything” moments. No capacity planning. No servers to babysit. It just works.</p><h3>The Bits That Actually Matter</h3><p>Let’s talk practical details because that’s what you actually need to know:</p><h3>Different APIs for Different Jobs</h3><p>Textract gives you options:</p><ul><li><strong>DetectDocumentText</strong>: Basic text extraction. Fast, cheap. “Just give me all the words.”</li><li><strong>AnalyzeDocument</strong>: Full power mode. Tables, forms, queries, signatures — everything.</li><li><strong>AnalyzeExpense</strong>: Purpose-built for invoices and receipts. Understands line items, tax, totals.</li><li><strong>AnalyzeID</strong>: Made for passports, licenses, ID cards. Knows ID-specific fields.</li></ul><p>Pick the right one and you’ll save time and money. Using AnalyzeDocument for simple text extraction is like using a sledgehammer to crack a peanut — it works, but why?</p><h3>Pricing That Makes Sense</h3><p>Textract charges per page. As of 2025:</p><ul><li>Basic text detection: ~$0.0015 per page</li><li>Full analysis with tables/forms: ~$0.065 per page</li></ul><p>So a 5-page invoice at full analysis is about $0.33.</p><p>How much does it cost for someone to manually process that invoice? Even at minimum wage, you’re looking at several dollars in labor costs. Plus the errors. Plus the time wasted.</p><p>The math is honestly ridiculous — automation wins by a landslide.</p><h3>Quality Matters (But Less Than You Think)</h3><p>Yes, crisp 300 DPI scans work better than blurry phone photos.</p><p>But here’s the surprising bit: Textract handles surprisingly terrible documents. I’ve successfully processed receipts that looked like they went through a washing machine. Photos taken in moving vehicles. Scans so faded you could barely read them yourself.</p><p>It’s not magic, but the tolerance for poor quality is way higher than you’d expect.</p><h3>Let’s Build Something Simple</h3><p>Enough theory. Let’s extract a table from an invoice in about 20 lines of Python.</p><p>Here’s what we’re doing: upload an invoice PDF, extract all tables, print them out. That’s it.</p><p>python</p><pre>import boto3<br>import json<br># Initialize Textract client<br>textract = boto3.client(&#39;textract&#39;, region_name=&#39;us-east-1&#39;)<br># Read your invoice file<br>with open(&#39;invoice.pdf&#39;, &#39;rb&#39;) as document:<br>    response = textract.analyze_document(<br>        Document={&#39;Bytes&#39;: document.read()},<br>        FeatureTypes=[&#39;TABLES&#39;]<br>    )<br># Extract table data<br>for block in response[&#39;Blocks&#39;]:<br>    if block[&#39;BlockType&#39;] == &#39;TABLE&#39;:<br>        print(f&quot;\\nFound a table:&quot;)<br>        *# Get all cells in this table*<br>        cells = [b for b in response[&#39;Blocks&#39;] <br>                if b[&#39;BlockType&#39;] == &#39;CELL&#39; and <br>                b.get(&#39;Relationships&#39;)]<br>        <br>        for cell in cells:<br>            row = cell.get(&#39;RowIndex&#39;, 0)<br>            col = cell.get(&#39;ColumnIndex&#39;, 0)<br>            text = &#39;&#39;<br>            # Get text from this cell<br>            if &#39;Relationships&#39; in cell:<br>                for rel in cell[&#39;Relationships&#39;]:<br>                    if rel[&#39;Type&#39;] == &#39;CHILD&#39;:<br>                        for id in rel[&#39;Ids&#39;]:<br>                            word_block = next((b for b in response[&#39;Blocks&#39;] <br>                                            if b[&#39;Id&#39;] == id), None)<br>                            if word_block and word_block[&#39;BlockType&#39;] == &#39;WORD&#39;:<br>                                text += word_block[&#39;Text&#39;] + &#39; &#39;<br>            print(f&quot;Row {row}, Col {col}: {text.strip()}&quot;)</pre><p>What happens here?</p><ol><li>We call analyze_document with the TABLES feature</li><li>Textract returns blocks — each block is a piece of the document</li><li>We find blocks that are tables</li><li>For each table, we grab the cells with their row/column positions</li><li>We extract the text from each cell</li></ol><p>Run this on an invoice with a table of line items, and you’ll get back every cell’s content with its exact position. Row 1, Column 1 might be “Item”. Row 2, Column 3 might be “$49.99”. All structured, all ready to dump into a database.</p><p>The beauty? This same code works whether your invoice is 1 page or 50 pages. Whether it’s a perfect PDF or a slightly wonky scan. Textract handles it.</p><p><strong>Quick tips for trying this:</strong></p><ul><li>You need AWS credentials configured (aws configure)</li><li>Replace ‘invoice.pdf’ with your actual file</li><li>The free tier gives you 1,000 pages per month for the first three months</li></ul><p>That’s literally all you need to start extracting structured data from documents. Everything else is just building on this foundation.</p><h3>The Stuff Nobody Tells You</h3><p>Building production document processing taught me some things:</p><h3>Textract Is Fast; Everything Else Is Slow</h3><p>In my pipeline, Textract processes a 20-page document in seconds. Then I wait. And wait. Because the bottleneck isn’t OCR — it’s the AI models analyzing the extracted data.</p><p>99.7% of processing time is spent waiting for Bedrock to respond. Not because Bedrock is slow, but because of rate limits and queuing.</p><p>Textract itself? Blazing fast.</p><h3>Document Types Matter</h3><p>Not all documents are equal. A clean invoice PDF processes beautifully. A photograph of a crumpled receipt taken under fluorescent lighting in a dark warehouse? That’s going to be trickier.</p><p>For best results:</p><ul><li>Decent resolution (150+ DPI for scans)</li><li>Reasonable lighting for photos</li><li>Not too skewed or rotated</li><li>Clear text, not microscopic font sizes</li></ul><p>Textract will <em>try</em> with terrible inputs, but garbage in still means questionable results out.</p><h3>Integration Is Where The Work Is</h3><p>Textract doesn’t magically integrate with your accounting system. You need to build the pipeline:</p><ol><li>Document arrives (upload, email, API)</li><li>Trigger processing (Lambda, queue, whatever)</li><li>Call Textract APIs</li><li>Parse the response JSON</li><li>Validate and transform data</li><li>Send to your systems</li><li>Handle errors and edge cases</li></ol><p>The good news? The AWS documentation is actually decent, and there are plenty of examples out there.</p><h3>When Textract Makes Sense</h3><p>Here’s when you should seriously consider using it:</p><p><strong>You’re processing lots of documents</strong>. If it’s 5 invoices a month, just do it manually. If it’s 500? Automate immediately.</p><p><strong>The documents have structure</strong>. Invoices, forms, tables, receipts — Textract excels here. Weird artistic layouts or complex magazine designs? Less so.</p><p><strong>You need accuracy and consistency</strong>. Humans make random errors. Textract makes <em>consistent</em> errors, which you can catch and fix systematically.</p><p><strong>Speed matters</strong>. Real-time or near-real-time processing needs automation.</p><p><strong>You want to free humans for better work</strong>. Let machines do the boring extraction. Let humans handle exceptions, validation, and judgment calls.</p><h3>The Bottom Line</h3><p>AWS Textract isn’t going to solve every document problem you have. But if you’re dealing with receipts, invoices, forms, contracts, or any structured documents that humans are currently processing manually?</p><p>It’s one of those tools that makes you wonder why you waited so long to try it.</p><p>The technology is solid. The pricing is reasonable. The accuracy is genuinely impressive. And combining it with AI models that can actually understand and validate the extracted data? That’s when things get properly useful.</p><p>I went from “how do we process thousands of documents?” to “oh, it’s already done” in the time it takes to drink a cup of tea. That’s the difference automation makes.</p><p>Your move: grab some of your worst documents — the blurry ones, the crumpled ones, the ones that make your data entry team cry — and throw them at Textract’s free tier. See what happens.</p><p>Worst case? You waste 20 minutes. Best case? You automate away the most boring part of someone’s job.</p><p><em>What documents are you still processing manually? Seriously, I want to know — what’s the worst document type you deal with regularly? Drop a comment.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7124516309b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bedrock Converse API vs InvokeModel: The Tale of Two APIs (And Why Your Choice Actually Matters)]]></title>
            <link>https://medium.com/@rushenssamodya/bedrock-converse-api-vs-invokemodel-the-tale-of-two-apis-and-why-your-choice-actually-matters-d98b9bccabc0?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/d98b9bccabc0</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[amazon-bedrock]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Wed, 12 Nov 2025 06:35:09 GMT</pubDate>
            <atom:updated>2025-11-12T06:35:09.296Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*lTtmyZDbAoDejQbpi3jqdA.png" /></figure><h3>The Coffee Shop Analogy</h3><p>Imagine you walk into a coffee shop. You have two options:</p><p><strong>Option A:</strong> You sit at the counter, chat with the barista about your day, they remember your name, ask about your usual order, and you have a conversation while they make your coffee. Multiple exchanges. Personal. Connected.</p><p><strong>Option B:</strong> You walk to a kiosk, tap exactly what you want, pay, and get your coffee. One interaction. Efficient. Done.</p><p>Neither is “better.” They serve different needs. Welcome to Bedrock’s two APIs.</p><h3>What We’re Actually Talking About</h3><p>Amazon Bedrock gives you access to powerful AI models like Claude, Llama, and others. But there are <strong>two different ways</strong> to talk to these models:</p><ol><li><strong>Converse API</strong> — The conversation-oriented interface</li><li><strong>InvokeModel API</strong> — The direct invocation interface</li></ol><p>Same models. Same data centers. Different approaches. Let’s understand why both exist.</p><h3>Understanding Through Scenarios</h3><h3>Scenario 1: The Customer Support Chatbot</h3><p><strong>Your mission:</strong> Build a chatbot that helps users troubleshoot technical issues. Users ask questions, the bot responds, users ask follow-ups, and the conversation flows naturally.</p><p><strong>Example conversation:</strong></p><blockquote><em>User: “My application won’t start” Bot: “I can help! What error message are you seeing?” User: “It says ‘Connection timeout’” Bot: “Ah, that’s a network issue. Are you behind a corporate firewall?” User: “Yes, I am” Bot: “Here’s what you need to do…”</em></blockquote><p><strong>What you need:</strong></p><ul><li>Remember conversation history</li><li>Maintain context across multiple turns</li><li>Track what was said 3 messages ago</li></ul><p>&lt;aside&gt; 💡</p><p><strong>The right tool:</strong> <strong>Converse API</strong></p><p>&lt;/aside&gt;</p><pre>*# Converse API - Built for conversations*<br>conversation_history = []<br>*# First message*<br>conversation_history.append({<br>    &quot;role&quot;: &quot;user&quot;,<br>    &quot;content&quot;: [{&quot;text&quot;: &quot;My application won&#39;t start&quot;}]<br>})</pre><pre>response = bedrock_runtime.converse(<br>    modelId=&quot;anthropic.claude-3-sonnet-20240229-v1:0&quot;,<br>    messages=conversation_history<br>)</pre><pre>*# Bot&#39;s response is automatically added to history*<br>conversation_history.append({<br>    &quot;role&quot;: &quot;assistant&quot;, <br>    &quot;content&quot;: response[&quot;output&quot;][&quot;message&quot;][&quot;content&quot;]<br>})</pre><pre>*# Second message - context is preserved*<br>conversation_history.append({<br>    &quot;role&quot;: &quot;user&quot;,<br>    &quot;content&quot;: [{&quot;text&quot;: &quot;It says &#39;Connection timeout&#39;&quot;}]<br>})</pre><pre>response = bedrock_runtime.converse(<br>    modelId=&quot;anthropic.claude-3-sonnet-20240229-v1:0&quot;,<br>    messages=conversation_history<br>    *# Full context sent*<br>)</pre><p><strong>Why this works:</strong> Converse API is designed around the conversation pattern. It expects multiple turns and makes managing that history straightforward.</p><h3>Scenario 2: The Document Analysis Pipeline</h3><p><strong>Your mission:</strong> Build a system that processes documents uploaded by users. Each document is analyzed independently. Extract information, return structured data, move to next document.</p><p><strong>Example workflow:</strong></p><ol><li>User uploads Document A → Analyze → Return JSON → Done</li><li>User uploads Document B → Analyze → Return JSON → Done</li><li>User uploads Document C → Analyze → Return JSON → Done</li></ol><p><strong>What you need:</strong></p><ul><li>Process one document at a time</li><li>No memory of previous documents needed</li><li>Maximum file size support</li><li>Simple request-response pattern</li></ul><p>&lt;aside&gt; 💡</p><p><strong>The right tool:</strong> <strong>InvokeModel API</strong></p><p>&lt;/aside&gt;</p><pre>*# InvokeModel API - Built for single-shot inference*<br>def analyze_document(document_bytes, document_type):<br>    &quot;&quot;&quot;<br>    Analyze one document. No history. No context.<br>    Just: input → process → output.<br>    &quot;&quot;&quot;<br>    request_body = {<br>        &quot;anthropic_version&quot;: &quot;bedrock-2023-05-31&quot;,<br>        &quot;max_tokens&quot;: 4000,<br>        &quot;temperature&quot;: 0.1,<br>        &quot;system&quot;: f&quot;Extract structured data from this {document_type}.&quot;,<br>        &quot;messages&quot;: [{<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;content&quot;: [<br>                {&quot;type&quot;: &quot;text&quot;, &quot;text&quot;: &quot;Analyze this document&quot;},<br>                {<br>                    &quot;type&quot;: &quot;image&quot;,<br>                    &quot;source&quot;: {<br>                        &quot;type&quot;: &quot;base64&quot;,<br>                        &quot;media_type&quot;: &quot;image/png&quot;,<br>                        &quot;data&quot;: base64.b64encode(document_bytes).decode()<br>                    }<br>                }<br>            ]<br>        }]<br>    }<br>    <br>    response = bedrock_runtime.invoke_model(<br>        modelId=&quot;anthropic.claude-3-haiku-20240307-v1:0&quot;,<br>        body=json.dumps(request_body)<br>    )<br>    <br>    return json.loads(response[&quot;body&quot;].read())[&quot;content&quot;][0][&quot;text&quot;]</pre><p><strong>Process documents independently</strong></p><p>result1 = analyze_document(doc1, “invoice”) result2 = analyze_document(doc2, “contract”) result3 = analyze_document(doc3, “form”)</p><p>No relationship between these calls.</p><p><strong>Why this works:</strong> InvokeModel is optimized for stateless, independent invocations. No conversation overhead. Just process and return.</p><h3>The Hidden Difference That Matters</h3><p>Here’s where things get interesting. Let’s talk about <strong>payload limits</strong> — something AWS doesn’t put in bold letters.</p><h3>Scenario 3: The High-Resolution Image Problem</h3><p>You’re building an image analysis service. Most images are small (1–2 MB), but occasionally users upload high-quality scans or photos (4–5 MB).</p><p><strong>With Converse API:</strong></p><pre># Works fine for most images<br>small_image = load_image(&quot;photo_1.jpg&quot;)  # 2.1 MB<br>response = bedrock_runtime.converse(<br>    modelId=MODEL_ID,<br>    messages=[{<br>        &quot;role&quot;: &quot;user&quot;,<br>        &quot;content&quot;: [{<br>            &quot;image&quot;: {<br>                &quot;format&quot;: &quot;jpeg&quot;,<br>                &quot;source&quot;: {&quot;bytes&quot;: small_image}<br>            }<br>        }]<br>    }]<br>)<br># ✅ Success!</pre><pre># But then...<br>large_image = load_image(&quot;scan_001.jpg&quot;)  # 4.2 MB<br>response = bedrock_runtime.converse(<br>    modelId=MODEL_ID,<br>    messages=[{<br>        &quot;role&quot;: &quot;user&quot;,<br>        &quot;content&quot;: [{<br>            &quot;image&quot;: {<br>                &quot;format&quot;: &quot;jpeg&quot;,<br>                &quot;source&quot;: {&quot;bytes&quot;: large_image}<br>            }<br>        }]<br>    }]<br>)<br># ❌ Error: Payload too large<br># Converse API limit: ~3.75 MB (base64 encoded)</pre><p><strong>With InvokeModel API:</strong></p><pre># Same large image<br>large_image = load_image(&quot;scan_001.jpg&quot;)  # 4.2 MB</pre><pre>request_body = {<br>    &quot;anthropic_version&quot;: &quot;bedrock-2023-05-31&quot;,<br>    &quot;max_tokens&quot;: 2000,<br>    &quot;messages&quot;: [{<br>        &quot;role&quot;: &quot;user&quot;,<br>        &quot;content&quot;: [{<br>            &quot;type&quot;: &quot;image&quot;,<br>            &quot;source&quot;: {<br>                &quot;type&quot;: &quot;base64&quot;,<br>                &quot;media_type&quot;: &quot;image/jpeg&quot;,<br>                &quot;data&quot;: base64.b64encode(large_image).decode()<br>            }<br>        }]<br>    }]<br>}</pre><pre>response = bedrock_runtime.invoke_model(<br>    modelId=MODEL_ID,<br>    body=json.dumps(request_body)<br>)<br># ✅ Success! InvokeModel supports up to ~5 MB</pre><p><strong>The lesson:</strong> If you’re processing large files (high-res images, multi-page PDFs, detailed scans), InvokeModel gives you that extra headroom.</p><h3>Our Real-World Journey</h3><p>Let me share how we learned this lesson. We built a document extraction service to process various business documents — invoices, contracts, forms, receipts, you name it</p><h3>Phase 1: The Easy Start</h3><p>We started with Converse API. Why? Because the code looked cleaner in examples, and we thought “conversational AI” sounded more advanced.</p><pre># Our initial implementation - Converse API<br>def extract_data(document):<br>    return bedrock_runtime.converse(<br>        modelId=MODEL_ID,<br>        messages=[{<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;content&quot;: [{&quot;text&quot;: &quot;Extract data&quot;}, {&quot;image&quot;: {...}}]<br>        }]<br>    )</pre><p><strong>Status:</strong> Working great! ✅</p><p><strong>Team mood:</strong> Happy 😊</p><p><strong>Coffee consumption:</strong> Normal ☕</p><h3>Phase 2: The Surprise</h3><p>Two weeks in production. Everything smooth. Then:</p><pre># Monitoring logs<br>INFO: Processed invoice_001.pdf - Success (2.1 MB)<br>INFO: Processed contract_042.pdf - Success (1.8 MB)<br>ERROR: Processed scan_high_res.pdf - FAILED (4.3 MB)<br>ERROR: Payload exceeds maximum size</pre><p><strong>Status:</strong> Some files failing ❌</p><p><strong>Team mood:</strong> Concerned 😟</p><p><strong>Coffee consumption:</strong> Elevated ☕☕</p><h3>Phase 3: The Investigation</h3><p>We dug into AWS documentation (always an adventure). Found this in a comparison table:</p><p><strong>API</strong> <strong>Max Payload (encoded)</strong> Converse ~3.75 MB InvokeModel ~5 MB</p><p><strong>The realization:</strong> Our architecture choice was limiting our file size support.</p><h3>Phase 4: The Decision</h3><p>We had three options:</p><p><strong>Option A: Image Compression</strong></p><ul><li>Downscale all images to fit under 3.75 MB</li><li>Risk: Losing detail in high-resolution documents</li><li>Effort: Medium</li></ul><p><strong>Option B: Reject Large Files</strong></p><ul><li>Add validation, reject files over 3.75 MB</li><li>Risk: Poor user experience</li><li>Effort: Low</li></ul><p><strong>Option C: Switch to InvokeModel</strong></p><ul><li>Rewrite API calls to use InvokeModel</li><li>Risk: Code changes, testing required</li><li>Effort: Medium-High</li></ul><p><strong>We chose Option C.</strong> Here’s why:</p><ol><li><strong>Future-proofing:</strong> Users might send even larger files</li><li><strong>Quality:</strong> We didn’t want to compromise document clarity</li><li><strong>Learning:</strong> Understanding both APIs made us better engineers</li></ol><h3>Phase 5: The Migration</h3><pre># BEFORE - Converse API<br>def extract_data_v1(document_bytes):<br>    response = bedrock_runtime.converse(<br>        modelId=MODEL_ID,<br>        messages=[{<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;content&quot;: [<br>                {&quot;text&quot;: &quot;Extract structured data&quot;},<br>                {&quot;image&quot;: {&quot;format&quot;: &quot;png&quot;, &quot;source&quot;: {&quot;bytes&quot;: document_bytes}}}<br>            ]<br>        }]<br>    )<br>    return response[&quot;output&quot;][&quot;message&quot;][&quot;content&quot;][0][&quot;text&quot;]</pre><pre># AFTER - InvokeModel API<br>def extract_data_v2(document_bytes):<br>    request = {<br>        &quot;anthropic_version&quot;: &quot;bedrock-2023-05-31&quot;,<br>        &quot;max_tokens&quot;: 4000,<br>        &quot;system&quot;: &quot;Extract structured data from documents&quot;,<br>        &quot;messages&quot;: [{<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;content&quot;: [{<br>                &quot;type&quot;: &quot;image&quot;,<br>                &quot;source&quot;: {<br>                    &quot;type&quot;: &quot;base64&quot;,<br>                    &quot;media_type&quot;: &quot;image/png&quot;,<br>                    &quot;data&quot;: base64.b64encode(document_bytes).decode()<br>                }<br>            }]<br>        }]<br>    }<br>    <br>    response = bedrock_runtime.invoke_model(<br>        modelId=MODEL_ID,<br>        body=json.dumps(request)<br>    )<br>    <br>    result = json.loads(response[&quot;body&quot;].read())<br>    return result[&quot;content&quot;][0][&quot;text&quot;]</pre><p><strong>Migration time:</strong> 3 hours (including testing)</p><p><strong>Downtime:</strong> Zero (we deployed during low traffic)</p><p><strong>Result:</strong> That 4.3 MB file? Processed successfully ✅</p><h3>The Conceptual Framework: When to Use What</h3><p>Let’s build a mental model. Think of your AI interaction as falling into one of two categories:</p><h3>Category 1: Stateful Interactions (Converse API)</h3><p><strong>Characteristics:</strong></p><ul><li>Multiple messages form a conversation</li><li>Context from earlier messages matters</li><li>User expects the AI to “remember”</li><li>Back-and-forth dialogue</li></ul><p><strong>Examples:</strong></p><ul><li>Chatbots</li><li>Virtual assistants</li><li>Interactive tutors</li><li>Ongoing technical support</li><li>Creative writing collaborations</li></ul><p><strong>Code pattern:</strong></p><pre># State is maintained across calls<br>messages = []<br>for user_input in conversation:<br>    messages.append({&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: [{&quot;text&quot;: user_input}]})<br>    response = bedrock.converse(messages=messages)<br>    messages.append(response[&quot;output&quot;][&quot;message&quot;])</pre><h3>Category 2: Stateless Transactions (InvokeModel API)</h3><p><strong>Characteristics:</strong></p><ul><li>Each request is independent</li><li>No memory needed between requests</li><li>Input → Process → Output pattern</li><li>Maximum payload size needed</li></ul><p><strong>Examples:</strong></p><ul><li>Document analysis</li><li>Image classification</li><li>Content moderation</li><li>Data extraction</li><li>Sentiment analysis</li><li>Translation services</li></ul><p><strong>Code pattern:</strong></p><pre># Each call is independent<br>for item in items_to_process:<br>    result = bedrock.invoke_model(<br>        body=build_request(item)<br>    )<br>    save_result(result)</pre><h3>Key Takeaways</h3><ol><li><strong>Both APIs access the same models</strong> — Claude, Llama, etc. Same intelligence, different interfaces.</li><li><strong>Converse = Conversations</strong> — Built for multi-turn interactions where context matters.</li><li><strong>InvokeModel = Transactions</strong> — Built for independent, stateless requests.</li><li><strong>Payload limits differ</strong> — Converse (~3.75 MB) vs InvokeModel (~5 MB). This matters for large files.</li><li><strong>Cost is identical</strong> — Choose based on use case, not cost.</li><li><strong>Migration is manageable</strong> — We did it in 3 hours with zero downtime.</li><li><strong>Abstract your choice</strong> — Write a wrapper so switching later is easy.</li></ol><h3>Final Thoughts</h3><p>We started with Converse because it looked simpler. We switched to InvokeModel when we hit payload limits. Was it the right choice? <strong>For our use case, absolutely.</strong></p><p>But here’s the thing: there’s no universally “better” API. It’s about matching the tool to the task. Building a chatbot? Converse wins. Processing documents one at a time? InvokeModel wins. Need both? Abstract them behind a common interface.</p><p>The best engineers don’t just pick the newest or fanciest tool. They understand the trade-offs and choose deliberately.</p><p><strong>What are you building? Drop a comment and let’s figure out which API fits your use case.</strong></p><p><strong>Found this helpful? Follow for more AWS deep-dives where we explore the things documentation doesn’t make obvious.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d98b9bccabc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Amazon Bedrock: Your First AI Integration (Without Losing Your Mind)]]></title>
            <link>https://medium.com/@rushenssamodya/getting-started-with-amazon-bedrock-your-first-ai-integration-without-losing-your-mind-6296079eaa64?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/6296079eaa64</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[bedrock]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 18:17:02 GMT</pubDate>
            <atom:updated>2025-10-31T18:17:02.696Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uIxdbMhWl4-xa4N0dioDdA.png" /></figure><p>Read time: 5 minutes | Difficulty: Easy as ordering pizza</p><h3>So, You Want to Add AI to Your App? Welcome to the Party! 🎉</h3><p>Remember when adding AI to your application meant hiring a team of PhD data scientists, buying a small data center, and sacrificing your firstborn to the ML gods? Yeah, those days are (mostly) over. Enter Amazon Bedrock — AWS’s way of saying “Hey, we did the hard work, you just need to call an API.”</p><p>Think of Bedrock as the Netflix of AI models. Instead of building and training your own AI from scratch (which is like trying to build your own streaming platform in 2025), you just pick a model, press play, and boom — you’ve got AI superpowers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*NpDnVeVTlb1IuC-JgC1KAQ.gif" /></figure><h3>What Exactly IS Amazon Bedrock?</h3><p>Amazon Bedrock is a fully managed service that gives you access to powerful AI models from companies like Anthropic (makers of Claude), Meta (yes, that Meta), Amazon itself, and others. It’s serverless, which in AWS-speak means “you don’t have to worry about servers” (shocking, I know).</p><p>The best part? You don’t need to:</p><ul><li>Set up infrastructure (no more “works on my machine” excuses)</li><li>Manage model deployments (thank goodness)</li><li>Become an ML expert overnight (your imposter syndrome can take a break)</li></ul><p>You just call an API and get intelligent responses. It’s almost too easy. Almost.</p><h3>Foundation Models vs. Inference Profiles: The Plot Twist Nobody Saw Coming</h3><p>Okay, here’s where it gets interesting. Bedrock gives you TWO ways to use AI models, and picking the wrong one is like bringing a salad to a barbecue — technically fine, but you’ll regret it.</p><h3>Foundation Models: The “My Data Stays Here” Option 🏠</h3><p>Foundation Models are AI models deployed in <strong>one specific AWS region</strong>. When you use them, your data never leaves that region. It’s like having a really smart assistant who’s contractually obligated to never leave your office.</p><p><strong>Why this matters:</strong></p><ul><li>Your customer data stays in their own region(regulators love this)</li><li>Compliance teams stop sending you scary emails</li><li>You can actually sleep at night knowing where your data lives</li></ul><p><strong>Perfect for:</strong></p><ul><li>When you have data residency requirements</li><li>Regulated industries (healthcare, finance, government)</li><li>Any time someone mentions “GDPR” in a meeting😉</li></ul><h3>Inference Profiles: The “I Need Speed!” Option 🚀</h3><p>Inference Profiles use <strong>cross-region inference</strong>, which means AWS can route your request to any available region to give you faster responses and handle traffic spikes. It’s like having a really smart assistant who can teleport to wherever there’s less queue.</p><p><strong>The catch?</strong> Your data might be processed in different regions. For some use cases, this is totally fine. For others… well, that’s a conversation with your legal team.</p><p><strong>Perfect for:</strong></p><ul><li>High-traffic applications</li><li>When you need guaranteed availability</li><li>Times when “data went to Oregon for processing” is acceptable</li></ul><h3>The Million Dollar Question: Which One Do I Use?</h3><p>Here’s a simple decision tree:</p><ul><li><strong>Need data to stay in one region?</strong> → Foundation Models</li><li><strong>Need to handle massive traffic spikes?</strong> → Inference Profiles</li><li><strong>Both?</strong> → Time to talk to an architect🤨</li></ul><h3>Your First API Call: Let’s Get Our Hands Dirty</h3><p>Ready to actually DO something? Here’s a dead-simple Python example:</p><pre>import boto3<br># Set up the client (it&#39;s like introducing yourself)<br>bedrock = boto3.client(&#39;bedrock-runtime&#39;, region_name=&#39;ap-southeast-2&#39;)  # Sydney, mate!<br># Craft your prompt (this is the fun part)<br>prompt = &quot;Explain quantum computing to a golden retriever&quot;<br># Make the call (hold your breath)<br>response = bedrock.invoke_model(<br>    modelId=&#39;anthropic.claude-3-5-sonnet-20241022-v2:0&#39;,  # Using a Foundation Model<br>    body=json.dumps({<br>        &quot;anthropic_version&quot;: &quot;bedrock-2023-05-31&quot;,<br>        &quot;messages&quot;: [{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}],<br>        &quot;max_tokens&quot;: 500<br>    })<br>)<br># Get your response (celebrate! 🎊)<br>result = json.loads(response[&#39;body&#39;].read())<br>print(result[&#39;content&#39;][0][&#39;text&#39;])</pre><p>That’s it. You just used AI. Go tell your manager you “implemented machine learning infrastructure.” They don’t need to know it was 10 lines of code.</p><h3>Prompt Engineering: Talking to AI Without Feeling Stupid</h3><p>Here’s the secret: AI models are like incredibly smart but literal-minded interns. You need to be specific, or you’ll get technically correct but useless answers.</p><p><strong>Bad prompt:</strong> “Tell me about invoices” <strong>Good prompt:</strong> “Extract the total amount, date, and vendor name from this invoice image and return it as JSON”</p><p>Pro tips:</p><ul><li>Be specific (vague questions get vague answers)</li><li>Give examples (few-shot learning is your friend)</li><li>Use structured outputs for data (JSON is your best friend)</li></ul><h3>Cool Stuff You Can Do (Beyond Basic Chat)</h3><h3>Knowledge Bases: Give Your AI Superpowers 🧠</h3><p>Want your AI to answer questions about YOUR company’s data? Knowledge Bases let you connect your documents, and Bedrock handles the “Retrieval Augmented Generation” (RAG) magic. It’s like giving the AI a really good textbook before the exam.</p><h3>Agents: AI That Actually DOES Things 🤖</h3><p>Bedrock Agents can break down complex tasks, make decisions, and even call your APIs. They’re like having a junior developer who never sleeps, complains, or asks for coffee.</p><h3>Guardrails: Keep Your AI From Going Rogue 🚧</h3><p>Worried about your AI saying something inappropriate? Guardrails filter content, block PII, and prevent hallucinations. Think of it as a professional PR team for your AI.</p><h3>Security: Because “YOLO” Isn’t a Strategy</h3><p>Quick security checklist:</p><ul><li>✅ Use VPC endpoints for private access (no public internet exposure)</li><li>✅ Set up proper IAM roles (principle of least privilege, people!)</li><li>✅ Enable encryption (it’s 2025, this should be automatic)</li><li>✅ Choose the right region for your data (remember: Foundation Models = data stays put)</li></ul><h3>The Money Talk: What’s This Going to Cost Me?</h3><p>Bedrock uses token-based pricing. A token is roughly 4 characters (or about ¾ of a word). You pay for:</p><ul><li><strong>Input tokens</strong> (what you send)</li><li><strong>Output tokens</strong> (what you get back)</li></ul><p>Example: Claude Sonnet costs about $3 per million input tokens. So if you process 1,000 customer queries at 500 tokens each, that’s like… $1.50. Your daily coffee costs more.</p><p><strong>Money-saving hacks:</strong></p><ul><li>Use prompt caching (90% discount on repeated context!)</li><li>Batch inference for non-urgent tasks (50% cheaper)</li><li>Pick the right model (don’t use a Ferrari to go to the corner store)</li></ul><h3>Real Talk: Our Document Extraction Story</h3><p>We built a document extraction service that processes receipts, invoices, and timesheets. Here’s why we made certain choices:</p><p><strong>Why Foundation Models?</strong> Our data needed to stay in Australia. Period. No negotiations. Using Inference Profiles would’ve meant data potentially going to other regions, which would’ve made our compliance team have a collective meltdown.</p><p><strong>Why VPC-only?</strong> Public internet access to an internal document processing system? That’s a “no” from everyone in the security meeting.</p><p><strong>Why Claude?</strong> After testing multiple models, Claude gave us the best accuracy for structured data extraction. Also, it understood Australian tax invoice formats without excessive prompt engineering. Win-win.</p><h3>Your Next Steps (Go Forth and Build!)</h3><ol><li><strong>Set up your AWS account</strong> (if you haven’t already)</li><li><strong>Pick your region</strong> based on data requirements</li><li><strong>Start with the Playground</strong> (it’s like training wheels for AI)</li><li><strong>Write your first integration</strong> (remember: 10 lines of code is all you need)</li><li><strong>Test, iterate, and celebrate</strong> (you’re an AI engineer now!)</li></ol><h3>The TL;DR (Because You Probably Skimmed to Here)</h3><ul><li><strong>Amazon Bedrock</strong> = Easy AI integration without the infrastructure headache</li><li><strong>Foundation Models</strong> = Your data stays in one region (compliance team approved)</li><li><strong>Inference Profiles</strong> = Cross-region magic for high availability (when data travel is okay)</li><li><strong>Getting started</strong> = Easier than assembling IKEA furniture</li><li><strong>Cost</strong> = Cheaper than your streaming subscriptions</li><li><strong>Security</strong> = Take it seriously (please)</li></ul><p>Now stop reading and go build something cool! And when your AI-powered app goes viral, remember who explained the difference between Foundation Models and Inference Profiles in terms you could actually understand. 😉</p><p><strong>Want more?</strong> Check out the <a href="https://docs.aws.amazon.com/bedrock/">AWS Bedrock documentation</a> or just ask an AI to explain it to you. Meta, right?</p><p><strong>Questions?</strong> Drop them in the comments, or ask from an AI. It’s probably better at answering than I am.</p><p><strong>Disclaimer:</strong> No AI models were harmed in the making of this blog post. Some were mildly confused by my prompts, but they’re fine now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6296079eaa64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker: The Magic Tool That’ll Make You Wonder How You Ever Lived Without It]]></title>
            <link>https://medium.com/@rushenssamodya/docker-the-magic-tool-thatll-make-you-wonder-how-you-ever-lived-without-it-b7b39f7d5610?source=rss-29c1a0896776------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7b39f7d5610</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[basic-docker-command]]></category>
            <category><![CDATA[docker-basic]]></category>
            <dc:creator><![CDATA[Rushen Samodya]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 04:14:08 GMT</pubDate>
            <atom:updated>2025-10-31T04:14:08.504Z</atom:updated>
            <content:encoded><![CDATA[<p>Or: How I Stopped Worrying and Learned to Love Containers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Rz5tPL9qfuwkwzEK5EmgA.png" /></figure><h3>The Problem We All Pretend Doesn’t Exist</h3><p>Picture this: It’s 2 AM. You’ve been trying to install PostgreSQL for the past three hours. Your computer has been restarted twice. You’ve googled “PostgreSQL installation error” approximately 47 times. There are config files scattered across your system like breadcrumbs in a horror movie.</p><p>And the best part? Even if you get it working, your teammate Sarah will have to go through the exact same nightmare tomorrow.</p><p>Welcome to software development in 2025, baby! 🎉</p><p>But wait — what if I told you there’s a better way? A way where you can install PostgreSQL in literally 10 seconds? A way where your entire team can have identical setups without anyone crying into their keyboard?</p><p>Enter Docker. The superhero we didn’t know we needed.</p><h3>So… What Even IS Docker?</h3><p>Okay, let’s use an analogy that actually makes sense.</p><p><strong>Your computer is an apartment building.</strong></p><p>When you install software the “normal” way (aka the soul-crushing way), you’re basically letting every program redecorate your entire building. PostgreSQL wants to paint the lobby blue. MySQL is installing chandeliers in the hallway. Redis is knocking down walls. Before you know it, your building is a chaotic mess and nobody can find the bathroom.</p><p><strong>Docker is different.</strong></p><p>With Docker, each program gets its own self-contained apartment. PostgreSQL lives in apartment 3B with everything it needs — furniture, utilities, the whole package. MySQL has apartment 4C. Redis is chilling in 2A.</p><p>They’re all in the same building (your computer), but they’re completely isolated from each other. No conflicts. No drama. No “well it works on MY machine” excuses.</p><p>And the best part? When you’re done with a project, you can just delete that apartment. <strong>Poof.</strong> Gone. No leftover files haunting your system like digital ghosts.</p><h3>The “Holy Crap, That’s Actually Magic” Moment</h3><p>Let me show you something wild.</p><p><strong>The old way to install PostgreSQL:</strong></p><ol><li>Download the installer (10 minutes)</li><li>Run the installer (5 minutes)</li><li>Configure everything (15 minutes)</li><li>Troubleshoot why it’s not working (2 hours)</li><li>Google error messages (∞ minutes)</li><li>Sacrifice a USB drive to the tech gods</li><li>Maybe it works?</li></ol><p><strong>The Docker way:</strong></p><p>Type this one line:</p><p><strong><em>docker run -d postgres</em></strong></p><p>That’s it. You’re done. PostgreSQL is running.</p><p>I’m not even kidding. It takes like 10 seconds.</p><p>“But wait,” I hear you say, “what if I need PostgreSQL 15 for one project and PostgreSQL 16 for another?”</p><p>Glad you asked!</p><p><strong><em>docker run -d postgres:15</em></strong></p><p><strong><em>docker run -d postgres:16</em></strong></p><p><strong><em>docker run -d postgres:14</em></strong></p><p>Boom. Three different versions. Running simultaneously. Zero conflicts.</p><p>Try doing THAT with traditional installations without wanting to throw your laptop out the window.</p><h3>The Team Collaboration Game-Changer</h3><p>Here’s where Docker goes from “pretty cool” to “I’m literally never going back.”</p><p>You know that classic developer excuse: <strong>“But it works on my machine!”</strong></p><p>Yeah, Docker murders that excuse. Straight up destroys it.</p><p>Here’s how:</p><p>You create one file called <strong>docker-compose.yml</strong> that describes your entire project setup — database, backend, cache, whatever. Then you commit it to your repo.</p><p>Your new teammate Alex joins the team. They clone the repo and run:</p><p><strong><em>docker-compose up</em></strong></p><p>And just like that, Alex has the EXACT same environment as you. Same PostgreSQL version. Same Node.js version. Same everything.</p><p>No Slack messages asking “which version of Redis should I install?”</p><p>No hour-long Zoom calls walking them through setup.</p><p>No “it works on Windows but not on Mac” nonsense.</p><p>It just… works. For everyone. Every time.</p><p>I nearly cried the first time I experienced this.</p><h3>The Clean Freak’s Dream</h3><p>Let’s talk about what happens when you’re done with a project.</p><p><strong>Traditional installation cleanup:</strong></p><ul><li>Uninstall PostgreSQL (leaves 47 registry entries)</li><li>Find and delete config files (they’re EVERYWHERE)</li><li>Remove startup services (good luck)</li><li>Clear environment variables</li><li>Sacrifice another USB drive</li><li>Pray you didn’t break something else</li></ul><p><strong>Docker cleanup:</strong></p><p><strong><em>docker stop my-project</em></strong></p><p><strong><em>docker rm my-project</em></strong></p><p>Done. Completely gone. Zero trace. Your system is as clean as before you started.</p><p>It’s like those satisfying cleaning videos on TikTok, but for your computer.</p><h3>But Wait, There’s More! (I’m Not Done Hyping This Yet)</h3><p>Docker isn’t just for databases. Oh no. You can Dockerize basically ANYTHING.</p><p>Want to try out a different Node.js version? <strong><em>docker run -it node:20</em></strong></p><p>Need to test your app on Ubuntu without installing Ubuntu? <strong><em>docker run -it ubuntu</em></strong></p><p>Want to run a Jupyter notebook for some quick data science? <strong><em>docker run -p 8888:8888 jupyter/scipy-notebook</em></strong></p><p>Need MongoDB, Redis, and Nginx for your project? Done in three commands.</p><p>It’s like having infinite computers at your disposal, each perfectly configured for whatever you need.</p><h3>The Part Where I Address Your Concerns</h3><p><strong>“Isn’t Docker complicated?”</strong></p><p>The basics? Nah. You literally just learned most of it. docker run, docker stop, docker rm. That’s like 80% of what you’ll use daily.</p><p><strong>“Won’t it slow down my computer?”</strong></p><p>Docker is surprisingly lightweight. It’s way lighter than running actual virtual machines. Your computer barely notices.</p><p><strong>“What if I’m on Windows?”</strong></p><p>Docker works great on Windows! It uses WSL2 (Windows Subsystem for Linux) behind the scenes. You don’t even have to think about it.</p><p><strong>“Do I have to abandon all my current projects?”</strong></p><p>Nope! You can gradually Dockerize things as needed. Your old setups will keep working while you transition.</p><h3>Real Talk: Why Every Developer Should Learn This</h3><p>Look, I’m not saying Docker will solve all your problems. It won’t fix your imposter syndrome. It won’t make you suddenly understand CSS. It won’t help with that one weird bug that only happens on Tuesdays.</p><p>But it WILL:</p><p>✅ Save you hours of setup time</p><p>✅ Eliminate “works on my machine” forever</p><p>✅ Let you experiment without fear</p><p>✅ Make team collaboration actually pleasant</p><p>✅ Keep your system clean and organized</p><p>✅ Give you multiple versions of anything, simultaneously</p><p>✅ Make you look like a wizard to non-Docker users</p><p>And honestly? In 2025, Docker is just one of those things you should know. Like Git. Like how to Google error messages. Like the importance of backing up your work.</p><p>It’s not optional knowledge anymore. It’s baseline.</p><h3>Getting Started (Yes, Right Now)</h3><p><strong>Step 1:</strong> Install Docker Desktop</p><p>Go to <a href="http://docker.com/">docker.com</a> and download it. Installation is straightforward. I believe in you.</p><p><strong>Step 2:</strong> Open your terminal and run:</p><p><strong>docker run -d -p 80:80 docker/getting-started</strong></p><p><strong>Step 3:</strong> Open your browser to localhost:80</p><p>Congrats! You just ran your first Docker container. There’s an interactive tutorial right there in your browser.</p><p><strong>Step 4:</strong> Try running a database:</p><p><strong>docker run — name my-postgres -e POSTGRES_PASSWORD=password123 -p 5432:5432 -d postgres</strong></p><p>You now have PostgreSQL running. Connect to it at localhost:5432 with password “password123”</p><p><strong>Step 5:</strong> When you’re done:</p><p><strong>docker stop my-postgres</strong></p><p><strong>docker rm my-postgres</strong></p><p>Clean slate. Like it never happened.</p><h3>The Bottom Line</h3><p>Docker is one of those rare tools that actually lives up to the hype. It’s not just another JavaScript framework that’ll be dead in six months. It’s been around since 2013 and it’s only getting more popular.</p><p>Why? Because it solves real problems that developers face every single day.</p><p>No more environment setup hell.</p><p>No more “works on my machine” excuses.</p><p>No more system clutter from abandoned projects.</p><p>Just clean, isolated, reproducible environments that work the same way for everyone.</p><p>So yeah. Learn Docker. Your future self will thank you.</p><p>And your teammates? They’ll probably buy you coffee.</p><h3>Quick Cheat Sheet (Bookmark This)</h3><p><strong>Run a container:</strong></p><p>docker run -d postgres</p><p><strong>List running containers:</strong></p><p><em>docker ps</em></p><p><strong>Stop a container:</strong></p><p><em>docker stop container-name</em></p><p><strong>Remove a container:</strong></p><p><em>docker rm container-name</em></p><p><strong>See all images:</strong></p><p><em>docker images</em></p><p><strong>Remove an image:</strong></p><p><em>docker rmi image-name</em></p><p><strong>View container logs:</strong></p><p><em>docker logs container-name</em></p><p><strong>Run with custom port:</strong></p><p><em>docker run -p 3000:80 nginx</em></p><p><strong>That’s literally 80% of what you’ll use. You’re welcome.</strong></p><h3>One Last Thing</h3><p>If you learned something from this post, great! Go try Docker out. Break things. Experiment. That’s the whole point — you literally can’t mess up your system because everything’s isolated.</p><p>And if you’re still on the fence? Just install it. Run that PostgreSQL command I showed you earlier. See how stupidly easy it is.</p><p>Then come back and tell me I was wrong. (Spoiler: You won’t.)</p><p>Now go forth and containerize all the things! 🐳</p><p><strong>P.S.</strong> Yes, that whale emoji is Docker’s logo. No, I don’t know why a whale. Yes, it’s adorable. No, you can’t resist using it once you start with Docker. 🐳🐳🐳</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7b39f7d5610" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>