How nitin-kumar369/prepsyncv1 works
PrepSync is a textbook-browsing and RAG chat web app, with admin-managed PDF ingestion, authentication, and account features. The main workflow is admin upload through text chunking and indexing, followed by a user query that retrieves textbook context and returns a generated answer; chat and book data are persisted in MongoDB. The graph combines README workflow details with the source excerpts and index. Several route and frontend implementations were not excerpted, so uncertain internal calls are omitted.
Main entry points: db.py MongoDB records · admin.py Admin routes · App.jsx App routing · main.py FastAPI app
Components 23
Web interface
- App routing
frontend/src/App.jsx - Chat pages
frontend/src/pages - Admin panel
frontend/src/pages/Admin.jsx - Auth store
frontend/src/store/authStore.js - Chat store
frontend/src/store/chatStore.js - Book browsing
frontend/src/pages
API and access
- FastAPI app
backend/main.py - Auth routes
backend/routes/auth.py - Chat routes
backend/routes/chat.py - Admin routes
backend/routes/admin.py - Book routes
backend/routes/books.py - JWT auth
backend/auth.py - Data models
backend/models.py - Configuration
backend/config.py
Textbook ingestion
- Text chunking
backend/rag/chunking.py - Formula extraction
backend/rag/formula_extractor.py
Retrieval and answers
- Embeddings
backend/rag/embedding_manager.py - Vector retrieval
backend/rag/vector_store.py - Answer generation
backend/rag/llm.py
Persistence
- MongoDB records
backend/db.py
Other components
- Student
- Admin
- MongoDB
Connections 29
- Student → App routing: uses
frontend/src/App.jsx - Admin → App routing: uses
frontend/src/App.jsx - App routing → Chat pages: routes to
frontend/src/App.jsx - App routing → Admin panel: routes to
frontend/src/App.jsx - App routing → Book browsing: routes to
frontend/src/App.jsx - App routing → Auth store: initializes
frontend/src/App.jsx - Chat pages → Chat store: uses
frontend/src/pages/ChatSession.jsx - Auth store → Auth routes: requests auth
frontend/src/store/authStore.js - FastAPI app → Auth routes: mounts
backend/main.py - FastAPI app → Chat routes: mounts
backend/main.py - FastAPI app → Admin routes: mounts
backend/main.py - FastAPI app → Book routes: mounts
backend/main.py - Auth routes → JWT auth: uses
backend/routes/auth.py - Chat routes → JWT auth: uses
backend/routes/chat.py - Admin routes → JWT auth: uses
backend/routes/admin.py - Auth routes → MongoDB records: uses
backend/routes/auth.py - Chat routes → MongoDB records: loads and saves
backend/routes/chat.py - Admin routes → MongoDB records: manages records
backend/routes/admin.py - Book routes → MongoDB records: uses
backend/routes/books.py - Admin routes → Text chunking: chunks uploads
backend/routes/admin.py - Admin routes → Vector retrieval: indexes books
backend/routes/admin.py - Admin routes → Formula extraction: extracts formulas
- Chat routes → Vector retrieval: retrieves context
backend/routes/chat.py - Chat routes → Answer generation: generates answer
backend/routes/chat.py - Vector retrieval → Embeddings: uses embeddings
backend/rag/vector_store.py - Embeddings → MongoDB records: reads and updates chunks
backend/rag/embedding_manager.py - Vector retrieval → MongoDB records: stores and queries chunks
backend/rag/vector_store.py - MongoDB records → MongoDB: connects to
README.md - FastAPI app → Configuration: validates settings
backend/main.py