General
PromptBeginner5 minmarkdown
Untitled Skill
193
Project architecture, structure, and key patterns for the RAG Knowledge Base app
Loading actions...
Main instructions and any bundled files for this skill.
gpt-4o-mini, text-embedding-3-small) + ChromaDB (local) / Qdrant Cloud (prod) + Supabase Storage (prod) / local filesystem (dev)backend/
main.py — FastAPI app, lifespan, CORS, router mounts under /api
models.py — ALL SQLModel table definitions (one file)
database.py — engine, get_session(), create_db_and_tables()
auth.py — require_admin dependency (validates x-admin-key header)
routers/ — APIRouter handlers + per-file Pydantic I/O models
services/ — pure-function business logic modules (no classes)
frontend/src/
pages/ — full-page route components (Home, Chat, Admin)
components/ — reusable UI pieces
lib/api.ts — ALL API calls; exports interfaces + functions
lib/utils.ts — cn() only
db: Annotated[Session, Depends(get_session)]db.get(Model, id)db.exec(select(Model).where(...)).all() / .first()Session(engine) — never receive the request session_: Annotated[None, Depends(require_admin)] as a parameterx-admin-key header from the frontendQDRANT_URL = os.getenv("QDRANT_URL")_is_cloud() -> bool private helper; all public functions branch on itStreamingResponse(generate(), media_type="text/event-stream", headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"})f"data: {json.dumps(event_dict)}\n\n"sources → token → done (or error)fetch + ReadableStream reader; return an abort function () => voidBaseModel response classes in the router file, not in models.pyresponse_model=; never return a SQLModel row directlylib/api.ts; pages/components import functions from therecn() from lib/utils for conditional class merging — never string concatenationuseStateTypeScript and ESLint rules that MUST be followed when creating, modifying, or reviewing any file under apps/frontend/, including .ts, .tsx, .js, and .jsx files. Also apply when discussing frontend li...
risks