BiteDecide

golang next.js openai vector-embeddings machine-learning

πŸ” 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

  1. Session starts: Your intent vector is neutral [0, 0, 0, ...]
  2. Swipe right on β€œButter Chicken”: Intent shifts toward Indian/creamy foods
  3. Swipe left on β€œSushi”: Intent moves away from Japanese/raw foods
  4. 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

  1. Zero Training Required: Pre-computed embeddings, instant recommendations
  2. Explainable AI: Every recommendation is a transparent math operation
  3. Learns Context: Understands β€œspicy Indian” vs β€œmild Italian” without tags
  4. Handles Nuance: Semantic understanding beats keyword matching
  5. 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


Built with vector embeddings, powered by Go, designed for indecision.