How git-me-harish/textlens works
TextLens is a document-intelligence platform: users upload documents for OCR and domain-specific extraction, then can search/chat over them or launch approval-gated actions. It also supports PDF tools, batch and scheduled processing, recovery, and integrations. The graph combines documented workflows with relationships visible in sampled source and the SOURCE INDEX; several route and feature implementations were not sampled, so their internal connections are omitted.
Main entry points: routes API routes · App.jsx React application · tasks.py Background processing · action_tasks.py Action worker
Components 34
Web client
- React application
frontend/src/App.jsx - Pipelines UI
frontend/src/pages/PipelinesPage.jsx - PDF chat UI
frontend/src/pages/PDFChatPage.jsx - API client
frontend/src/lib/api.js - SSE updates
frontend/src/hooks/useSSE.js - Authentication state
frontend/src/lib/AuthContext.jsx
API and services
- FastAPI application
backend/app/main.py - API routes
backend/app/api/routes - Action routes
backend/app/api/routes/actions - MCP proxy routes
backend/app/api/routes/mcp_common.py - Notifications
backend/app/services/notification_service.py
Document processing
- OCR and extraction
backend/app/services/ocr_service.py - Background processing
backend/app/worker/tasks.py - Domain pipelines
backend/app/services/agent_service.py - Hybrid document search
backend/app/services/rag_service.py - Embedding service
backend/app/services/embedding_service.py
Agentic actions
- Action worker
backend/app/worker/action_tasks.py - Action service
backend/app/services/action_service.py - Domain agent router
backend/app/services/actions/agent_router.py - Domain agents
backend/app/services/actions - Approval service
backend/app/services/approval_service.py - MCP service registry
backend/app/services/mcp/registry.py
Data and integrations
- PostgreSQL
- Redis
- S3-compatible storage
- Domain and job models
backend/app/models/models.py - Database access
backend/app/db/database.py - Redis access
backend/app/db/redis.py - File storage
backend/app/services/storage_service.py - Connected services
- Extraction LLM
- Voyage AI
- Groq chat model
Other components
- User
Connections 41
- User → React application: uses
- React application → Pipelines UI: routes to
frontend/src/App.jsx - React application → PDF chat UI: routes to
frontend/src/App.jsx - React application → Authentication state: provides auth
frontend/src/App.jsx - React application → SSE updates: starts updates
frontend/src/App.jsx - Pipelines UI → API client: submits jobs
frontend/src/pages/PipelinesPage.jsx - Pipelines UI → SSE updates: awaits job
frontend/src/pages/PipelinesPage.jsx - React application → FastAPI application: calls API
- FastAPI application → API routes: mounts routes
backend/app/main.py - FastAPI application → File storage: initializes storage
backend/app/main.py - FastAPI application → Action routes: mounts actions
backend/app/main.py - API routes → Background processing: queues processing
- Background processing → OCR and extraction: runs OCR
backend/app/worker/tasks.py - Background processing → File storage: uses file storage
backend/app/worker/tasks.py - Background processing → Domain pipelines: runs pipelines
backend/app/worker/tasks.py - Background processing → Hybrid document search: ingests documents
backend/app/worker/tasks.py - Domain pipelines → Extraction LLM: requests extraction
- PDF chat UI → API routes: requests chat
- API routes → Hybrid document search: retrieves context
- Hybrid document search → Embedding service: embeds query
backend/app/services/rag_service.py - Hybrid document search → PostgreSQL: searches chunks
backend/app/services/rag_service.py - Hybrid document search → Redis access: caches results
backend/app/services/rag_service.py - Embedding service → Voyage AI: creates vectors
backend/app/services/embedding_service.py - API routes → Groq chat model: answers chat
- API routes → Action routes: dispatches actions
- Action routes → Action worker: queues action
- Action worker → Action service: runs action logic
backend/app/worker/action_tasks.py - Action worker → Domain agent router: resolves agent
backend/app/worker/action_tasks.py - Domain agent router → Domain agents: instantiates agent
backend/app/services/actions/agent_router.py - Action worker → Approval service: requests approval
backend/app/worker/action_tasks.py - Action worker → MCP service registry: invokes services
backend/app/worker/action_tasks.py - MCP service registry → MCP proxy routes: calls proxy
- MCP proxy routes → Connected services: forwards requests
- Action worker → SSE updates: publishes updates
- Background processing → SSE updates: publishes status
- FastAPI application → Redis access: streams events
backend/app/main.py - Database access → PostgreSQL: opens sessions
backend/app/db/database.py - Redis access → Redis: connects
backend/app/db/redis.py - File storage → S3-compatible storage: stores files
backend/app/services/storage_service.py - Database access → Domain and job models: provides ORM
backend/app/models/models.py - API routes → Notifications: sends notifications