# anusha0100/lexilens architecture

> Architecture diagram of the GitHub repository anusha0100/lexilens, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anusha0100/lexilens
- Repository: https://github.com/anusha0100/lexilens

## Overview

LexiLens is a Flutter reading-accessibility app with an Express/MongoDB backend. The apparent user journey is to sign in, scan or upload a document, process its text, then read it with accessibility aids; users can also manage documents and preferences. The tree supports these product areas, but the README is only a Flutter starter template and most Flutter source was not sampled, so client-side flow and client-to-backend links are not verified. Backend route-to-model links shown here are supported by the source index or excerpts.

Main entry points: [`backend/server.js`](https://github.com/anusha0100/lexilens/blob/main/backend/server.js) (Express API), [`backend/routes/users.js`](https://github.com/anusha0100/lexilens/blob/main/backend/routes/users.js) (Account data routes), [`lib/screens`](https://github.com/anusha0100/lexilens/tree/main/lib/screens) (Authentication screens), [`lib/screens/reading_screen.dart`](https://github.com/anusha0100/lexilens/blob/main/lib/screens/reading_screen.dart) (Reading experience)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Flutter client"]
  node_app["App entry<br/>[main.dart]"]
  node_auth_ui["Authentication screens"]
  node_auth_service["Authentication service<br/>[auth_service.dart]"]
end

subgraph group_reading["Document reading"]
  node_scanner["Scan documents"]
  node_pdf_upload["PDF upload"]
  node_ocr["OCR processing<br/>[ocr_service.dart]"]
  node_documents_ui["Document library"]
  node_reader["Reading experience"]
  node_reading_aids["Reading aids"]
  node_speech["Text-to-speech<br/>[tts_service.dart]"]
end

subgraph group_backend["Backend API"]
  node_api["Express API<br/>[server.js]"]
  node_auth_routes["Auth and sessions<br/>[auth.js]"]
  node_session_routes["Session routes<br/>[sessions.js]"]
  node_document_routes["Document routes<br/>[documents.js]"]
  node_ocr_routes["OCR cache routes<br/>[ocrcache.js]"]
  node_settings_routes["Settings routes<br/>[settings.js]"]
  node_other_routes["Tags and dictionary"]
  node_user_routes["Account data routes<br/>[users.js]"]
end

subgraph group_data["Persistence"]
  node_session_store[("Session records<br/>[UserSession.js]")]
  node_document_store[("Document records<br/>[Document.js]")]
  node_ocr_store[("OCR cache records<br/>[OcrCache.js]")]
  node_settings_store[("Preference records<br/>[UserPreferences.js]")]
  node_app_settings[("App settings<br/>[AppSetting.js]")]
  node_tag_store[("Document tags<br/>[DocumentTag.js]")]
  node_dictionary_store[("Word dictionary<br/>[WordDictionary.js]")]
end

node_user(("App user"))
node_mongo[("MongoDB")]

node_user -.->|"opens"| node_app
node_app -.->|"presents"| node_auth_ui
node_auth_ui -.->|"uses"| node_auth_service
node_user -.->|"scans"| node_scanner
node_user -.->|"uploads"| node_pdf_upload
node_scanner -.->|"processes with"| node_ocr
node_pdf_upload -.->|"processes with"| node_ocr
node_user -.->|"browses"| node_documents_ui
node_user -.->|"reads"| node_reader
node_reader -.->|"uses"| node_reading_aids
node_reader -.->|"uses"| node_speech
node_auth_ui -.->|"calls"| node_api
node_documents_ui -.->|"calls"| node_api
node_api -->|"mounts"| node_auth_routes
node_api -->|"mounts"| node_session_routes
node_api -->|"mounts"| node_document_routes
node_api -->|"mounts"| node_ocr_routes
node_api -->|"mounts"| node_settings_routes
node_api -->|"mounts"| node_other_routes
node_api -->|"mounts"| node_user_routes
node_session_routes -->|"reads and writes"| node_session_store
node_document_routes -->|"uses"| node_document_store
node_ocr_routes -->|"uses"| node_ocr_store
node_settings_routes -->|"reads and writes"| node_settings_store
node_settings_routes -->|"reads and writes"| node_app_settings
node_other_routes -->|"uses"| node_tag_store
node_other_routes -->|"uses"| node_dictionary_store
node_user_routes -->|"deletes"| node_document_store
node_user_routes -->|"deletes"| node_tag_store
node_user_routes -->|"deletes"| node_session_store
node_user_routes -->|"deletes"| node_app_settings
node_api -->|"connects"| node_mongo

click node_app "https://github.com/anusha0100/lexilens/blob/main/lib/main.dart"
click node_auth_ui "https://github.com/anusha0100/lexilens/tree/main/lib/screens"
click node_auth_service "https://github.com/anusha0100/lexilens/blob/main/lib/services/auth_service.dart"
click node_scanner "https://github.com/anusha0100/lexilens/blob/main/lib/screens/scanner_screen.dart"
click node_pdf_upload "https://github.com/anusha0100/lexilens/blob/main/lib/screens/upload_pdf_screen.dart"
click node_ocr "https://github.com/anusha0100/lexilens/blob/main/lib/services/ocr_service.dart"
click node_documents_ui "https://github.com/anusha0100/lexilens/blob/main/lib/screens/documents_screen.dart"
click node_reader "https://github.com/anusha0100/lexilens/blob/main/lib/screens/reading_screen.dart"
click node_reading_aids "https://github.com/anusha0100/lexilens/tree/main/lib/widgets"
click node_speech "https://github.com/anusha0100/lexilens/blob/main/lib/services/tts_service.dart"
click node_api "https://github.com/anusha0100/lexilens/blob/main/backend/server.js"
click node_auth_routes "https://github.com/anusha0100/lexilens/blob/main/backend/routes/auth.js"
click node_session_routes "https://github.com/anusha0100/lexilens/blob/main/backend/routes/sessions.js"
click node_document_routes "https://github.com/anusha0100/lexilens/blob/main/backend/routes/documents.js"
click node_ocr_routes "https://github.com/anusha0100/lexilens/blob/main/backend/routes/ocrcache.js"
click node_settings_routes "https://github.com/anusha0100/lexilens/blob/main/backend/routes/settings.js"
click node_other_routes "https://github.com/anusha0100/lexilens/tree/main/backend/routes"
click node_user_routes "https://github.com/anusha0100/lexilens/blob/main/backend/routes/users.js"
click node_session_store "https://github.com/anusha0100/lexilens/blob/main/backend/models/UserSession.js"
click node_document_store "https://github.com/anusha0100/lexilens/blob/main/backend/models/Document.js"
click node_ocr_store "https://github.com/anusha0100/lexilens/blob/main/backend/models/OcrCache.js"
click node_settings_store "https://github.com/anusha0100/lexilens/blob/main/backend/models/UserPreferences.js"
click node_app_settings "https://github.com/anusha0100/lexilens/blob/main/backend/models/AppSetting.js"
click node_tag_store "https://github.com/anusha0100/lexilens/blob/main/backend/models/DocumentTag.js"
click node_dictionary_store "https://github.com/anusha0100/lexilens/blob/main/backend/models/WordDictionary.js"

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_auth_service,node_user toneBlue
class node_scanner,node_pdf_upload,node_ocr,node_documents_ui,node_reader,node_reading_aids,node_speech,node_mongo toneAmber
class node_api,node_auth_routes,node_session_routes,node_document_routes,node_ocr_routes,node_settings_routes,node_other_routes,node_user_routes toneMint
class node_session_store,node_document_store,node_ocr_store,node_settings_store,node_app_settings,node_tag_store,node_dictionary_store toneRose
```

## Components

### Flutter client

- [App entry](https://github.com/anusha0100/lexilens/blob/main/lib/main.dart): `lib/main.dart`
- [Authentication screens](https://github.com/anusha0100/lexilens/tree/main/lib/screens): `lib/screens`
- [Authentication service](https://github.com/anusha0100/lexilens/blob/main/lib/services/auth_service.dart): `lib/services/auth_service.dart`

### Document reading

- [Scan documents](https://github.com/anusha0100/lexilens/blob/main/lib/screens/scanner_screen.dart): `lib/screens/scanner_screen.dart`
- [PDF upload](https://github.com/anusha0100/lexilens/blob/main/lib/screens/upload_pdf_screen.dart): `lib/screens/upload_pdf_screen.dart`
- [OCR processing](https://github.com/anusha0100/lexilens/blob/main/lib/services/ocr_service.dart): `lib/services/ocr_service.dart`
- [Document library](https://github.com/anusha0100/lexilens/blob/main/lib/screens/documents_screen.dart): `lib/screens/documents_screen.dart`
- [Reading experience](https://github.com/anusha0100/lexilens/blob/main/lib/screens/reading_screen.dart): `lib/screens/reading_screen.dart`
- [Reading aids](https://github.com/anusha0100/lexilens/tree/main/lib/widgets): `lib/widgets`
- [Text-to-speech](https://github.com/anusha0100/lexilens/blob/main/lib/services/tts_service.dart): `lib/services/tts_service.dart`

### Backend API

- [Express API](https://github.com/anusha0100/lexilens/blob/main/backend/server.js): `backend/server.js`
- [Auth and sessions](https://github.com/anusha0100/lexilens/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Session routes](https://github.com/anusha0100/lexilens/blob/main/backend/routes/sessions.js): `backend/routes/sessions.js`
- [Document routes](https://github.com/anusha0100/lexilens/blob/main/backend/routes/documents.js): `backend/routes/documents.js`
- [OCR cache routes](https://github.com/anusha0100/lexilens/blob/main/backend/routes/ocrcache.js): `backend/routes/ocrcache.js`
- [Settings routes](https://github.com/anusha0100/lexilens/blob/main/backend/routes/settings.js): `backend/routes/settings.js`
- [Tags and dictionary](https://github.com/anusha0100/lexilens/tree/main/backend/routes): `backend/routes`
- [Account data routes](https://github.com/anusha0100/lexilens/blob/main/backend/routes/users.js): `backend/routes/users.js`

### Persistence

- [Session records](https://github.com/anusha0100/lexilens/blob/main/backend/models/UserSession.js): `backend/models/UserSession.js`
- [Document records](https://github.com/anusha0100/lexilens/blob/main/backend/models/Document.js): `backend/models/Document.js`
- [OCR cache records](https://github.com/anusha0100/lexilens/blob/main/backend/models/OcrCache.js): `backend/models/OcrCache.js`
- [Preference records](https://github.com/anusha0100/lexilens/blob/main/backend/models/UserPreferences.js): `backend/models/UserPreferences.js`
- [App settings](https://github.com/anusha0100/lexilens/blob/main/backend/models/AppSetting.js): `backend/models/AppSetting.js`
- [Document tags](https://github.com/anusha0100/lexilens/blob/main/backend/models/DocumentTag.js): `backend/models/DocumentTag.js`
- [Word dictionary](https://github.com/anusha0100/lexilens/blob/main/backend/models/WordDictionary.js): `backend/models/WordDictionary.js`

### Other components

- **App user**
- **MongoDB**

## Connections

- App user → App entry: opens
- App entry → Authentication screens: presents
- Authentication screens → Authentication service: uses
- App user → Scan documents: scans
- App user → PDF upload: uploads
- Scan documents → OCR processing: processes with
- PDF upload → OCR processing: processes with
- App user → Document library: browses
- App user → Reading experience: reads
- Reading experience → Reading aids: uses
- Reading experience → Text-to-speech: uses
- Authentication screens → Express API: calls
- Document library → Express API: calls
- Express API → Auth and sessions: mounts (evidence: `backend/server.js`)
- Express API → Session routes: mounts (evidence: `backend/server.js`)
- Express API → Document routes: mounts (evidence: `backend/server.js`)
- Express API → OCR cache routes: mounts (evidence: `backend/server.js`)
- Express API → Settings routes: mounts (evidence: `backend/server.js`)
- Express API → Tags and dictionary: mounts (evidence: `backend/server.js`)
- Express API → Account data routes: mounts (evidence: `backend/server.js`)
- Session routes → Session records: reads and writes (evidence: `backend/routes/sessions.js`)
- Document routes → Document records: uses (evidence: `backend/routes/documents.js`)
- OCR cache routes → OCR cache records: uses (evidence: `backend/routes/ocrcache.js`)
- Settings routes → Preference records: reads and writes (evidence: `backend/routes/settings.js`)
- Settings routes → App settings: reads and writes (evidence: `backend/routes/settings.js`)
- Tags and dictionary → Document tags: uses (evidence: `backend/routes/tags.js`)
- Tags and dictionary → Word dictionary: uses (evidence: `backend/routes/dictionary.js`)
- Account data routes → Document records: deletes (evidence: `backend/routes/users.js`)
- Account data routes → Document tags: deletes (evidence: `backend/routes/users.js`)
- Account data routes → Session records: deletes (evidence: `backend/routes/users.js`)
- Account data routes → App settings: deletes (evidence: `backend/routes/users.js`)
- Express API → MongoDB: connects (evidence: `backend/server.js`)
