
Full Stack Challenge: CraveMap
My challenge word was Compass, so I built one for cravings: describe what you feel like eating in plain Spanish and a Strands agent on Amazon Bedrock returns three dishes at real places in Lima, with the needle pointing at the first one's true bearing.
My random word was Compass. So I built a compass for cravings.
Vision and What It Does
You know what you want to eat, but not what it's called or where it is. You want "something brothy and cheap because I'm hungover," not a list of restaurants sorted by rating.
CraveMap takes that sentence — in plain Spanish, the way you'd say it to a friend — and returns three specific dishes at three specific places in Lima. The needle of an on-screen compass swings to the real geographic bearing of the first result, computed from Lima's center. It's not decoration: the angle is
atan2 over actual coordinates.Full Stack Breakdown
Frontend — React + Vite, no UI libraries. Three dependencies total:
react , react-dom , vite . 65 KB gzipped. The compass is hand-drawn SVG with 60 tick marks and a damped-spring needle driven by a single requestAnimationFrame loop, which settles in about 1.3 seconds and respects prefers-reduced-motion . Served from S3 behind CloudFront.It ships with light and dark themes. The palette lives entirely in CSS custom properties:
:root defines the full light set, and the dark blocks only redefine tokens — never introduce a color that exists nowhere else. A two-line inline script in <head> stamps data-theme before first paint, so there's no flash of the wrong theme on load, and the choice persists in localStorage . Writing it forced me to measure contrast properly instead of eyeballing it, which caught two real failures: the placeholder text sat at 3.69:1, and the orange on the compass needle's north tip at 2.69:1 — below the threshold even for large text. Both fixed; every text pair now clears 4.5:1 in both themes.API — API Gateway HTTP API. The stage is literally named
api , which means CloudFront can forward /api/craving untouched and API Gateway reads it as stage api + route /craving . No path rewriting, no originPath , no Lambda@Edge.Agent — Python on Lambda ARM64, using the Strands Agents SDK against Amazon Bedrock. Split into four modules:
handler.py (HTTP entrypoint), brujula.py (prompt and orchestration), catalogo.py (dish catalog), locales.py (DynamoDB access and the agent's tool).Data — DynamoDB, partition key
plato , sort key distrito#osm_id . 35,259 dish-place pairs across 4,705 real restaurants in all 43 districts of Lima.Feedback loop — a public write endpoint collects corrections; an EventBridge cron fires a second agent at 3 AM to apply them.
Infrastructure — AWS CDK in TypeScript, decomposed into L3 constructs:
database , compute , api , frontend , feedback . The stack file itself is 29 lines of wiring.How You Built It
The honest version is that the first three architectures I tried didn't survive contact with the account.
Bedrock AgentCore Runtime was the plan. It failed at deploy with a 402. Service Quotas explained why:
Total Agents per Account = 0 . Not throttled — zero. Strands is just a library, so the agent moved into a container Lambda unchanged, and the proxy hop disappeared with it.Model access was the second wall. Every
bedrock-runtime call returned ValidationException: Operation not allowed , for every model. I concluded there was an SCP. I was wrong. Access on this account lives entirely on the newer bedrock-mantle endpoint, gated per model — and it isn't exposed by the AWS CLI at all. Systematic probing found exactly three models entitled: the Gemma 4 family. Claude and GPT return "not available for this account." CraveMap runs on google.gemma-4-31b .Then CloudFront ate my API.
POST /api/craving returned the HTML homepage with server: AmazonS3 and a 200. The behavior was correct, the origin was correct, the distribution was Deployed . The actual cause was two bugs stacked: CloudFront doesn't sign the request body when POSTing to a Lambda Function URL with OAC, so the origin returned 403 — and my distribution-wide errorResponses rewrote every 403 into /index.html at 200, fetched from S3. The masking hid the failure. Removing the error mapping made the real status visible; API Gateway replaced the Function URL.The last redesign was a scaling one. The agent's tool scanned DynamoDB and put one line per dish-place pair into the prompt, which capped the catalog at 180 items. Splitting it in two fixed it: the dish catalog (32 items, 3.9 KB) lives in the system prompt, and the agent picks three dishes first; only then does a tool query DynamoDB per dish, filtered by partition key. The prompt stopped growing with the database. Serving three different dishes became free — it's now guaranteed by construction rather than requested from the model.
AWS Services and Architecture
CloudFront → S3 (static site) and API Gateway HTTP API → Lambda (Strands agent) → DynamoDB, with Amazon Bedrock behind the agent. A second Lambda, triggered by EventBridge on a cron, reads a feedback table and writes corrections back. IAM, CloudWatch Logs, and ECR round it out. All of it defined in CDK.
The feedback curator is the piece I'd defend hardest. An LLM proposes actions from user reports, but it doesn't get to apply them: a change lands only with two agreeing votes and no opposing vote, and a corrected price is the median of what users reported, not what the model said. "Remove this dish" writes
oculto: true rather than deleting — a wrong consensus should be reversible.About the Data
The dishes come from Wikipedia's list of typical Peruvian dishes (CC BY-SA). The restaurants — name, district, coordinates — come from OpenStreetMap (ODbL, © OpenStreetMap contributors). Both are real and verifiable.
Two things are not. Prices are estimates from a documented heuristic over dish type and district; no public source publishes per-dish prices in Lima, and I checked thoroughly. And of the 35,259 pairs, only 8,563 are backed by OSM's
cuisine tag — the rest assign a generic criollo menu to restaurants that lack one. Every row carries a cuisine_fuente field marking which is which, and the agent's tool ranks OSM-backed places first.I checked whether commercial APIs could do better. They can't, legally: Google Maps Platform prohibits storing business names in your own database in those exact words, Yelp caps caching at 24 hours, TripAdvisor's Content API shuts down this month. Open data was the only path that let me keep the results.
What You Learned
Error handling can hide the error. A 403-to-index.html rewrite is a reasonable SPA pattern and it cost me hours, because it turned a backend failure into a successful-looking page. Scope custom error responses to the behavior that needs them.
Quotas of zero look like bugs. "Limit exceeded" with no resources deployed reads as nonsense until you check Service Quotas and find the limit is 0.
Put constraints in the schema, not the prompt. Asking a model for three different dishes is a request. Making it choose dishes before places makes repetition impossible.
Let the model propose and let code decide. Consensus counting, median prices, and soft deletes mean a hallucination can't corrupt the database.
Word for the challenge: Compass. Built in Lima, pointing at lunch.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article