This repository contains a complete code intelligence system with:
- A FastAPI backend that ingests repositories, parses code with Tree-sitter, builds embeddings, indexes with FAISS, and answers grounded questions with Qwen.
- A Vite + React frontend that manages projects, uploads ZIPs, triggers indexing, and provides docs + chat UI.
this_studio/
backend/
app/
api/ # FastAPI routes (projects, chat, docs)
core/ # settings, logging, DB models/wrapper
ingestion/ # project creation + ZIP extraction + file scanning
parsing/ # tree-sitter parsing + chunking
embeddings/ # embedding generation
indexing/ # indexing orchestration + FAISS persistence
retrieval/ # chunk retrieval for Q&A
llm/ # Qwen service + prompts
docsgen/ # summary/doc generation
data/ # sqlite DB, repos, vector indexes, cache
scripts/ # smoke test helpers
requirements.txt
.env.example
main.py
README.md
frontend/
src/
api/ # typed API client + route wrappers
hooks/ # useProjects/useProject/useProjectDocs/useProjectChat
utils/ # error normalization + dev logging
App.tsx # UI views and interaction flows
.env.example
package.json
README.md
README.md # this file
- Frontend signs in with Google and calls
POST /auth/google. - Backend verifies Google ID token and issues an app session cookie.
- Frontend creates a project:
POST /projects. - Frontend uploads a ZIP:
POST /projects/{id}/upload-zip. - Backend extracts allowed source files into
backend/data/repos/{id}. - Frontend triggers indexing:
POST /projects/{id}/index. - Backend parses/chunks/embeds and persists FAISS + metadata.
- Frontend loads docs:
GET /projects/{id}/docs. - Frontend sends chat question:
POST /projects/{id}/chat.
POST /auth/google->{ user: { ... } }+ session cookieGET /auth/me->{ user: { ... } }POST /auth/logout->{ ok: true }GET /projects->{ projects: [...] }POST /projects->ProjectGET /projects/{id}->ProjectPOST /projects/{id}/upload-zip->{ project_id, accepted, skipped, repo_path }POST /projects/{id}/index->{ project_id, status, files_indexed, chunks_indexed, symbols_extracted }GET /projects/{id}/docs->{ project_id, summaries: [...] }POST /projects/{id}/chat->{ project_id, answer, citations }
- Python 3.10+
- Node.js 18+
- Enough disk + memory for model downloads and inference
cd backend
pip install -r requirements.txt
cp .env.example .env
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadIn a separate terminal:
cd frontend
npm install
cp .env.example .env.local
# ensure VITE_API_BASE_URL points to backend
npm run devFrontend default dev URL: http://localhost:5173
Backend default URL: http://localhost:8000
Important settings:
APP_ENV,LOG_LEVELQWEN_MODEL_ID,EMBEDDING_MODEL_IDQWEN_MAX_INPUT_TOKENS,QWEN_MAX_NEW_TOKENS,QWEN_TEMPERATUREGOOGLE_CLIENT_ID,SESSION_SECRET,SESSION_COOKIE_NAME,SESSION_TTL_SECONDS,SESSION_COOKIE_SECUREDATA_ROOT,REPO_ROOT,INDEX_ROOT,CACHE_ROOT,TMP_ROOT,SQLITE_PATHCORS_ALLOW_ORIGINS(JSON array)
VITE_API_BASE_URL(required for backend connectivity)VITE_GOOGLE_CLIENT_ID(required for Google Identity Services)VITE_APP_URL(optional, deployment-specific)
Backend uses FastAPI CORSMiddleware and allows local dev origins by default:
http://localhost:5173http://127.0.0.1:5173http://localhost:3000http://127.0.0.1:3000
If your frontend origin is different, update CORS_ALLOW_ORIGINS in backend/.env.
- SQLite metadata:
backend/data/app.db - Extracted repositories:
backend/data/repos/{project_id} - FAISS index files:
backend/data/indexes/project_{id}.indexand metadata JSON - Cache/model files: under
backend/data/cache
cd backend
python scripts/smoke_test.pycd frontend
npm run lint
npm run build
npm run previewPOST /projectshangs:- fixed in current backend by removing nested lock acquisition in DB create path.
- Indexing fails with missing package errors:
- ensure
pip install -r backend/requirements.txtcompleted (includeseinopsandaccelerate).
- ensure
- Browser CORS errors:
- verify backend is running with correct
CORS_ALLOW_ORIGINS.
- verify backend is running with correct
- Chat is slow on first run:
- expected while Qwen weights load/download; subsequent calls are faster.
- Backend module docs:
backend/README.md - Frontend module docs:
frontend/README.md
- Preserve stable API contracts between frontend and backend.
- Keep frontend data flow fully backend-driven (no browser-side direct LLM calls).
- Prefer targeted fixes over architecture rewrites.