How shakilahmmed/contextforge works
ContextForge is a multi-tenant RAG platform with a React client and FastAPI backend. Users create a tenant, register and authenticate, upload documents, and chat against indexed content. Uploads are stored and queued; a separate worker extracts text, masks PII, chunks it, and indexes it for retrieval. The API also supports tenant-scoped document listing and chunk visualization. The graph reflects documented architecture and indexed or excerpted references; several frontend API calls and unsampled subsystem details are not verified here.
Main entry points: App.tsx Route app · v1.py API router · ingestion_service.py Ingestion pipeline · db.py SQL database
Components 29
Web client
- Route app
frontend/src/App.tsx - Auth pages
frontend/src/features/auth - Tenant setup
frontend/src/features/tenants/CreateTenantPage.tsx - Document pages
frontend/src/features/documents - Chat page
frontend/src/features/chat/ChatPage.tsx
API and identity
- FastAPI app
app/main.py - API router
app/api/v1.py - Authentication
app/controllers/auth_controller.py - Auth dependencies
app/api/deps.py - Tenant endpoints
app/controllers/tenant_controller.py
Documents and ingestion
- Document endpoints
app/controllers/document_controller.py - Upload service
app/services/document_service.py - Ingestion worker
app/worker.py - Ingestion pipeline
app/services/ingestion_service.py - Text extraction
app/services/text_extraction.py - PII masking
app/core/pii.py
Retrieval and chat
- Chat service
app/services/chat_service.py - Vector store
app/core/vectorstore.py - Language model
app/core/llm.py - Embeddings
app/core/embeddings.py
Persistence and services
- SQL database
app/db.py - Domain models
app/models/document.py - Object storage
app/core/storage.py - Ingestion queue
app/core/queue.py
Other components
- User
- PostgreSQL
- S3-compatible store
- SQS-compatible queue
- Qdrant
Connections 33
- User → Route app: uses
README.md - Route app → Auth pages: routes to
frontend/src/App.tsx - Route app → Tenant setup: routes to
frontend/src/App.tsx - Route app → Document pages: routes to
frontend/src/App.tsx - Route app → Chat page: routes to
frontend/src/App.tsx - Route app → FastAPI app: calls API
README.md - FastAPI app → API router: registers
app/main.py - API router → Authentication: routes to
app/api/v1.py - API router → Tenant endpoints: routes to
app/api/v1.py - API router → Document endpoints: routes to
app/api/v1.py - API router → Chat service: routes to
app/api/v1.py - Authentication → Auth dependencies: uses dependency
app/controllers/auth_controller.py - Authentication → SQL database: queries
app/controllers/auth_controller.py - Tenant endpoints → SQL database: queries
app/controllers/tenant_controller.py - Document endpoints → Upload service: uploads through
app/controllers/document_controller.py - Document endpoints → SQL database: queries
app/controllers/document_controller.py - Document endpoints → Vector store: reads chunks
app/controllers/document_controller.py - Upload service → Object storage: stores files
app/services/document_service.py - Upload service → Ingestion queue: enqueues work
app/services/document_service.py - Ingestion worker → Ingestion queue: consumes
app/worker.py - Ingestion worker → Ingestion pipeline: invokes
app/worker.py - Ingestion pipeline → Object storage: reads file
app/services/ingestion_service.py - Ingestion pipeline → Text extraction: extracts text
app/services/ingestion_service.py - Ingestion pipeline → PII masking: masks text
app/services/ingestion_service.py - Ingestion pipeline → Vector store: indexes chunks
app/services/ingestion_service.py - Chat service → Vector store: retrieves context
app/services/chat_service.py - Chat service → Embeddings: embeds query
app/services/chat_service.py - Chat service → Language model: generates answer
app/services/chat_service.py - SQL database → PostgreSQL: connects to
README.md - Object storage → S3-compatible store: stores objects
app/core/storage.py - Ingestion queue → SQS-compatible queue: dispatches messages
README.md - Vector store → Qdrant: indexes vectors
README.md - SQL database → Domain models: maps entities
app/models/document.py