Blog
AI & Machine Learningยท5 min read

Building BarterBai: a barter app for stuff you already own

An iOS app where neighbors swap items instead of buying new. SwiftUI, Convex, and three different AI models doing the boring work.

Jo VinkenroyeยทApril 22, 2026
Building BarterBai: a barter app for stuff you already own

Your apartment has about three thousand euros of stuff in it you will never use again

Blender you bought for one smoothie phase. Drill from the bookshelf assembly. That coat you haven't worn since the move. Meanwhile someone two streets over is clicking "buy new" on Amazon for the exact thing you have sitting in a closet

That's the problem BarterBai tries to solve. No money, no shipping, no algorithm showing you stuff from another continent. Just people, things, and a coffee five minutes away

The flow

You open the app and take photos of something you want gone. One to ten shots. The AI figures out what it is, what condition it's in, and what it's worth. You glance at what it wrote, fix anything wrong, post it

Then you scroll. Items from people inside a radius you control. Tap the heart on things you'd actually want. When someone you liked also likes something of yours, a chat opens automatically. You pick a spot. You swap

If the values don't line up, one side throws in cash to balance it. If no mutual match appears you can place a regular offer instead

That's it. No shipping labels. No escrow. No "featured listings" upsell

Why three AI models instead of one

This is the part I want to talk about because it's the bit that took real thinking

Claude vision is great at recognition. Show it a photo of a bike and it will tell you the brand, roughly the model, the condition, whether the chain looks rusted. What Claude can't do is tell you what that bike sells for on Marktplaats this week

So the pipeline splits

Gemini Flash Lite does the first pass on the photos. Title, category, condition notes, brand if visible. It's fast and cheap and good enough for the object recognition part

Perplexity Sonar then does live price research. It hits eBay, Vinted, Marktplaats, pulls recent comparable listings, and comes back with a realistic second-hand price in euros. It also returns the reasoning so the user can see why their toaster is worth twelve euros and not forty

OpenAI GPT runs async in a separate Convex action for categorization against a dynamic category tree. If confidence drops below eighty percent it flags the item for a human reviewer. New categories get auto-created when patterns emerge

Three models, three strengths. Nobody is doing everything. The whole thing takes under ten seconds from photo to live listing

Convex for the real-time bits

The iOS app uses Convex subscriptions directly. Not polling, not WebSockets I had to wire up. Chat messages, match detection, inventory updates โ€” all of it live through the subscription system

Match detection is where this pays off. The moment two users have mutual likes, the server fires. A chat thread is created. Both phones get notified. No cron job checking every five minutes, no queue

The matching itself is greedy on price. If your item is worth forty and the other person's is worth thirty-five, the algorithm looks for a small add-on from your side to close the gap. Or it suggests a cash top-up. Or it tries to pair multiple items on one side against one on the other until the numbers meet

Pure money transactions are boring. Barter with price balancing is actually an interesting optimization problem

Auth that took ten minutes

Clerk handles sign in. A custom Convex auth provider bridges the Clerk JWT. A users:getOrCreate mutation syncs the identity into my database on first login

That's the whole auth layer. No password reset flow to build. No email verification code to email. No session table to maintain

When I built Kwenta in 2021 this part ate weeks. Now it's an afternoon

Cloudinary on the hot path

Image uploads go to Cloudinary first with client-side compression. The URL lands in a Convex action which then fetches the image and ships it to the vision models. After the LLM pipeline finishes, only the Cloudinary URL and the extracted metadata get stored

Multi-size variants are auto-generated. The feed serves thumbnails, the detail view serves full resolution. None of that pipeline is code I wrote

Stack summary

  • Client: SwiftUI, native iOS
  • Backend: Convex (functions, actions, subscriptions, database)
  • Auth: Clerk with Convex JWT provider
  • Vision: Anthropic Claude, Gemini Flash Lite
  • Pricing: Perplexity Sonar
  • Categorization: OpenAI GPT
  • Images: Cloudinary

Total moving parts I had to host myself: zero

Key takeaways

  • Don't use one LLM for everything. Recognition, pricing research, and categorization each want different models. Split the pipeline and the whole thing gets faster and cheaper
  • Barter is actually an optimization problem. Matching by price, allowing partial cash top-ups, handling multi-item swaps โ€” there's real logic there. Money-based apps skip all of this
  • Convex subscriptions remove entire categories of code. No polling, no socket plumbing, no sync bugs
  • Clerk + Convex is my default auth stack now. Nothing else comes close on time-to-first-login

Try it at barterbai.com

Stay Updated

Get notified about new posts on automation, productivity tips, indie hacking, and web3.

No spam, ever. Unsubscribe anytime.

Comments

Related Posts