An AI-powered food discovery application that uses vector similarity search to find similar foods.
HacknRoll/
├── backend/ # Flask API server
│ ├── app.py # Main Flask application
│ ├── requirements.txt
│ └── .env.example # Environment variables template
│
└── frontend/ # React application
├── public/
├── src/
│ ├── components/
│ │ ├── LandingPage.js
│ │ ├── SearchBar.js
│ │ └── SearchResults.js
│ ├── App.js
│ └── index.js
└── package.json
- 🔍 Smart Autocomplete - Real-time food suggestions as you type
- 🤖 AI-Powered Search - Vector similarity search using Pinecone
- ⚡ Instant Results - Fast and responsive search experience
- 📱 Responsive Design - Works on desktop and mobile
- Python 3.8+
- Node.js 16+
- Pinecone account (optional, has mock data fallback)
-
Navigate to the backend directory:
cd backend -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows:
venv\Scripts\activate - Mac/Linux:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
-
Add the environment file and add your Supabase conn key:
SUPABASE_URL=URL SUPABASE_KEY=KEY FLASK_ENV=development FLASK_DEBUG=1 OPENAI_API_KEY=KEY
Edit .env with your Supbase credentials.
- Run the Flask server:
python app.pyThe backend will run on http://localhost:5000
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The frontend will run on http://localhost:3000
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check |
/api/autocomplete?q=<query> |
GET | Get food suggestions |
/api/search |
POST | Search for similar foods |
/api/categories |
GET | Get all food categories |
To enable real vector search:
- Create a Supabase account at https://supabase.com/
- Create a new project
- Enable the
pgvectorextension in your database (Database → Extensions → enablevector) - Create a table for food vectors
- Add your Supabase URL and key to the
.envfile:
SUPABASE_URL=your_project_url
SUPABASE__KEY=your_anon_key
- Populate the table with food embeddings
- Backend: Flask, Flask-CORS, Supabase
- Frontend: React, CSS3
- Vector Database: Pinecone