AI-powered e-commerce platform where you can upload any image and instantly find visually similar products using CLIP + FAISS technology.
- πΈ Visual Search β Upload any image and find similar products using OpenAI's CLIP model + FAISS vector search
- ποΈ Product Catalog β Browse, search, and filter products across multiple categories
- π JWT Authentication β Secure user registration, login, and session management
- π Shopping Cart β Add to cart, update quantities, and remove items (synced with backend)
- π¦ Checkout & Orders β Address form, order placement, and order history stored in database
- π¨ Premium UI β Dark glassmorphism design with liquid animations, smooth transitions, and Framer Motion
- π± Responsive β Fully responsive across desktop, tablet, and mobile
ββββββββββββββββββββββ ββββββββββββββββββββββ ββββββββββββββββββββββ
β Next.js Frontend ββββββΆβ Spring Boot API ββββββΆβ MySQL DB β
β (Port 3000) β β (Port 8080) β β β
ββββββββββ¬ββββββββββββ ββββββββββββββββββββββ ββββββββββββββββββββββ
β
β Visual Search
βΌ
ββββββββββββββββββββββ
β Python AI Service β
β CLIP + FAISS β
β (Port 8001) β
ββββββββββββββββββββββ
| Layer | Technology | Description |
|---|---|---|
| Frontend | Next.js 14, TypeScript, Tailwind CSS, Framer Motion | UI with visual search, product browsing, cart, checkout |
| Backend | Spring Boot 3.4, Java 17, Spring Security, JPA | REST APIs for products, auth, cart, orders |
| AI Service | Python, FastAPI, OpenAI CLIP (ViT-B/32), FAISS | Image embedding & similarity search |
| Database | MySQL 8.0 | Products, users, cart, orders, order items |
Smart-Ecommerce-with-Visual-AI/
βββ src/ # Next.js Frontend
β βββ app/ # App router pages
β β βββ page.tsx # Landing page
β β βββ products/ # Product listing & detail
β β βββ search/ # Visual search page
β β βββ cart/ # Shopping cart & checkout
β β βββ login/ # Login page
β β βββ signup/ # Registration page
β βββ components/ # Reusable UI components
β β βββ ui/ # Button, Input, Badge, etc.
β β βββ layout/ # Navbar, Footer
β β βββ product/ # Product card
β β βββ cart/ # Cart sheet
β βββ lib/ # Utilities & contexts
β βββ api.ts # API service layer
β βββ auth-context.tsx # Auth state management
β βββ cart-context.tsx # Cart state management
β βββ types.ts # TypeScript interfaces
β
βββ backend/ # Spring Boot Backend
β βββ src/main/java/com/visualai/backend/
β βββ controller/ # REST controllers
β βββ entity/ # JPA entities
β βββ repository/ # Spring Data repositories
β βββ service/ # Business logic
β βββ config/ # Security & CORS config
β
βββ ai-service/ # Python AI Service
β βββ main.py # FastAPI app entry
β βββ config.py # Configuration
β βββ models/
β β βββ clip_model.py # CLIP model wrapper
β β βββ faiss_index.py # FAISS index management
β βββ routes/
β β βββ search.py # Visual search endpoint
β β βββ index.py # Index rebuild endpoint
β βββ utils/
β β βββ image_utils.py # Image loading utilities
β βββ requirements.txt # Python dependencies
β
βββ package.json # Frontend dependencies
βββ tailwind.config.ts # Tailwind configuration
βββ next.config.mjs # Next.js configuration
βββ README.md
- Node.js 18+ and npm
- Java 17+ (JDK)
- Python 3.9+
- MySQL 8.0+
- Maven (or use the included
mvnwwrapper)
git clone https://github.com/ItsOmkara/Smart-Ecommerce-with-Visual-AI.git
cd Smart-Ecommerce-with-Visual-AICreate a MySQL database:
CREATE DATABASE visual_ecommerce_db;The tables are auto-created by Hibernate when the backend starts (
spring.jpa.hibernate.ddl-auto=update).
cd backend
./mvnw spring-boot:runOr open the backend/ folder in IntelliJ IDEA and run the application.
The backend will start on http://localhost:8080.
cd ai-service
python -m venv venv
# Windows
.\venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
python main.pyThe AI service will start on http://localhost:8001.
β οΈ First startup downloads the CLIP model (~350MB). FAISS index is built automatically from database products.
# From the project root
npm install
npm run devThe frontend will start on http://localhost:3000.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login (returns JWT) |
| GET | /api/auth/me |
Get current user info |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/products |
List all products |
| GET | /api/products?category= |
Filter by category |
| GET | /api/products/:id |
Get product by ID |
| GET | /api/products/search?q= |
Text search |
| GET | /api/products/:id/related |
Related products |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/cart |
Get cart items |
| POST | /api/cart |
Add to cart |
| PUT | /api/cart/:productId |
Update quantity |
| DELETE | /api/cart/:productId |
Remove item |
| DELETE | /api/cart |
Clear cart |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/orders |
Place order (with shipping address) |
| GET | /api/orders |
Order history |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/search/visual |
Upload image for visual search |
| POST | /api/index/rebuild |
Rebuild FAISS index |
- User uploads an image on the search page
- CLIP (ViT-B/32) encodes the image into a 512-dimensional embedding
- FAISS index performs approximate nearest neighbor search against pre-computed product embeddings
- Top-K similar products are returned with similarity scores
- Full product details are fetched from the Spring Boot API
| Category | Technologies |
|---|---|
| Frontend | Next.js 14, React 18, TypeScript, Tailwind CSS 3, Framer Motion, Radix UI |
| Backend | Java 17, Spring Boot 3.4, Spring Security, Spring Data JPA, Lombok |
| AI/ML | Python, FastAPI, OpenAI CLIP, FAISS, PyTorch, NumPy |
| Database | MySQL 8.0, Hibernate ORM |
| Auth | JWT (jjwt 0.12.6), Spring Security |
Omkar Birajdar β @ItsOmkara