AI-Powered Full-Stack Book E-Commerce Platform
Semantic search Β· Personalized recommendations Β· Admin MIS dashboard
Click the thumbnail or button above to watch the full walkthrough on YouTube.
BookVerse is a production-grade full-stack e-commerce platform for books, powered by AI/ML. It features hybrid semantic search using sentence-transformers embeddings, a personalized recommendation engine with multi-signal preference vectors, a complete Admin MIS dashboard with 16 real-time KPIs, and a full e-commerce workflow β cart, checkout, order tracking, reviews, wishlist/reading list, and role-based access control.
Feature
Description
π Hybrid Semantic Search
384-dim vector embeddings (all-MiniLM-L6-v2) fused with keyword search (65% vector + 35% keyword) with 10-min caching
π― Personalized Recommendations
5-signal blend: preference vectors (29-dim), recency-weighted activity, collaborative filtering, content similarity, trending fallback
π For You Feed
Trending scorer with exponential decay (half-life 3 days), personalized carousels with explanation text
π§ Cold-Start Quiz
Book Guide onboarding builds a 29-dim user preference vector across 15 genres, 4 moods, 3 levels, 3 lengths, 4 intents
π Semantic Similarity
Embedding-based "Similar Books" with human-readable genre/category explanations
β‘ In-Memory Vector Store
Auto-rebuilding BookMatrixStore (NΓ29 float32) on model signals; zero-cold-start on server restart
Feature
Description
π 50+ Books, 14 Categories
Seeded with real titles across Fiction, Science, Programming, AI/ML, Business, Self-Help, and more
π Full Cart & Checkout
useReducer-based cart, atomic stock deduction via select_for_update, discount integration
π¦ Order Lifecycle
6 statuses (pending β delivered/cancelled), estimated delivery dates, order tracking page
π³ Discount Engine
Percentage/fixed-amount discounts with date-range validation, auto-status (Active/Scheduled/Expired)
β Reviews & Ratings
Per-user-per-book unique reviews, admin moderation, order-based review prompts
β€οΈ Wishlist / Reading List
Bookmark with personal notes and reading completion tracking, optimistic UI updates
Feature
Description
π MIS Dashboard
16 KPIs: total sales, orders, books, low-stock alerts, best-seller, category-sales distribution, orders-by-status chart, recent orders
βοΈ Full CRUD Panels
Books, categories, authors, discounts β with role-guarded admin views
π Order Management
Status updates, customer details, expandable line items
π¬ Contact Management
Threaded admin replies, read/unread tracking, user notification on reply
π Notification System
8 notification types (welcome, order confirmed, order status, contact reply, discount, review approved); 15s client polling
Feature
Description
π Token Authentication
DRF authtoken with localStorage persistence
π₯ 3 Roles
Guest (browsing), User (orders, wishlist, reviews), Admin (dashboard, CRUD, management)
π Password Reset
Token-based 1-hour expiry flow
π‘οΈ Rate Limiting
In-memory per-IP rate limiter for search (20/60s) and autocomplete (30/60s)
Layer
Technology
Purpose
Framework
React 19 + Vite 8
Modern concurrent rendering, instant HMR
Routing
react-router-dom v7
Layout routes with auth-guarded outlet groups
Styling
Tailwind CSS 3.4 + Radix UI
Utility-first design system, 26 hand-built components
State
Context API (4 contexts)
Auth, Cart (useReducer), Wishlist (optimistic), Theme
Icons
Lucide React
Consistent 24px iconography
Build
Vite 8
~540ms builds, ~445KB JS, ~35KB CSS
Layer
Technology
Purpose
Framework
Django 6.0 + DRF 3.14
Mature REST framework with token auth
Database
PostgreSQL 16 (default) / SQLite (dev)
Swappable via BOOKVERSE_DB env var
ML / NLP
sentence-transformers 3.0
all-MiniLM-L6-v2 β 384-dim semantic embeddings
Math
NumPy + scikit-learn
Vector ops, cosine similarity, matrix management
CORS
django-cors-headers
Development CORS policy
Component
Technology
Detail
Embedding Model
all-MiniLM-L6-v2
384-dim, SentenceTransformer, lazy-loaded
Feature Space
Custom 29-dim vector
15 genres + 4 moods + 3 levels + 3 lengths + 4 intents
Vector Store
In-memory BookMatrixStore
NΓ29 float32, auto-rebuilds on post_migrate + signals
Trending
Recency-weighted decay
7-day window, half-life 3 days, hourly refresh
Scoring
Dot product + 5% popularity boost
Preference vector Γ feature matrix
Search Fusion
Weighted hybrid
65% vector cosine similarity + 35% keyword BM25-style
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (Vite 8) β
β ββββββββββββ βββββββββββββ ββββββββββββ βββββββββββββ β
β β Pages β βComponents β β Contexts β β API β β
β β (26) β β (34) β β (4) β β Service β β
β ββββββ¬ββββββ βββββββ¬ββββββ ββββββ¬ββββββ βββββββ¬ββββββ β
β ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ β
β β axios fetch (proxy /api) β
ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ
β DJANGO REST FRAMEWORK β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API Layer (52 endpoints) β β
β β ββββββββββββ ββββββββββββ βββββββββββββ β β
β β β api β β semantic β β for_you β β β
β β β (CRUD) β β (search) β β (feed) β β β
β β ββββββ¬ββββββ ββββββ¬ββββββ βββββββ¬ββββββ β β
β β ββββββββββββββΌββββββββββββββ β β
β β βββββββ΄ββββββ β β
β β βrecommend. β β β
β β β(training) β β β
β β βββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β AI / ML Layer β β
β β ββββββββββββββββ βββββββββββββββ β β
β β β Embedder β β Vectorizer β BookMatrix β β
β β β(384-d model) β β (29-d) β Store(NΓ29) β β
β β ββββββββ¬ββββββββ ββββββββ¬βββββββ β β
β β βββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β PostgreSQL / SQLite β β
β β 15 models Β· 12 indexes Β· Atomic stock (FOR UPDATE) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Notable Technical Implementations
Embedding model : all-MiniLM-L6-v2 (384-dim, SentenceTransformers) β lazy-loaded on first request with graceful fallback
Query enrichment : Book text built from title | author | category | description | genres | mood | intent | level | length
Fusion algorithm : Raw keyword match (ILIKE on 5 fields) weighted at 35%, vector cosine similarity at 65%
Filters : category, author, price range, stock level; sort by relevance, newest, popularity, price, rating, title
Caching : 10-minute LocMemCache per unique param signature; autocomplete cached 30 minutes
Rate limiting : 20 req/60s search, 30 req/60s autocomplete (in-memory per-IP)
Personalized Recommendation Engine
5-signal blend :
Preference vector (29-dim from cold-start quiz)
Activity vector (recency-weighted interactions; half-life 7 days; view=1, cart_add=2, purchase=4)
Collaborative filtering (similar users via interaction overlap)
Content similarity (embedding-based "similar to past purchases")
Trending fallback (for cold-start / unauthenticated users)
Blending : 60% preference + 40% activity when both exist
Scoring : Dot product + 5% popularity boost β top-N
Explanation engine : Human-readable "why this was recommended" (genre match, level match, intent match)
16 computed KPIs via single optimized aggregation query
Metrics: total sales, total orders, total books, low-stock count, orders-by-status breakdown, discounts given, best-seller (title + units + revenue), top 5 books, category sales distribution, recent orders
Frontend renders: 3 KPI card groups (financial, inventory, delivery), best-seller spotlight, top-5 table, status distribution bar chart, category sales bar chart, low-stock alerts, recent orders table
Orders use select_for_update() row-level locking to prevent oversell under concurrency
F() expressions for atomic decrement: Book.objects.filter(id=book_id).update(stock=F('stock') - qty)
Rollback-safe: failures at any point release the lock
Wishlist with Optimistic UI
React Context with useReducer β immediately reflects UI changes before server confirmation
Rollback on error: stale snapshot restored if API call fails
Supports personal notes and reading completion (is_finished) per item
Browse β Search (semantic + keyword) β View details β See trending β Register
Browse β Search β Purchase (cart β checkout β order) β Track order β Write review β Manage wishlist/reading list β Get personalized recommendations β Manage profile β Contact support
Full CRUD (books, categories, authors, discounts) β Manage orders (status updates) β MIS Dashboard (16 KPIs with charts) β Moderate reviews β Reply to contacts β View all notifications
Metric
Count
Frontend Pages
26 (13 public, 6 auth-guarded, 7 admin)
UI Components
34 (18 base + 9 feature + 7 layout/shared)
API Endpoints
52
Backend Apps
5 (api, semantic, for_you, recommendations, bookstore)
Database Models
15 (UserProfile, Book, Author, Category, Order, OrderItem, Discount, Review, WishlistItem, Notification, ContactMessage, PasswordResetToken, UserInteraction + User, Token)
Serializers
25
Views / ViewSets
40+
Seed Data
50+ books Β· 14 categories Β· unique authors
Embedding Dimension
384 (semantic) + 29 (feature)
Frontend Bundle
~445KB JS Β· ~35KB CSS Β· ~540ms build
Caching Layers
4 (search 10m, autocomplete 30m, trends 1h, general 15m)
Python 3.10+
Node.js 18+
PostgreSQL 14+ (optional; SQLite works out-of-the-box for evaluation)
# 1. Backend
cd backend
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py seed_data # 50+ books across 14 categories
python manage.py generate_embeddings --all # Build 384-dim semantic vectors
python manage.py runserver
# 2. Frontend (separate terminal)
cd frontend
npm install
npm run dev
Frontend β http://localhost:5173
Backend API β http://localhost:8000/api/
export BOOKVERSE_DB=postgres
export DB_NAME=bookverse DB_USER=bookuser DB_PASSWORD=1234 DB_HOST=localhost DB_PORT=5432
python manage.py runserver
Or use the included run.sh (configures PostgreSQL automatically).
Command
Purpose
seed_data
Populates 50+ books, 14 categories, authors
generate_embeddings
Generates 384-dim semantic embeddings (single/batch/all)
refresh_trending
Rebuilds in-memory trending scores
MIT
Built with React, Django, and a lot of coffee Β· @AdnanZaman