How jivitesh-s/ctsnpn works
Purpose and Entry Points
TechStore AI is a product-support and store-assistance system: a conversational RAG assistant backed by approved product/support knowledge, catalog lookup, reservations, and staff alerts. The backend entry point is the FastAPI app in backend/main.py; the browser client starts from frontend/src/main.jsx and mounts application/session UI in frontend/src/App.jsx. Deployment artifacts indicate container and process-hosting support through Dockerfile, Procfile, and render.yaml.
API Orchestration Boundary
backend/main.py is the HTTP boundary between the React client and backend services. README-defined public routes cover health, chat, catalog/product reads, and reservations; PIN-protected admin routes cover login, catalog upload, product mutation, and deletion. It owns request validation, routing, middleware/security/rate-limiting concerns, and delegates domain work rather than exposing storage or model internals directly.
• backend/main.py
• backend/db.py
• backend/telegram_service.py
Hybrid RAG Answering Pipeline
backend/rag_service.py is the conversational core: it retrieves approved support/product context, combines dense vector and lexical retrieval, reranks results, and sends grounded context to configured Groq/Gemini LLM inference. The key trust boundary is retrieval-to-generation: unsupported questions should receive a fallback rather than model-invented claims. The persisted retrieval corpus includes Chroma storage and a BM25 index, allowing runtime retrieval without rebuilding indexes.
• backend/rag_service.py
• data/shop/chroma_db/chroma.sqlite3
• data/shop/bm25_index.pkl
Knowledge Ingestion and Index Lifecycle
backend/ingest.py implements chunking, embedding, and index updates, including the admin-upload path described by the API. Source knowledge is split between product-specific text documents, policies/FAQ/support data, and catalog records. Offline scripts prepare, normalize, embed, inspect, and evaluate the corpus; these form a separate build/indexing stage from request-time answering.
• backend/ingest.py
• data/shop/product_docs/
• data/shop/catalog.json
Catalog and Reservation Persistence
backend/db.py provides the transactional application-data boundary for product catalog state and in-store reservations. The local SQLite database at data/shop/products.db is distinct from Chroma’s vector store: relational/catalog updates must stay consistent with search/index updates initiated through ingestion. Reservation creation triggers a staff-facing notification workflow rather than directly coupling UI clients to Telegram.
• backend/db.py
• data/shop/products.db
• backend/telegram_service.py
Customer Experience Composition
The React/Vite frontend is a single interactive assistant surface, with chat rendering and specialized response/action cards. ShopPage is the main experience layer; reusable components implement comparison, visual diagnostics, voice input/output, reservations, and video content. The frontend communicates over JSON and multipart API requests, preserving the backend as the authority for catalog, RAG, and reservations.
• frontend/src/pages/ShopPage.jsx
• frontend/src/components/VisualDiagnosticCard.jsx
• frontend/src/components/ReservationModal.jsx
External Services and Runtime Dependencies
The system runs Python/FastAPI/Uvicorn on the backend and React/Vite in the client. Material external integrations are Groq and Google Gemini for LLM inference and the Telegram Bot API for reservation alerts/OTP-related service behavior. ChromaDB stores dense vectors; BM25 supports lexical matching; the repository includes local generated indexes/data, so deployments require persistent writable storage when catalog ingestion or vector updates are enabled.
• .env.example
• requirements.txt
• frontend/package.json
Main entry points: ingest.py Ingestion service · main.py FastAPI application · ShopPage.jsx ShopPage · rag_service.py Hybrid RAG service
Components 18
Browser client
- Vite entry
frontend/src/main.jsx - Application shell
frontend/src/App.jsx - ShopPage · Composes chat and product-support interactions.
frontend/src/pages/ShopPage.jsx - Visual diagnostics
frontend/src/components/VisualDiagnosticCard.jsx - Reservation modal
frontend/src/components/ReservationModal.jsx
Backend services
- FastAPI application · Public chat/catalog/reservation routes and PIN-protected admin operations.
backend/main.py - Hybrid RAG service · Retrieves, reranks, and falls back when support is insufficient.
backend/rag_service.py - Ingestion service · Chunks, embeds, and updates retrieval indexes after knowledge changes.
backend/ingest.py - Application data service · Transactional boundary for catalog state and reservations.
backend/db.py - Telegram service
backend/telegram_service.py
Knowledge and data
- Product documents
- Catalog source
data/shop/catalog.json - Products database · Runtime catalog and reservation persistence.
data/shop/products.db - Chroma vector store
data/shop/chroma_db/chroma.sqlite3 - BM25 index
data/shop/bm25_index.pkl
External services
- Groq and Gemini
- Telegram Bot API
Other components
- Container deployment · Requires persistent writable storage when indexes are updated.
Dockerfile
Connections 19
- Vite entry → Application shell: mounts
- Application shell → ShopPage: renders
- ShopPage → Visual diagnostics: uses
- ShopPage → Reservation modal: opens
- ShopPage → FastAPI application: JSON and multipart requests
- FastAPI application → Hybrid RAG service: chat requests
- FastAPI application → Application data service: catalog and reservations
- FastAPI application → Ingestion service: admin uploads and catalog updates
- Hybrid RAG service → Chroma vector store: dense retrieval
- Hybrid RAG service → BM25 index: lexical retrieval
- Hybrid RAG service → Groq and Gemini: grounded prompts
- Ingestion service → Product documents: chunks
- Ingestion service → Catalog source: indexes
- Ingestion service → Chroma vector store: updates embeddings
- Ingestion service → BM25 index: updates lexical index
- Application data service → Products database: reads and writes
- Application data service → Telegram service: reservation alert
- Telegram service → Telegram Bot API: sends notifications
- Container deployment → FastAPI application: hosts