# yubuhui/lawyer-assistant-opensource architecture

> Architecture diagram of the GitHub repository yubuhui/lawyer-assistant-opensource, 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/yubuhui/lawyer-assistant-opensource
- Repository: https://github.com/yubuhui/lawyer-assistant-opensource

## Overview

This is a desktop-oriented legal practice assistant: lawyers manage cases and files, use AI-assisted analysis and chat, and produce or review legal documents. The tree shows additional practice-management areas including clients, tasks, templates, statutes, and judge contacts. The README is empty, and most runtime source was not sampled, so the graph emphasizes documented module boundaries and avoids claiming detailed internal call sequences.

Main entry points: [`.lawyer/lib/api.js`](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/api.js) (Browser API Client), [`.lawyer/lib/case-detail-core.js`](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/case-detail-core.js) (Case Management), [`.lawyer/routes`](https://github.com/yubuhui/lawyer-assistant-opensource/tree/main/.lawyer/routes) (API Routes), [`.lawyer/lib/home-page.js`](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/home-page.js) (Home and Navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Practice Management"]
  node_home["Home and Navigation<br/>[home-page.js]"]
  node_clients["Client Management<br/>[client-mgr-page.js]"]
  node_tasks["Tasks and Reminders<br/>[todo-page.js]"]
end

subgraph group_casework["Casework and Documents"]
  node_cases["Case Management"]
  node_files["Case Files<br/>[file-tree.js]"]
  node_editors["Document Editors<br/>[editor-router.jsx]"]
  node_templates["Legal Templates<br/>[template-engine.js]"]
end

subgraph group_ai["AI and Legal Knowledge"]
  node_chat["AI Chat<br/>[chat.js]"]
  node_analysis["Case Analysis"]
  node_statutes["Statute Search<br/>[statutes.js]"]
end

subgraph group_runtime["Application Runtime"]
  node_api["Browser API Client<br/>[api.js]"]
  node_server["HTTP Server<br/>[server.js]"]
  node_routes["API Routes<br/>[routes]"]
  node_database[("Application Database<br/>[db.js]")]
end

subgraph group_integrations["External Services"]
  node_llm["LLM Gateway<br/>[llm.js]"]
  node_model_provider(("Model Provider"))
  node_mcp["MCP Integration<br/>[index.js]"]
end

node_lawyer(("Lawyer"))
node_mcp_servers(("MCP Servers"))

node_lawyer -->|"uses"| node_home
node_home -->|"opens casework"| node_cases
node_home -->|"opens clients"| node_clients
node_home -->|"opens tasks"| node_tasks
node_cases -->|"manages files"| node_files
node_cases -->|"requests analysis"| node_analysis
node_cases -->|"opens chat"| node_chat
node_files -->|"opens documents"| node_editors
node_templates -.->|"provides templates"| node_editors
node_cases -->|"API requests"| node_api
node_clients -->|"API requests"| node_api
node_tasks -->|"API requests"| node_api
node_files -->|"API requests"| node_api
node_chat -->|"API requests"| node_api
node_api -->|"HTTP requests"| node_server
node_server -->|"dispatches requests"| node_routes
node_routes -->|"reads and writes"| node_database
node_routes -->|"requests inference"| node_llm
node_llm -->|"sends prompts"| node_model_provider
node_routes -->|"statute requests"| node_statutes
node_routes -.->|"MCP requests"| node_mcp
node_mcp -.->|"dispatches tools"| node_mcp_servers

click node_home "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/home-page.js"
click node_cases "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/case-detail-core.js"
click node_clients "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/client-mgr-page.js"
click node_tasks "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/todo-page.js"
click node_files "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/file-tree.js"
click node_editors "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/editor/editor-router.jsx"
click node_templates "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/template-engine.js"
click node_chat "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/chat.js"
click node_analysis "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/ai-analysis-panel.js"
click node_statutes "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/routes/statutes.js"
click node_api "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/api.js"
click node_server "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/server.js"
click node_routes "https://github.com/yubuhui/lawyer-assistant-opensource/tree/main/.lawyer/routes"
click node_database "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/db.js"
click node_llm "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/server/llm.js"
click node_mcp "https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/server/mcp/index.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_home,node_clients,node_tasks toneBlue
class node_cases,node_files,node_editors,node_templates toneAmber
class node_chat,node_analysis,node_statutes,node_mcp_servers toneMint
class node_api,node_server,node_routes,node_database toneRose
class node_llm,node_model_provider,node_mcp,node_lawyer toneIndigo
```

## Components

### Practice Management

- [Home and Navigation](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/home-page.js): `.lawyer/lib/home-page.js`
- [Client Management](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/client-mgr-page.js): `.lawyer/lib/client-mgr-page.js`
- [Tasks and Reminders](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/todo-page.js): `.lawyer/lib/todo-page.js`

### Casework and Documents

- [Case Management](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/case-detail-core.js): `.lawyer/lib/case-detail-core.js`
- [Case Files](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/file-tree.js): `.lawyer/lib/file-tree.js`
- [Document Editors](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/editor/editor-router.jsx): `.lawyer/editor/editor-router.jsx`
- [Legal Templates](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/template-engine.js): `.lawyer/lib/template-engine.js`

### AI and Legal Knowledge

- [AI Chat](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/chat.js): `.lawyer/lib/chat.js`
- [Case Analysis](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/ai-analysis-panel.js): `.lawyer/lib/ai-analysis-panel.js`
- [Statute Search](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/routes/statutes.js): `.lawyer/routes/statutes.js`

### Application Runtime

- [Browser API Client](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/api.js): `.lawyer/lib/api.js`
- [HTTP Server](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/server.js): `.lawyer/server.js`
- [API Routes](https://github.com/yubuhui/lawyer-assistant-opensource/tree/main/.lawyer/routes): `.lawyer/routes`
- [Application Database](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/lib/db.js): `.lawyer/lib/db.js`

### External Services

- [LLM Gateway](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/server/llm.js): `.lawyer/server/llm.js`
- **Model Provider**
- [MCP Integration](https://github.com/yubuhui/lawyer-assistant-opensource/blob/main/.lawyer/server/mcp/index.js): `.lawyer/server/mcp/index.js`

### Other components

- **Lawyer**
- **MCP Servers**

## Connections

- Lawyer → Home and Navigation: uses
- Home and Navigation → Case Management: opens casework
- Home and Navigation → Client Management: opens clients
- Home and Navigation → Tasks and Reminders: opens tasks
- Case Management → Case Files: manages files
- Case Management → Case Analysis: requests analysis
- Case Management → AI Chat: opens chat
- Case Files → Document Editors: opens documents
- Legal Templates → Document Editors: provides templates
- Case Management → Browser API Client: API requests
- Client Management → Browser API Client: API requests
- Tasks and Reminders → Browser API Client: API requests
- Case Files → Browser API Client: API requests
- AI Chat → Browser API Client: API requests
- Browser API Client → HTTP Server: HTTP requests
- HTTP Server → API Routes: dispatches requests
- API Routes → Application Database: reads and writes
- API Routes → LLM Gateway: requests inference
- LLM Gateway → Model Provider: sends prompts
- API Routes → Statute Search: statute requests
- API Routes → MCP Integration: MCP requests
- MCP Integration → MCP Servers: dispatches tools
