惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
Vercel News
Vercel News
L
LangChain Blog
B
Blog RSS Feed
Y
Y Combinator Blog
IT之家
IT之家
H
Hackread – Cybersecurity News, Data Breaches, AI and More
GbyAI
GbyAI
V
V2EX
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
阮一峰的网络日志
阮一峰的网络日志
有赞技术团队
有赞技术团队
D
Docker
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
月光博客
月光博客

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How I Built SmartBasket: A Decoupled Real-Time Retail Opt...
Yason · 2026-06-28 · via DEV Community
Cover image for How I Built SmartBasket: A Decoupled Real-Time Retail Optimizer with Next.js, FastAPI, and Amazon Aurora PostgreSQL

Yason

Building SmartBasket: Find the Cheapest Groceries from a Receipt

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.

That's why I built SmartBasket.

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.

Disclaimer: This project was built for the "Hack the Zero Stack with Vercel v0 and AWS Databases" Hackathon (#H0Hackathon).

Architecture

The app is split into independent services so uploads stay fast while heavy AI processing happens in the background.

  • Frontend: Next.js on Vercel (built with v0)
  • API: FastAPI running on AWS EC2
  • Storage: Amazon S3
  • Queue: Amazon SQS
  • Database: Amazon Aurora PostgreSQL
  • AI: EasyOCR + Groq Llama 3

How It Works

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

Challenges

Duplicate uploads

Hashing every receipt before processing avoids repeating expensive AI work.

OCR mistakes

Receipt scans often confuse characters like £ and 8. I added validation rules to detect unrealistic prices before storing them.

Real-time notifications

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.

What I Learned

One of the biggest takeaways was that you don't need to sacrifice scalability for rapid development.

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 (pg_trgm) also eliminated the need for an external search service, making product matching both fast and inexpensive.

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