backend/: FastAPI app and RAG coreapp.py: API routes, CORS, and static UI mountrag_system.py: Orchestrates vector store, tools, sessionsvector_store.py: ChromaDB persistence underbackend/chroma_dbdocument_processor.py: Chunking and course/lesson parsingai_generator.py: Anthropic client + tool callingsearch_tools.py,models.py,session_manager.py,config.py
frontend/: Static UI served at/docs/: Example course text auto‑ingested at startupbackend/tests/: Pytest test files (test_*.py)- Root:
pyproject.toml,.env(.example),run.sh
- Install deps:
uv sync— resolves and installs Python dependencies. - Run (script):
./run.sh— starts FastAPI with reload on port 8000. - Run (manual):
cd backend && uv run uvicorn app:app --reload --port 8000. - Env setup:
cp .env.example .envthen setANTHROPIC_API_KEY. - Tests:
uv run pytest -q— runs unit tests quietly.
- Language: Python 3.13; follow PEP 8, 4‑space indentation, prefer type hints.
- Names: functions/files use
snake_case; classes and Pydantic models usePascalCase. - Module focus: keep concerns isolated (e.g., search in
vector_store.py, parsing indocument_processor.py). - Add concise docstrings; prefer small, testable functions.
- Framework: pytest.
- Location:
backend/tests/test_*.py. - What to test: chunking behavior, search filters, and API routes.
- Run locally:
uv run pytest -q(aim for fast, deterministic tests).
- Commits: imperative mood, short subject (≤50 chars).
- Example:
feat: add lesson filter to course search
- Example:
- PRs: include clear description, link issues (e.g.,
Closes #123), and steps to test; add screenshots for UI changes. - Include any config defaults in
.env.example. Never commit real secrets.
- Secrets only in
.env; required:ANTHROPIC_API_KEY. - CORS is wide‑open for development; restrict for production.
- Vector DB persists under
backend/chroma_db; delete this folder to rebuild the index when needed. - Do not commit
.envorbackend/chroma_db/(ensure.gitignorecovers them).