# 2303a52243/smart-document-classification-and-management-system architecture

> Architecture diagram of the GitHub repository 2303a52243/smart-document-classification-and-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/2303a52243/smart-document-classification-and-management-system
- Repository: https://github.com/2303a52243/smart-document-classification-and-management-system

## Overview

Smart Document Classification and Management is a React/FastAPI application for authenticated document vaults. Users register or sign in, upload PDF/DOCX/TXT files, then search, preview, correct, download, and reclassify stored documents; analytics and category management are additional workflows. The documented upload flow extracts and preprocesses text, predicts a calibrated category, and stores document metadata and files. Edges reflect excerpts, SOURCE INDEX references, or README statements; unsampled implementation details are not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/App.jsx) (Route shell), [`backend/app/api/documents.py`](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/documents.py) (Document operations), [`frontend/src/api/client.js`](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/api/client.js) (REST client), [`backend/app/database/connection.py`](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/database/connection.py) (MongoDB collections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Route shell<br/>[App.jsx]"]
  node_auth_ui["Auth context<br/>[AuthContext.jsx]"]
  node_upload_ui["Upload page<br/>[Upload.jsx]"]
  node_library_ui["Document library<br/>[Documents.jsx]"]
  node_detail_ui["Document detail<br/>[DocumentDetail.jsx]"]
  node_dashboard_ui["Dashboard<br/>[Dashboard.jsx]"]
  node_categories_ui["Category management<br/>[Categories.jsx]"]
  node_analytics_ui["Analytics view<br/>[Analytics.jsx]"]
  node_api_client["REST client<br/>[client.js]"]
end

subgraph group_api["API and identity"]
  node_api_routes["FastAPI routes<br/>[main.py]"]
  node_auth_routes["Account routes<br/>[auth.py]"]
  node_document_routes["Document operations<br/>[documents.py]"]
  node_category_routes["Category routes<br/>[categories.py]"]
  node_analytics_routes["Analytics routes<br/>[analytics.py]"]
  node_security["JWT security<br/>[security.py]"]
  node_auth_dependency["User dependency<br/>[dependencies.py]"]
end

subgraph group_analysis["Document analysis"]
  node_extractor["Text extraction<br/>[extractor.py]"]
  node_preprocessor["Text preprocessing<br/>[preprocessor.py]"]
  node_classifier["Calibrated classifier<br/>[classifier.py]"]
end

subgraph group_state["Storage and records"]
  node_file_storage["File storage<br/>[storage.py]"]
  node_activity["Activity logging<br/>[activity.py]"]
  node_mongo[("MongoDB collections<br/>[connection.py]")]
end

node_user(("Vault user"))
node_external_store[("S3-compatible storage")]

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_auth_ui
node_app -->|"routes to"| node_upload_ui
node_app -->|"routes to"| node_library_ui
node_app -->|"routes to"| node_detail_ui
node_app -->|"routes to"| node_dashboard_ui
node_app -->|"routes to"| node_categories_ui
node_app -->|"routes to"| node_analytics_ui
node_auth_ui -->|"calls auth"| node_api_client
node_upload_ui -->|"calls API"| node_api_client
node_library_ui -->|"calls API"| node_api_client
node_detail_ui -->|"calls API"| node_api_client
node_dashboard_ui -->|"calls API"| node_api_client
node_categories_ui -->|"calls API"| node_api_client
node_analytics_ui -->|"calls API"| node_api_client
node_api_client -->|"REST requests"| node_api_routes
node_api_routes -->|"registers routes"| node_auth_routes
node_api_routes -->|"registers routes"| node_document_routes
node_api_routes -->|"registers routes"| node_analytics_routes
node_api_routes -->|"registers routes"| node_category_routes
node_auth_routes -->|"uses credentials"| node_security
node_auth_routes -->|"reads/writes users"| node_mongo
node_auth_dependency -->|"validates token"| node_security
node_auth_dependency -->|"loads user"| node_mongo
node_document_routes -->|"requires user"| node_auth_dependency
node_document_routes -->|"extracts text"| node_extractor
node_document_routes -->|"preprocesses text"| node_preprocessor
node_document_routes -->|"classifies text"| node_classifier
node_classifier -->|"cleans text"| node_preprocessor
node_document_routes -->|"saves files"| node_file_storage
node_document_routes -->|"stores records"| node_mongo
node_document_routes -->|"logs actions"| node_activity
node_activity -->|"writes logs"| node_mongo
node_analytics_routes -->|"queries records"| node_mongo
node_category_routes -->|"queries categories"| node_mongo
node_file_storage -.->|"uploads optionally"| node_external_store

click node_app "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/context/AuthContext.jsx"
click node_upload_ui "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Upload.jsx"
click node_library_ui "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Documents.jsx"
click node_detail_ui "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/DocumentDetail.jsx"
click node_dashboard_ui "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Dashboard.jsx"
click node_categories_ui "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Categories.jsx"
click node_analytics_ui "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Analytics.jsx"
click node_api_client "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/api/client.js"
click node_api_routes "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/auth.py"
click node_document_routes "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/documents.py"
click node_category_routes "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/categories.py"
click node_analytics_routes "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/analytics.py"
click node_security "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/core/security.py"
click node_auth_dependency "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/core/dependencies.py"
click node_extractor "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/nlp/extractor.py"
click node_preprocessor "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/nlp/preprocessor.py"
click node_classifier "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/nlp/classifier.py"
click node_file_storage "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/services/storage.py"
click node_activity "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/services/activity.py"
click node_mongo "https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/database/connection.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_auth_ui,node_upload_ui,node_library_ui,node_detail_ui,node_dashboard_ui,node_categories_ui,node_analytics_ui,node_api_client,node_user toneBlue
class node_api_routes,node_auth_routes,node_document_routes,node_category_routes,node_analytics_routes,node_security,node_auth_dependency,node_external_store toneAmber
class node_extractor,node_preprocessor,node_classifier toneMint
class node_file_storage,node_activity,node_mongo toneRose
```

## Components

### Web application

- [Route shell](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth context](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Upload page](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Upload.jsx): `frontend/src/pages/Upload.jsx`
- [Document library](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Documents.jsx): `frontend/src/pages/Documents.jsx`
- [Document detail](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/DocumentDetail.jsx): `frontend/src/pages/DocumentDetail.jsx`
- [Dashboard](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Category management](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Categories.jsx): `frontend/src/pages/Categories.jsx`
- [Analytics view](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/pages/Analytics.jsx): `frontend/src/pages/Analytics.jsx`
- [REST client](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### API and identity

- [FastAPI routes](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/main.py): `backend/app/main.py`
- [Account routes](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Document operations](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/documents.py): `backend/app/api/documents.py`
- [Category routes](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/categories.py): `backend/app/api/categories.py`
- [Analytics routes](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/api/analytics.py): `backend/app/api/analytics.py`
- [JWT security](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [User dependency](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/core/dependencies.py): `backend/app/core/dependencies.py`

### Document analysis

- [Text extraction](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/nlp/extractor.py): `backend/app/nlp/extractor.py`
- [Text preprocessing](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/nlp/preprocessor.py): `backend/app/nlp/preprocessor.py`
- [Calibrated classifier](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/nlp/classifier.py): `backend/app/nlp/classifier.py`

### Storage and records

- [File storage](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/services/storage.py): `backend/app/services/storage.py`
- [Activity logging](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/services/activity.py): `backend/app/services/activity.py`
- [MongoDB collections](https://github.com/2303a52243/smart-document-classification-and-management-system/blob/main/backend/app/database/connection.py): `backend/app/database/connection.py`

### Other components

- **Vault user**
- **S3-compatible storage**

## Connections

- Vault user → Route shell: uses (evidence: `frontend/src/App.jsx`)
- Route shell → Auth context: provides auth (evidence: `frontend/src/App.jsx`)
- Route shell → Upload page: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Document library: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Document detail: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Category management: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Analytics view: routes to (evidence: `frontend/src/App.jsx`)
- Auth context → REST client: calls auth (evidence: `frontend/src/context/AuthContext.jsx`)
- Upload page → REST client: calls API (evidence: `frontend/src/pages/Upload.jsx`)
- Document library → REST client: calls API (evidence: `frontend/src/pages/Documents.jsx`)
- Document detail → REST client: calls API (evidence: `frontend/src/pages/DocumentDetail.jsx`)
- Dashboard → REST client: calls API (evidence: `frontend/src/pages/Dashboard.jsx`)
- Category management → REST client: calls API (evidence: `frontend/src/pages/Categories.jsx`)
- Analytics view → REST client: calls API (evidence: `frontend/src/pages/Analytics.jsx`)
- REST client → FastAPI routes: REST requests (evidence: `frontend/src/api/client.js`)
- FastAPI routes → Account routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI routes → Document operations: registers routes (evidence: `backend/app/main.py`)
- FastAPI routes → Analytics routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI routes → Category routes: registers routes (evidence: `backend/app/main.py`)
- Account routes → JWT security: uses credentials (evidence: `backend/app/api/auth.py`)
- Account routes → MongoDB collections: reads/writes users (evidence: `backend/app/api/auth.py`)
- User dependency → JWT security: validates token (evidence: `backend/app/core/dependencies.py`)
- User dependency → MongoDB collections: loads user (evidence: `backend/app/core/dependencies.py`)
- Document operations → User dependency: requires user (evidence: `backend/app/api/documents.py`)
- Document operations → Text extraction: extracts text (evidence: `backend/app/api/documents.py`)
- Document operations → Text preprocessing: preprocesses text (evidence: `backend/app/api/documents.py`)
- Document operations → Calibrated classifier: classifies text (evidence: `backend/app/api/documents.py`)
- Calibrated classifier → Text preprocessing: cleans text (evidence: `backend/app/nlp/classifier.py`)
- Document operations → File storage: saves files (evidence: `backend/app/api/documents.py`)
- Document operations → MongoDB collections: stores records (evidence: `backend/app/api/documents.py`)
- Document operations → Activity logging: logs actions (evidence: `backend/app/api/documents.py`)
- Activity logging → MongoDB collections: writes logs (evidence: `backend/app/services/activity.py`)
- Analytics routes → MongoDB collections: queries records (evidence: `backend/app/api/analytics.py`)
- Category routes → MongoDB collections: queries categories (evidence: `backend/app/api/categories.py`)
- File storage → S3-compatible storage: uploads optionally (evidence: `backend/app/services/storage.py`)
