# arontidumpti/https---github.com-arontidumpti-legalcloudv1 architecture

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

- Interactive diagram: https://gitdiagram.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1
- Repository: https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1

## Overview

LegalCloud is a Laravel legal-practice application for managing organizations, cases, documents, users, and an AI assistant. The main user path runs from the browser through API routes and controllers into scoped records; document uploads and searches feed document processing and retrieval, while assistant questions use retrieved passages to produce cited answers. The graph also preserves case management, identity, auditing, and provider-backed AI. Relationships are limited to those shown in excerpts, the SOURCE INDEX, or README; some unsampled subsystems are represented without asserted call paths.

Main entry points: [`Legalcc2/app/Models`](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/tree/main/Legalcc2/app/Models) (Legal records), [`Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php`](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php) (Document management), [`Legalcc2/routes/api.php`](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/routes/api.php) (API routes), [`Legalcc2/app/Http/Controllers/Api/V1/CaseController.php`](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/CaseController.php) (Case management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_frontend["Web application<br/>[app.js]"]
  node_views["Views and state<br/>[views.js]"]
end

subgraph group_api["Application API"]
  node_api_routes["API routes<br/>[api.php]"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_assistant["Assistant API"]
end

subgraph group_legal["Legal records"]
  node_cases["Case management<br/>[CaseController.php]"]
  node_records[("Legal records")]
end

subgraph group_ai["AI and documents"]
  node_documents["Document management"]
  node_rag["RAG answers"]
  node_vector_index["Vector indexing"]
  node_doc_search["Document search<br/>[HybridSearch.php]"]
  node_ocr_job["OCR processing"]
  node_embedding_job["Embedding job"]
  node_providers["AI providers"]
end

subgraph group_platform["Identity and governance"]
  node_audit["Audit logging<br/>[AuditLogger.php]"]
  node_scope["Record access scope<br/>[RecordScope.php]"]
  node_identity["Identity and roles"]
end

node_user(("Practice user"))
node_mysql[("MySQL database")]
node_private_files[("Private file storage")]
node_pgvector[("PostgreSQL vectors")]
node_llm{{"LLM service"}}
node_embedding_service{{"Embedding service"}}

node_user -->|"uses"| node_frontend
node_frontend -->|"renders"| node_views
node_frontend -->|"requests"| node_api_routes
node_api_routes -->|"routes to"| node_auth
node_api_routes -->|"routes to"| node_cases
node_api_routes -->|"routes to"| node_documents
node_api_routes -->|"routes to"| node_assistant
node_cases -->|"reads and writes"| node_records
node_documents -->|"reads and writes"| node_records
node_documents -->|"scopes records"| node_scope
node_cases -->|"scopes records"| node_scope
node_documents -->|"records actions"| node_audit
node_cases -->|"records actions"| node_audit
node_assistant -->|"requests answers"| node_rag
node_assistant -->|"stores conversations"| node_records
node_rag -->|"searches vectors"| node_vector_index
node_rag -->|"retrieves passages"| node_records
node_documents -->|"searches documents"| node_doc_search
node_documents -->|"stores files"| node_private_files
node_vector_index -->|"writes and searches"| node_pgvector
node_vector_index -->|"requests embeddings"| node_embedding_service
node_embedding_job -->|"indexes chunks"| node_vector_index
node_providers -.->|"configures provider"| node_llm
node_providers -.->|"configures provider"| node_embedding_service
node_rag -.->|"generates answers"| node_llm
node_ocr_job -.->|"processes documents"| node_records
node_identity -->|"manages tokens"| node_records
node_records -->|"persists records"| node_mysql

click node_frontend "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/resources/js/app.js"
click node_views "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/resources/js/views.js"
click node_api_routes "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/routes/api.php"
click node_auth "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/AuthController.php"
click node_cases "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/CaseController.php"
click node_documents "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php"
click node_assistant "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/AssistantController.php"
click node_rag "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/AI/RagAnswerService.php"
click node_vector_index "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/AI/VectorIndexService.php"
click node_doc_search "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Documents/HybridSearch.php"
click node_ocr_job "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Jobs/ProcessDocumentOcr.php"
click node_embedding_job "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Jobs/IndexDocumentEmbeddings.php"
click node_providers "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Providers/AppServiceProvider.php"
click node_records "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/tree/main/Legalcc2/app/Models"
click node_audit "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Audit/AuditLogger.php"
click node_scope "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Access/RecordScope.php"
click node_identity "https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Identity/ApiTokenService.php"

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_frontend,node_views,node_user toneBlue
class node_api_routes,node_auth,node_assistant,node_mysql,node_private_files,node_pgvector toneAmber
class node_cases,node_records toneMint
class node_documents,node_rag,node_vector_index,node_doc_search,node_ocr_job,node_embedding_job,node_providers toneRose
class node_audit,node_scope,node_identity,node_llm,node_embedding_service toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/resources/js/app.js): `Legalcc2/resources/js/app.js`
- [Views and state](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/resources/js/views.js): `Legalcc2/resources/js/views.js`

### Application API

- [API routes](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/routes/api.php): `Legalcc2/routes/api.php`
- [Authentication](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/AuthController.php): `Legalcc2/app/Http/Controllers/Api/V1/AuthController.php`
- [Assistant API](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/AssistantController.php): `Legalcc2/app/Http/Controllers/Api/V1/AssistantController.php`

### Legal records

- [Case management](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/CaseController.php): `Legalcc2/app/Http/Controllers/Api/V1/CaseController.php`
- [Legal records](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/tree/main/Legalcc2/app/Models): `Legalcc2/app/Models`

### AI and documents

- [Document management](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php): `Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php`
- [RAG answers](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/AI/RagAnswerService.php): `Legalcc2/app/Domain/AI/RagAnswerService.php`
- [Vector indexing](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/AI/VectorIndexService.php): `Legalcc2/app/Domain/AI/VectorIndexService.php`
- [Document search](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Documents/HybridSearch.php): `Legalcc2/app/Domain/Documents/HybridSearch.php`
- [OCR processing](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Jobs/ProcessDocumentOcr.php): `Legalcc2/app/Jobs/ProcessDocumentOcr.php`
- [Embedding job](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Jobs/IndexDocumentEmbeddings.php): `Legalcc2/app/Jobs/IndexDocumentEmbeddings.php`
- [AI providers](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Providers/AppServiceProvider.php): `Legalcc2/app/Providers/AppServiceProvider.php`

### Identity and governance

- [Audit logging](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Audit/AuditLogger.php): `Legalcc2/app/Domain/Audit/AuditLogger.php`
- [Record access scope](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Access/RecordScope.php): `Legalcc2/app/Domain/Access/RecordScope.php`
- [Identity and roles](https://github.com/arontidumpti/https---github.com-arontidumpti-legalcloudv1/blob/main/Legalcc2/app/Domain/Identity/ApiTokenService.php): `Legalcc2/app/Domain/Identity/ApiTokenService.php`

### Other components

- **Practice user**
- **MySQL database**
- **Private file storage**
- **PostgreSQL vectors**
- **LLM service**
- **Embedding service**

## Connections

- Practice user → Web application: uses (evidence: `Legalcc2/resources/js/app.js`)
- Web application → Views and state: renders (evidence: `Legalcc2/resources/js/app.js`)
- Web application → API routes: requests (evidence: `Legalcc2/resources/js/app.js`)
- API routes → Authentication: routes to (evidence: `Legalcc2/routes/api.php`)
- API routes → Case management: routes to (evidence: `Legalcc2/routes/api.php`)
- API routes → Document management: routes to (evidence: `Legalcc2/routes/api.php`)
- API routes → Assistant API: routes to (evidence: `Legalcc2/routes/api.php`)
- Case management → Legal records: reads and writes (evidence: `Legalcc2/app/Http/Controllers/Api/V1/CaseController.php`)
- Document management → Legal records: reads and writes (evidence: `Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php`)
- Document management → Record access scope: scopes records (evidence: `Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php`)
- Case management → Record access scope: scopes records (evidence: `Legalcc2/app/Http/Controllers/Api/V1/CaseController.php`)
- Document management → Audit logging: records actions (evidence: `Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php`)
- Case management → Audit logging: records actions (evidence: `Legalcc2/app/Http/Controllers/Api/V1/CaseController.php`)
- Assistant API → RAG answers: requests answers (evidence: `Legalcc2/app/Http/Controllers/Api/V1/AssistantController.php`)
- Assistant API → Legal records: stores conversations (evidence: `Legalcc2/app/Http/Controllers/Api/V1/AssistantController.php`)
- RAG answers → Vector indexing: searches vectors (evidence: `Legalcc2/app/Domain/AI/RagAnswerService.php`)
- RAG answers → Legal records: retrieves passages (evidence: `Legalcc2/app/Domain/AI/RagAnswerService.php`)
- Document management → Document search: searches documents (evidence: `Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php`)
- Document management → Private file storage: stores files (evidence: `Legalcc2/app/Http/Controllers/Api/V1/DocumentController.php`)
- Vector indexing → PostgreSQL vectors: writes and searches (evidence: `Legalcc2/app/Domain/AI/VectorIndexService.php`)
- Vector indexing → Embedding service: requests embeddings (evidence: `Legalcc2/app/Domain/AI/VectorIndexService.php`)
- Embedding job → Vector indexing: indexes chunks (evidence: `Legalcc2/app/Jobs/IndexDocumentEmbeddings.php`)
- AI providers → LLM service: configures provider (evidence: `Legalcc2/app/Providers/AppServiceProvider.php`)
- AI providers → Embedding service: configures provider (evidence: `Legalcc2/app/Providers/AppServiceProvider.php`)
- RAG answers → LLM service: generates answers (evidence: `Legalcc2/app/Domain/AI/RagAnswerService.php`)
- OCR processing → Legal records: processes documents
- Identity and roles → Legal records: manages tokens (evidence: `Legalcc2/app/Domain/Identity/ApiTokenService.php`)
- Legal records → MySQL database: persists records
