
weekend Annoying Task Challenge: ReceiptRadar
weekend Annoying Task Challenge: ReceiptRadar
Weekend Annoying Task Challenge: ReceiptRadar
Tag: #productivity
Vision & What the app does
Every week ends the same way. I empty my pockets, find a wad of crumpled
receipts, and face a spreadsheet that wants vendor, date, amount and category
typed in by hand. It takes twenty minutes. It is completely mechanical. And
skipping it doesn't make the task disappear — it just makes next week's pile
twice as tall.
ReceiptRadar does the typing. You photograph a receipt, drop it into the
browser, and about four seconds later you have a structured expense row:
vendor, purchase date, subtotal, tax, grand total, currency, payment method,
every line item, and a category. At the end of the month you press Export
CSV and hand the file to whoever was asking for it.
The design goal was narrow on purpose: do one boring thing completely, rather
than five things partially. There is no budgeting engine, no charts I'd never
look at, no login flow. Upload, read, categorise, export.
One decision shaped everything else: the app is allowed to say "I'm not
sure." Every row carries a confidence grade derived from the OCR's own
per-field scores, and the dashboard shows a "Needs a human" count. A receipt
whose total didn't parse, or whose date order was genuinely ambiguous, gets
flagged rather than quietly filed. An expense tool that confidently invents
numbers is worse than no tool at all, because you stop checking it.
How You Built It
I started with Amazon Bedrock. The plan was to send the photo to Nova Lite's
vision model with a prompt pinning an exact JSON schema, and let the model
return vendor, total and category in one shot.
That plan died in the first ten minutes. Every Bedrock model, in every
region, returned:
ValidationException: Error 002: Access to Bedrock models is not allowed for this accountMy account is new and on the current Free Plan. The Bedrock console's "Model
access" page has been retired — serverless models auto-enable on first invoke
now — so there was no toggle to flip and nothing explaining the block.
So I switched to Amazon Textract's
AnalyzeExpense , and it turned out to be
the better tool regardless. It is purpose-built for receipts and invoices: it
returns typed summary fields — VENDOR_NAME , TOTAL , TAX , SUBTOTAL ,
INVOICE_RECEIPT_DATE , INVOICE_RECEIPT_ID — plus ITEM / PRICE / QUANTITY
groups per line. On my first test receipt it returned every field at over 99%
confidence, including all six line items. No prompt engineering, no JSON
parsing, no retries when the model wraps its answer in markdown fences.Then I hit the second wall. I'd built the whole thing behind a Lambda Function
URL — one Lambda serving both the HTML and the JSON API, no CORS, HTTPS for
free. It returned
403 Forbidden with AuthType: NONE and a textbook
Principal: "*" resource policy. I put CloudFront in front of it with Origin
Access Control and switched to AuthType: AWS_IAM . Still 403.What made this diagnosable was checking the layers separately. A direct
aws lambda invoke returned 200 with the correct payload the entire time, so
the function was fine. aws organizations describe-organization confirmed the
account is standalone, so no SCP was involved. The resource policy, the OAC
signing config, the SourceArn scoping and the distribution ID all matched.
Everything was correct and it still failed — which meant the Function URL
feature itself was blocked on this account.The fix was one of those rare painless migrations: API Gateway HTTP API's
payload format 2.0 is byte-identical to the Lambda Function URL event shape.
Same
rawPath , same requestContext.http.method , same headers , same body .
I swapped the front door in CloudFormation and did not change a single line of
the handler.The parsing is the actual work
Textract reads the paper accurately. Turning those strings into numbers you can
sum is where the bugs live. Three of them, all caught by tests before deploy:
-
Rs. 1234parsed as0.12. Stripping non-numeric characters leaves the period from "Rs." behind, and it reads as a decimal point. Stray leading and trailing separators have to be removed first.
-
1,234nearly became1.234. A lone separator followed by exactly three digits is a thousands group; followed by one or two digits it's a fraction. Getting this backwards is a 1000x error on someone's expense total.
-
07/08/2026is genuinely undecidable. Where the numbers settle it —26/07must be day-first — the parser uses them. Where they don't, it uses your preference and marks the row ambiguous. It also refuses31/02/2026rather than lettingDatesilently roll it over to 3 March.
Categories without an LLM
With Bedrock unavailable I needed classification anyway, so I wrote readable
keyword rules over the vendor name and line items. This is better than it
sounds. The vendor name is a near-perfect signal, and a rule you can read is a
rule you can correct — no prompting, no drift, no per-request cost.
The one real subtlety: the vendor has to be authoritative, not merely
weighted. My first version scored vendor matches 3x and item matches 1x, and a
KFC receipt classified as Groceries because its line items mentioned milk,
bread, eggs and rice — four item hits outvoting one vendor hit. Now line-item
keywords are only consulted when no vendor rule fires at all. Unmatched receipts
land in
Other and say so.AWS Services Used / Architecture Overview
Browser (resizes image client-side)
| HTTPS
v
Amazon CloudFront ──> Amazon API Gateway (HTTP API, $default route)
|
v
AWS Lambda (Node.js 22, arm64)
| | |
PutObject | | Analyze | PutItem / Query
v v Expense v
Amazon S3 Amazon Amazon DynamoDB
(images) Textract (expense rows)Service | Role |
|---|---|
AWS Lambda | One function serves the UI and the API, so there's no CORS and no separate frontend deploy |
Amazon Textract | AnalyzeExpense does the reading — typed fields and line items |
Amazon S3 | Stores every receipt image; Textract reads the object directly |
Amazon DynamoDB | One row per receipt, on-demand billing |
Amazon API Gateway | HTTP API front door, single $default catch-all route |
Amazon CloudFront | TLS, HTTP/3, compression at the edge |
AWS CloudFormation | The entire stack, including IAM, in one template |
Amazon CloudWatch Logs | 14-day retention |
How it's triggered: the user drops a photo in the browser. The page resizes
it to 1400px and re-encodes as JPEG — a 4 MB phone photo becomes ~120 KB before
it ever leaves the device — then
POST s it to /api/extract . Lambda writes the
image to S3 first, so a Textract failure still leaves the evidence behind,
then points AnalyzeExpense at the S3 object rather than re-sending the bytes.
S3 has been strongly consistent for new PUTs since 2020, so there's no
read-after-write race.One schema detail I'm happy with:
receiptId is <epoch-millis>-<uuid8> , so a
descending DynamoDB range query is already newest-first. No secondary index,
no sorting in the client.What You Learned
Check the layers separately before you redesign anything. Both walls looked
like configuration mistakes and neither was. Direct
lambda invoke returning
200 while the URL returned 403 is what proved the function was healthy and the
front door wasn't — that one check saved me from rewriting working code.The purpose-built service usually wins. I reached for a general-purpose
vision model first because it's the exciting option. Textract's
AnalyzeExpense
gave better results with less code, no prompt to maintain, and confidence scores
per field that I could turn directly into the "Needs a human" counter. The
generic tool would have needed prompt engineering to approximate what the
specific one returns by default.Payload format 2.0 is a genuine portability layer. Function URLs and HTTP
APIs emit the same event shape. Knowing this turned a blocked afternoon into a
ten-minute template edit.
Write the tests for the string parsing, not the AWS calls. All 13 tests run
offline against a saved Textract response and finish in under a second. They
caught the
Rs. 1234 → 0.12 bug and the KFC misclassification before either
reached the cloud. The deploy script refuses to ship if they fail.Build the "I'm not sure" path first. Confidence grading and the ambiguity
flag weren't polish added at the end — they're what makes the output trustworthy
enough to actually use.
Link to App and Repo
- Live app: https://d22rjclt1d116y.cloudfront.net/
Everything deploys with one command (
scripts\deploy.ps1 ) into a single
CloudFormation stack. The README documents both blockers above in detail, in
case they save someone else an afternoon.Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article