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
- The user uploads a receipt.
- The API generates a SHA-256 hash to detect duplicate receipts.
- If it's new, the image is uploaded to S3 and a job is added to SQS.
- The API immediately responds so the user isn't waiting.
- A background worker downloads the image, extracts text with EasyOCR, and uses Llama to clean and structure the data.
- Product names are matched against the database using PostgreSQL's
pg_trgmextension for fast fuzzy matching. - 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.
Top comments (0)