# 9bishal/enterprise-document-intelligence-system- architecture

> Architecture diagram of the GitHub repository 9bishal/enterprise-document-intelligence-system-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/9bishal/enterprise-document-intelligence-system-
- Repository: https://github.com/9bishal/enterprise-document-intelligence-system-

## Overview

The product is an organization-facing document intelligence system: users upload departmental documents, which are indexed for semantic and lexical retrieval; they then query the scoped corpus in persistent chat sessions and receive streamed, source-attributed answers. The map follows the documented Django REST application and React client. It also includes the documented hybrid retrieval, admin, and caching capabilities; their detailed internal wiring is not fully shown in the sampled source, so uncertain links are omitted. The tree and excerpts also contain a separate FastAPI implementation, which is not mapped as part of the documented Django workflow.

Main entry points: [`backend/django_backend/urls.py`](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/urls.py) (API routing), [`backend/app/rag_graph.py`](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/rag_graph.py) (RAG orchestration), [`frontend/src/App.jsx`](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/App.jsx) (App routing), [`backend/django_backend/views/rag.py`](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/rag.py) (Chat endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routing<br/>[App.jsx]"]
  node_query_ui["Chat and sessions<br/>[QueryPage.jsx]"]
  node_documents_ui["Document workspace<br/>[DocumentsPage.jsx]"]
  node_admin_ui["Admin console<br/>[AdminDashboard.jsx]"]
end

subgraph group_api["API and access"]
  node_api_routes["API routing<br/>[urls.py]"]
  node_auth_views["Authentication<br/>[auth.py]"]
  node_document_views["Document endpoints<br/>[documents.py]"]
  node_rag_views["Chat endpoints<br/>[rag.py]"]
  node_admin_views["Admin endpoints<br/>[admin.py]"]
  node_llm_admin["LLM configuration<br/>[admin_llm.py]"]
  node_permissions["Role permissions<br/>[permissions.py]"]
end

subgraph group_documents["Document indexing"]
  node_index_views["Indexing endpoints<br/>[doc_indexing.py]"]
  node_doc_processing["Chunk and classify<br/>[semantic_chunk.py]"]
  node_vector_index[("Vector index<br/>[vector_store.py]")]
end

subgraph group_rag["RAG answering"]
  node_rag_pipeline["RAG orchestration<br/>[rag_graph.py]"]
  node_hybrid_search["Hybrid retrieval<br/>[hybrid.py]"]
  node_bm25["Lexical search<br/>[bm25.py]"]
  node_reranker["Result reranking<br/>[reranker.py]"]
  node_context["Context assembly<br/>[context_builder.py]"]
end

subgraph group_state["State and operations"]
  node_relational_db[("Application database<br/>[models.py]")]
  node_cache_manager["Cache manager<br/>[manager.py]"]
end

node_user(("Organization user"))
node_llm{{"LLM provider"}}
node_redis[("Redis cache")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_query_ui
node_app -->|"routes to"| node_documents_ui
node_app -->|"routes to"| node_admin_ui
node_query_ui -->|"requests chat"| node_api_routes
node_documents_ui -->|"requests documents"| node_api_routes
node_admin_ui -->|"requests admin"| node_api_routes
node_api_routes -->|"dispatches"| node_auth_views
node_api_routes -->|"dispatches"| node_document_views
node_api_routes -->|"dispatches"| node_index_views
node_api_routes -->|"dispatches"| node_rag_views
node_api_routes -->|"dispatches"| node_admin_views
node_api_routes -->|"dispatches"| node_llm_admin
node_auth_views -->|"checks access"| node_permissions
node_document_views -->|"checks access"| node_permissions
node_rag_views -->|"checks access"| node_permissions
node_admin_views -->|"checks access"| node_permissions
node_index_views -->|"indexes content"| node_doc_processing
node_doc_processing -->|"writes chunks"| node_vector_index
node_document_views -->|"reads and writes"| node_relational_db
node_index_views -->|"records status"| node_relational_db
node_rag_views -->|"stores chat"| node_relational_db
node_rag_views -->|"runs query"| node_rag_pipeline
node_rag_pipeline -->|"searches vectors"| node_vector_index
node_rag_pipeline -->|"retrieves passages"| node_hybrid_search
node_hybrid_search -->|"combines lexical search"| node_bm25
node_hybrid_search -->|"reranks results"| node_reranker
node_rag_pipeline -->|"builds context"| node_context
node_rag_pipeline -->|"requests generation"| node_llm
node_llm_admin -->|"saves configuration"| node_relational_db
node_rag_pipeline -.->|"uses caches"| node_cache_manager
node_cache_manager -.->|"reads and writes"| node_redis

click node_app "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/App.jsx"
click node_query_ui "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/pages/QueryPage.jsx"
click node_documents_ui "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/pages/DocumentsPage.jsx"
click node_admin_ui "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/components/AdminDashboard.jsx"
click node_api_routes "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/urls.py"
click node_auth_views "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/auth.py"
click node_document_views "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/documents.py"
click node_index_views "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/doc_indexing.py"
click node_rag_views "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/rag.py"
click node_admin_views "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/admin.py"
click node_llm_admin "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/admin_llm.py"
click node_permissions "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/permissions.py"
click node_doc_processing "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/semantic_chunk.py"
click node_vector_index "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/vector_store.py"
click node_rag_pipeline "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/rag_graph.py"
click node_hybrid_search "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/hybrid.py"
click node_bm25 "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/bm25.py"
click node_reranker "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/reranker.py"
click node_context "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/context_builder.py"
click node_relational_db "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/models.py"
click node_cache_manager "https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/cache/manager.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_query_ui,node_documents_ui,node_admin_ui,node_user toneBlue
class node_api_routes,node_auth_views,node_document_views,node_rag_views,node_admin_views,node_llm_admin,node_permissions,node_redis toneAmber
class node_index_views,node_doc_processing,node_vector_index toneMint
class node_rag_pipeline,node_hybrid_search,node_bm25,node_reranker,node_context toneRose
class node_relational_db,node_cache_manager,node_llm toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Chat and sessions](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/pages/QueryPage.jsx): `frontend/src/pages/QueryPage.jsx`
- [Document workspace](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/pages/DocumentsPage.jsx): `frontend/src/pages/DocumentsPage.jsx`
- [Admin console](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/frontend/src/components/AdminDashboard.jsx): `frontend/src/components/AdminDashboard.jsx`

### API and access

- [API routing](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/urls.py): `backend/django_backend/urls.py`
- [Authentication](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/auth.py): `backend/django_backend/views/auth.py`
- [Document endpoints](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/documents.py): `backend/django_backend/views/documents.py`
- [Chat endpoints](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/rag.py): `backend/django_backend/views/rag.py`
- [Admin endpoints](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/admin.py): `backend/django_backend/views/admin.py`
- [LLM configuration](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/admin_llm.py): `backend/django_backend/views/admin_llm.py`
- [Role permissions](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/permissions.py): `backend/django_backend/permissions.py`

### Document indexing

- [Indexing endpoints](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/views/doc_indexing.py): `backend/django_backend/views/doc_indexing.py`
- [Chunk and classify](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/semantic_chunk.py): `backend/app/semantic_chunk.py`
- [Vector index](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/vector_store.py): `backend/app/vector_store.py`

### RAG answering

- [RAG orchestration](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/rag_graph.py): `backend/app/rag_graph.py`
- [Hybrid retrieval](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/hybrid.py): `backend/app/retrieval/hybrid.py`
- [Lexical search](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/bm25.py): `backend/app/retrieval/bm25.py`
- [Result reranking](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/reranker.py): `backend/app/retrieval/reranker.py`
- [Context assembly](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/app/retrieval/context_builder.py): `backend/app/retrieval/context_builder.py`

### State and operations

- [Application database](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/models.py): `backend/django_backend/models.py`
- [Cache manager](https://github.com/9bishal/enterprise-document-intelligence-system-/blob/main/backend/django_backend/cache/manager.py): `backend/django_backend/cache/manager.py`

### Other components

- **Organization user**
- **LLM provider**
- **Redis cache**

## Connections

- Organization user → App routing: uses
- App routing → Chat and sessions: routes to
- App routing → Document workspace: routes to
- App routing → Admin console: routes to
- Chat and sessions → API routing: requests chat
- Document workspace → API routing: requests documents
- Admin console → API routing: requests admin
- API routing → Authentication: dispatches
- API routing → Document endpoints: dispatches
- API routing → Indexing endpoints: dispatches
- API routing → Chat endpoints: dispatches
- API routing → Admin endpoints: dispatches
- API routing → LLM configuration: dispatches
- Authentication → Role permissions: checks access
- Document endpoints → Role permissions: checks access
- Chat endpoints → Role permissions: checks access
- Admin endpoints → Role permissions: checks access
- Indexing endpoints → Chunk and classify: indexes content
- Chunk and classify → Vector index: writes chunks
- Document endpoints → Application database: reads and writes
- Indexing endpoints → Application database: records status
- Chat endpoints → Application database: stores chat
- Chat endpoints → RAG orchestration: runs query
- RAG orchestration → Vector index: searches vectors
- RAG orchestration → Hybrid retrieval: retrieves passages
- Hybrid retrieval → Lexical search: combines lexical search
- Hybrid retrieval → Result reranking: reranks results
- RAG orchestration → Context assembly: builds context
- RAG orchestration → LLM provider: requests generation
- LLM configuration → Application database: saves configuration
- RAG orchestration → Cache manager: uses caches
- Cache manager → Redis cache: reads and writes
