π The Concept
BiteDecide is a swipe-based food recommendation app that learns your preferences in real-time using vector embeddings and cosine similarity. No manual tagging, no complex ML modelsβjust smart math that understands what youβre craving.
Swipe left on foods you donβt want, right on ones you like, and super swipe when youβve found your meal. The app gets smarter with each swipe, showing you foods that match your evolving taste profile.
β¨ Key Features
- π Real-Time Learning: Each swipe updates your preference vector, making recommendations smarter
- π§ Semantic Understanding: Uses OpenAI embeddings to capture the βmeaningβ of each food
- π Cosine Similarity Scoring: Math-based recommendations, not black-box AI
- π― Zero Manual Tagging: Just natural food descriptionsβAI figures out the relationships
- β‘ Stateless Sessions: Each decision is independent, no long-term tracking
- π Fast & Lightweight: Go backend with in-memory session management
π§ How It Works
Vector Embeddings Magic
Instead of tagging foods manually, BiteDecide sends each food description to OpenAIβs embedding API, which returns a 1536-dimensional vector that captures the semantic meaning. Similar foods (like βButter Chickenβ and βPaneer Tikkaβ) end up close together in this vector space.
The Recommendation Flow
- Session starts: Your intent vector is neutral
[0, 0, 0, ...] - Swipe right on βButter Chickenβ: Intent shifts toward Indian/creamy foods
- Swipe left on βSushiβ: Intent moves away from Japanese/raw foods
- Next recommendation: App calculates cosine similarity between your intent and all unseen foods, shows the best match
The Math
Cosine Similarity = (A Β· B) / (||A|| Γ ||B||)
Swipe Weights:
Left: -0.5 (strong negative)
Right: 0.2 (gentle positive)
Super: 1.0 (definitive choice)
ποΈ Architecture
βββββββββββββββ ββββββββββββββββββββ βββββββββββββββ
β Frontend β HTTP β Backend β API β OpenAI β
β (Next.js) β βββββββΊ β (Go + Gin) β βββββββΊ β Embeddings β
β β β β β β
β - Swipe UI β β - Sessions β β - text-emb- β
β - Renders β β - Vector math β β 3-small β
β - No logic β β - Cosine scoring β βββββββββββββββ
βββββββββββββββ ββββββββββββββββββββ
Frontend: Clean Next.js interface for swipingβzero business logic
Backend: Go service handling session management, vector operations, and recommendation engine
OpenAI: Generates semantic embeddings for all 50 food items
π οΈ Tech Stack
- Backend: Go 1.21+, Gin framework
- Frontend: Next.js 14, TypeScript, React
- AI/ML: OpenAI Embeddings API (text-embedding-3-small)
- Storage: In-memory session store with 50 pre-loaded foods
- Deployment: Docker, Vercel (frontend)
- Math: Vector operations, cosine similarity, normalized embeddings
π What Makes It Cool
- Zero Training Required: Pre-computed embeddings, instant recommendations
- Explainable AI: Every recommendation is a transparent math operation
- Learns Context: Understands βspicy Indianβ vs βmild Italianβ without tags
- Handles Nuance: Semantic understanding beats keyword matching
- Asymmetric Weighting: Strong dislikes, gentle likes, decisive super swipes
π¦ Project Structure
βββ client/ # Next.js frontend
β βββ app/
β β βββ swipe/ # Main swipe interface
β β βββ complete/ # Success screen
β β βββ lib/api.ts # Backend API client
β
βββ server2/ # Go backend
βββ main.go # Entry + Gin router
βββ data/food.json # 50 foods with descriptions
βββ handlers/ # HTTP handlers
βββ openai/ # Embedding client
βββ store/ # Session & food storage
βββ engine/ # Recommendation logic
βββ models/ # Data structures
π― Use Cases
- Indecisive eaters: Let the app narrow down choices
- Group decisions: Everyone swipes, app finds consensus
- Discovery: Explore foods you wouldnβt normally consider
- Quick decisions: Super swipe when you know what you want
π Links
Built with vector embeddings, powered by Go, designed for indecision.