How ranjith-fullstack/enterprise-rag-ai-assistance works
This is a local-first, permission-aware enterprise document assistant. Users authenticate, upload organizational documents, then search or ask questions and receive cited answers; administrators also manage organizations, audit activity, and run evaluations. The README documents ingestion, retrieval, local inference, and database enforcement, while the sampled source confirms application routing, authentication context, and frontend API behavior. Some backend service-to-service calls are not excerpted, so those links are omitted rather than inferred.
Main entry points: main.py FastAPI app · App.jsx React app routes · api.js API client · rag.py Grounded answer orchestration
Components 29
User application
- React app routes
frontend/src/App.jsx - Auth context
frontend/src/features/auth/AuthContext.jsx - Chat page
frontend/src/features/chat/ChatPage.jsx - Document screens
frontend/src/features/documents - Admin and org screens
frontend/src/features/admin - Evaluation page
frontend/src/features/evaluation/EvaluationPage.jsx - API client
frontend/src/lib/api.js
API and access
- FastAPI app
backend/app/main.py - Auth endpoints
backend/app/routers/auth.py - Chat endpoints
backend/app/routers/chat.py - Document endpoints
backend/app/routers/documents.py - Organization endpoints
backend/app/routers/organizations.py - Search endpoints
backend/app/routers/search.py - Evaluation endpoints
backend/app/routers/evaluation.py - Identity service
backend/app/services/auth.py - Access dependencies
backend/app/dependencies/auth.py
Document ingestion
- Document extraction
backend/app/services/ingestion.py - Safe file storage
backend/app/services/storage.py - Chunk embedding persistence
backend/app/services/embedding_pipeline.py
Search and answers
- Local embeddings
backend/app/services/embeddings.py - Semantic search
backend/app/services/search.py - Grounded answer orchestration
backend/app/services/rag.py - Local LLM generation
backend/app/services/llm.py
State and operations
- PostgreSQL and pgvector
- RLS transaction context
backend/app/database/context.py - Runtime configuration
backend/app/core/config.py - Ollama
- Embedding model
Other components
- User
Connections 37
- User → React app routes: uses
README.md - React app routes → Auth context: provides context
frontend/src/App.jsx - React app routes → Chat page: routes to
frontend/src/App.jsx - React app routes → Document screens: routes to
frontend/src/App.jsx - React app routes → Admin and org screens: routes to
frontend/src/App.jsx - React app routes → Evaluation page: routes to
frontend/src/App.jsx - Auth context → API client: calls
frontend/src/features/auth/AuthContext.jsx - Chat page → API client: calls
frontend/src/features/chat/ChatPage.jsx - Document screens → API client: calls
frontend/src/features/documents/DocumentDetailsPage.jsx - Admin and org screens → API client: calls
frontend/src/features/admin/AdminUsersPage.jsx - Evaluation page → API client: calls
frontend/src/features/evaluation/EvaluationPage.jsx - API client → FastAPI app: sends requests
README.md - FastAPI app → Auth endpoints: registers
backend/app/main.py - FastAPI app → Chat endpoints: registers
backend/app/main.py - FastAPI app → Document endpoints: registers
backend/app/main.py - FastAPI app → Organization endpoints: registers
backend/app/main.py - FastAPI app → Search endpoints: registers
backend/app/main.py - FastAPI app → Evaluation endpoints: registers
backend/app/main.py - Auth endpoints → Identity service: delegates
backend/app/routers/auth.py - Access dependencies → PostgreSQL and pgvector: verifies access
backend/app/dependencies/auth.py - Access dependencies → RLS transaction context: sets tenant context
backend/app/dependencies/auth.py - Document endpoints → Document extraction: handles uploads
- Document extraction → Safe file storage: stores files
backend/app/services/ingestion.py - Document extraction → Chunk embedding persistence: requests embeddings
backend/app/services/ingestion.py - Chunk embedding persistence → Local embeddings: embeds chunks
backend/app/services/embedding_pipeline.py - Chunk embedding persistence → PostgreSQL and pgvector: persists vectors
README.md - Local embeddings → Embedding model: runs locally
README.md - Search endpoints → Semantic search: delegates search
backend/app/routers/search.py - Chat endpoints → Grounded answer orchestration: answers questions
- Grounded answer orchestration → Semantic search: retrieves passages
backend/app/services/rag.py - Grounded answer orchestration → Local LLM generation: generates answer
backend/app/services/rag.py - Semantic search → Local embeddings: embeds query
backend/app/services/search.py - Semantic search → PostgreSQL and pgvector: queries chunks
README.md - Local LLM generation → Ollama: requests generation
README.md - Grounded answer orchestration → PostgreSQL and pgvector: persists history
README.md - PostgreSQL and pgvector → RLS transaction context: enforces RLS
README.md - Runtime configuration → Ollama: configures host
backend/app/core/config.py