<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yason</title>
    <description>The latest articles on DEV Community by Yason (@yasonling95).</description>
    <link>https://dev.to/yasonling95</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4005938%2F8edc073d-14b5-43f7-a326-978ef9bddfb9.png</url>
      <title>DEV Community: Yason</title>
      <link>https://dev.to/yasonling95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yasonling95"/>
    <language>en</language>
    <item>
      <title>How I Built SmartBasket: A Decoupled Real-Time Retail Optimizer with Next.js, FastAPI, and Amazon Aurora PostgreSQL</title>
      <dc:creator>Yason</dc:creator>
      <pubDate>Sun, 28 Jun 2026 00:43:36 +0000</pubDate>
      <link>https://dev.to/yasonling95/how-i-built-smartbasket-a-decoupled-real-time-retail-optimizer-with-nextjs-fastapi-and-amazon-39jc</link>
      <guid>https://dev.to/yasonling95/how-i-built-smartbasket-a-decoupled-real-time-retail-optimizer-with-nextjs-fastapi-and-amazon-39jc</guid>
      <description>&lt;h1&gt;
  
  
  Building SmartBasket: Find the Cheapest Groceries from a Receipt
&lt;/h1&gt;

&lt;p&gt;Grocery prices change all the time, and comparing prices across supermarkets is a hassle. Most people won't spend time checking every item in multiple apps before shopping.&lt;/p&gt;

&lt;p&gt;That's why I built &lt;strong&gt;SmartBasket&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;SmartBasket lets users upload a photo of a shopping receipt, extracts every item using AI, compares prices across supermarkets, and recommends where to save money on the next shop.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclaimer: This project was built for the "Hack the Zero Stack with Vercel v0 and AWS Databases" Hackathon (#H0Hackathon).&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;The app is split into independent services so uploads stay fast while heavy AI processing happens in the background.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; Next.js on Vercel (built with v0)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API:&lt;/strong&gt; FastAPI running on AWS EC2&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage:&lt;/strong&gt; Amazon S3&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Queue:&lt;/strong&gt; Amazon SQS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; Amazon Aurora PostgreSQL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI:&lt;/strong&gt; EasyOCR + Groq Llama 3&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;The user uploads a receipt.&lt;/li&gt;
&lt;li&gt;The API generates a SHA-256 hash to detect duplicate receipts.&lt;/li&gt;
&lt;li&gt;If it's new, the image is uploaded to S3 and a job is added to SQS.&lt;/li&gt;
&lt;li&gt;The API immediately responds so the user isn't waiting.&lt;/li&gt;
&lt;li&gt;A background worker downloads the image, extracts text with EasyOCR, and uses Llama to clean and structure the data.&lt;/li&gt;
&lt;li&gt;Product names are matched against the database using PostgreSQL's &lt;code&gt;pg_trgm&lt;/code&gt; extension for fast fuzzy matching.&lt;/li&gt;
&lt;li&gt;When processing finishes, the frontend receives a real-time update using Server-Sent Events (SSE).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Challenges
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Duplicate uploads
&lt;/h3&gt;

&lt;p&gt;Hashing every receipt before processing avoids repeating expensive AI work.&lt;/p&gt;

&lt;h3&gt;
  
  
  OCR mistakes
&lt;/h3&gt;

&lt;p&gt;Receipt scans often confuse characters like &lt;code&gt;£&lt;/code&gt; and &lt;code&gt;8&lt;/code&gt;. I added validation rules to detect unrealistic prices before storing them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-time notifications
&lt;/h3&gt;

&lt;p&gt;Refreshing the page sometimes caused duplicate or missing notifications. The fix was separating live SSE updates from the initial REST request, ensuring notifications are only sent to active connections.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;One of the biggest takeaways was that you don't need to sacrifice scalability for rapid development.&lt;/p&gt;

&lt;p&gt;Using Vercel v0 made building the frontend incredibly fast, while AWS handled the heavy lifting for storage, processing, and the database. PostgreSQL's built-in trigram search (&lt;code&gt;pg_trgm&lt;/code&gt;) also eliminated the need for an external search service, making product matching both fast and inexpensive.&lt;/p&gt;

&lt;p&gt;The result is a responsive application that can process receipts asynchronously, scale easily, and deliver live updates without blocking the user experience.&lt;/p&gt;

</description>
      <category>h0hackathon</category>
      <category>aws</category>
      <category>vercel</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
