StudyVault is a grounded study assistant built around course materials instead of general-purpose model responses. Students can upload lecture notes, slides, readings, and other class documents, then use those files for citation-backed chat, flashcard generation, quiz generation, and progress tracking.
The project combines document ingestion, vector retrieval, grounded generation, and study workflow features in one local application. The backend is written in Python with FastAPI, the frontend is a React single-page app, and SQLite stores metadata, quiz history, and study artifacts.
StudyVault is designed around one constraint: answers and generated study material should come from uploaded course content. Instead of treating AI as a general tutor, the system uses the student’s own files as the source of truth.
The application supports:
- course workspaces
- document upload and ingestion
- grounded chat with citations
- document viewing and source review
- topic creation and topic-based study scopes
- flashcard generation
- quiz generation
- quiz grading and review
- topic mastery and weak-area tracking
Each course acts as its own workspace. Documents, study sets, quizzes, attempts, topics, and mastery data are stored under that course.
Supported actions:
- create a course
- list courses
- view a course
- delete a course and related data
Users can upload course files into a selected course. The backend saves the file locally, creates a document record, extracts text, chunks the content, generates embeddings, and stores retrieval metadata.
Supported file types:
- DOCX
- PPTX
- TXT
- MD
Ingestion pipeline:
- Save the uploaded file to
data/uploads - Parse the file into page or slide level text
- Split the content into chunks
- Generate embeddings with
all-mpnet-base-v2 - Store chunk metadata in SQLite
- Add vectors to the in-memory FAISS index
The chat feature answers questions using retrieved document chunks from the selected course.
Chat flow:
- Embed the user’s question
- Retrieve the most relevant chunks from the FAISS index
- Build a constrained prompt using those chunks
- Generate an answer with source tags
- Return only the citations that were actually used in the answer
- Record retrieval traces in SQLite
Each answer includes citations so the user can inspect the supporting source text.
The frontend can open document content directly from the backend. This supports citation review and general browsing.
Current behavior:
- DOCX is rendered into basic HTML-like structure
- TXT and MD are returned as plain text
- PDF text is extracted page by page and returned as plain text
Topics are used to organize study content and track performance at a more focused level than the full course.
Supported topic features:
- list topics for a course
- create a topic manually
- attach selected documents to a topic
- auto-create topics from chunk section titles when available
StudyVault can generate flashcards from either:
- selected documents
- a selected topic
Flashcards are stored in SQLite and can be reopened later. Each card can include a source_chunk_id so generated content stays tied to the underlying course material.
StudyVault can generate quizzes from:
- selected documents
- a selected topic
- selected chunks, used for focus or missed-question review
Supported question types:
- multiple choice
- true/false
- short answer
Supported quiz features:
- generate and save quizzes
- reopen saved quizzes
- submit answers
- grade responses
- review past attempts
- see course-wide and quiz-specific metrics
The platform keeps track of quiz attempts and uses that data to identify weak areas.
Tracking features include:
- quiz attempt history
- quiz-level metrics
- course-level metrics
- missed focus areas
- topic mastery updates
- improvement area summaries
Topic mastery is updated after quiz submission. Topic-scoped quizzes affect only the topic they were created for, while broader document quizzes can still contribute to chunk-based topic mapping.
- Python
- FastAPI
- SQLite
- FAISS
- sentence-transformers
- OpenAI API
- React 18
- react-scripts
- CSS modules by file, primarily
App.css
pypdfpython-docxpython-pptxmarkdown
StudyVault/
├── backend/
│ ├── app.py # FastAPI app creation and startup wiring
│ ├── config.py # Environment-backed configuration
│ ├── ingestion.py # Document parsing, chunking, embeddings, vector store
│ ├── main.py # Thin entrypoint for running the API
│ ├── routes_chat.py # Chat endpoint
│ ├── routes_general.py # Courses, topics, documents, health, root
│ ├── routes_quiz.py # Quizzes, attempts, metrics, focus areas
│ ├── routes_study.py # Study sets and flashcards
│ ├── state.py # Shared OpenAI client and ingestion pipeline
│ └── services/
│ ├── grading.py # Grading and answer normalization
│ ├── payloads.py # Model output parsing
│ ├── quiz_records.py # Quiz record and metric helpers
│ ├── sources.py # Source chunk loading and citation shaping
│ └── topic_mastery.py # Topic mastery update logic
├── db/
│ ├── schema.py # SQLite schema setup
│ └── studyvault.db # Local database
├── data/
│ ├── uploads/ # Uploaded course files
│ └── vector_store/ # Reserved vector store directory
├── frontend/
│ ├── package.json
│ └── src/
│ ├── App.jsx # Main application UI
│ ├── App.css # Main styling
│ ├── index.js
│ ├── index.css
│ └── components/
│ ├── SettingsUI.tsx
│ └── SettingsUI.css
├── requirements.txt
├── .env
└── README.md
The backend is now split by responsibility instead of keeping all routes and helpers in one file.
backend/app.pycreates the FastAPI app, enables CORS, registers routers, and rebuilds the vector index at startup.backend/main.pyexists only to run the app withuvicorn.
routes_general.pycontains course, topic, and document routesroutes_study.pycontains study set and flashcard routesroutes_quiz.pycontains quiz generation, grading, metrics, and focus routesroutes_chat.pycontains the grounded chat route
payloads.pyparses model JSON output for flashcards and quizzesgrading.pyhandles answer normalization and grading logicsources.pyloads source-scoped chunks and builds citation payloadsquiz_records.pybuilds attempt summaries and metric viewstopic_mastery.pyupdates topic mastery after quiz submission
backend/state.py owns the shared OpenAI client and the IngestionPipeline instance used across the backend.
SQLite stores application metadata and study state. The main tables are:
coursesdocumentsdocument_versionschunksembeddingsconversationsmessagesretrieval_tracesstudy_setsflashcardsquizzesquiz_questionsquiz_attemptsquiz_responsestopicstopic_chunkstopic_mastery
In general:
- files live on disk
- metadata lives in SQLite
- vectors live in FAISS at runtime
All exported backend config values are read from environment variables through .env.
Current config values in backend/config.py:
BASE_DIRDATA_DIRDB_DIRUPLOADS_DIRVECTOR_STORE_DIRAPI_HOSTAPI_PORTOPENAI_API_KEYOPENAI_MODELOPENAI_API_URLOPENAI_TIMEOUTEMBEDDING_MODELEMBEDDINGS_DIMENSIONRETRIEVAL_TOP_KSIMILARITY_THRESHOLDCHUNK_SIZECHUNK_OVERLAP_PERCENTDB_PATH
Local install steps, run commands, and backend startup behavior are documented in STARTUP.md.
GET /GET /health
GET /coursesPOST /coursesGET /courses/{course_id}DELETE /courses/{course_id}
GET /courses/{course_id}/documentsPOST /courses/{course_id}/documentsGET /documents/{doc_id}/content
GET /courses/{course_id}/topicsPOST /courses/{course_id}/topicsPOST /courses/{course_id}/topics/{topic_id}/attach-documentsPOST /courses/{course_id}/topics/auto
GET /courses/{course_id}/study-setsGET /study-sets/{studyset_id}/flashcardsPOST /courses/{course_id}/study-sets/generateDELETE /study-sets/{studyset_id}
GET /courses/{course_id}/quizzesDELETE /quizzes/{quiz_id}GET /quizzes/{quiz_id}GET /quizzes/{quiz_id}/attemptsGET /quizzes/{quiz_id}/attempts/{attempt_id}GET /courses/{course_id}/quiz-attemptsGET /quizzes/{quiz_id}/metricsGET /courses/{course_id}/quiz-metricsGET /courses/{course_id}/missed-focus-areasGET /courses/{course_id}/improvement-areasPOST /courses/{course_id}/quizzes/generatePOST /quizzes/{quiz_id}/submit
POST /courses/{course_id}/chat
StudyVault is a course-material-based study platform that combines:
- local document ingestion
- vector retrieval
- grounded chat with citations
- flashcard generation
- quiz generation and grading
- progress tracking and weak-area analysis
Its core value is not just answer generation, but keeping study workflows tied to the student’s own source material.