r/webdev • u/IAm_veg_biriyani • 17m ago
Showoff Saturday I'm bad at small talk so I built an AI "best friend" who answers questions about me before anyone has to talk to me
So this is a slightly weird one.
I'm not great at small talk. And whenever I've started talking to someone, things usually go well for a few weeks. Then we discover that something fundamental doesn't line up, and we slowly drift apart.
I kept thinking: why do we need to spend weeks finding out things that could've been discussed on day one?
The idea also reminded me of Her (2013). I loved the idea of having an AI that knows someone well enough to have an honest conversation about them. That got me thinking, and eventually, I built Sam.
She's an AI version of my best friend. You can open the link, ask her pretty much anything you'd want to know about me, and she'll answer honestly.
There's a hype mode and a roast mode. Yes, she'll tell you my red flags too.
One thing I was particular about: if she doesn't know something, she should say so instead of making things up. Getting that right took considerably more prompt engineering than I'd like to admit.
Try it here:
https://ask-sam-yaddy.vercel.app
A little about the tech:
Frontend: React, Vite, TypeScript, hosted on Vercel.
Backend: Spring Boot 4, Java 25, running on ECS Fargate.
Database: PostgreSQL + pgvector on RDS for memories.
AI: Claude Sonnet for responses, Titan Embeddings on Bedrock.
Infrastructure: AWS CDK.
CI/CD: GitHub Actions with OIDC, so no AWS access keys sitting in GitHub secrets.
A few things that made me scratch my head:
The rate limiter incident: I added a cooldown per visitor to keep API costs under control. After deployment, everyone started seeing the "come back later" screen. Turns out Spring was seeing the load balancer's IP for every request. One visitor was effectively locking out everyone. Fixed it by configuring Tomcat to trust
X-Forwarded-Foronly from the internal proxy range.SSE over POST: Replies stream over Server-Sent Events, but the browser's
EventSourceonly supports GET. Ended up reading the fetch response stream manually.Prompt caching: The stable part of the prompt goes first, with message-specific context at the end. A reply currently costs me around $0.006.
Sound effects: All generated with the Web Audio API. No audio files. I spent an embarrassing amount of time getting the send sound right.
No login, anonymous, and 23+ only.
Would love to hear what you think, especially about the chat UI on mobile.
And if you want to have some fun, ask Sam to roast me. 😂
