# twishaachary4/medsync architecture

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

- Interactive diagram: https://gitdiagram.com/twishaachary4/medsync
- Repository: https://github.com/twishaachary4/medsync

## Overview

MedSync is a local web-server shim that provides a Claude-style database API and optional Claude summarization. The principal workflow is a browser client calling the shim, which issues HTTP requests to Express handlers that validate document/query requests and read or write SQLite; summary requests instead call Anthropic. The tree contains no application page source beyond the HTML entry, so the graph focuses on the evidenced shim, API, persistence, and summarization paths.

Main entry points: [`server.js`](https://github.com/twishaachary4/medsync/blob/main/server.js) (HTTP server), [`public/shim.js`](https://github.com/twishaachary4/medsync/blob/main/public/shim.js) (Claude API shim), [`public/index.html`](https://github.com/twishaachary4/medsync/blob/main/public/index.html) (Served page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser compatibility"]
  node_shim["Claude API shim<br/>[shim.js]"]
  node_page["Served page<br/>[index.html]"]
end

subgraph group_api["Server API"]
  node_express["HTTP server<br/>[server.js]"]
  node_doc_routes["Document endpoints<br/>[server.js]"]
  node_query_routes["Query endpoint<br/>[server.js]"]
end

subgraph group_storage["Document storage"]
  node_sqlite[("SQLite database<br/>[server.js]")]
end

subgraph group_summarization["AI summaries"]
  node_summary_route["Summary endpoint<br/>[server.js]"]
end

node_browser(("Browser caller"))
node_anthropic["Anthropic Messages API"]

node_browser -.->|"opens"| node_page
node_page -.->|"loads"| node_shim
node_shim -->|"posts requests"| node_express
node_express -->|"routes requests"| node_doc_routes
node_express -->|"routes requests"| node_query_routes
node_express -->|"routes requests"| node_summary_route
node_doc_routes -->|"reads and writes"| node_sqlite
node_query_routes -->|"queries"| node_sqlite
node_summary_route -->|"sends prompt"| node_anthropic
node_anthropic -->|"returns summary"| node_summary_route

click node_shim "https://github.com/twishaachary4/medsync/blob/main/public/shim.js"
click node_page "https://github.com/twishaachary4/medsync/blob/main/public/index.html"
click node_express "https://github.com/twishaachary4/medsync/blob/main/server.js"
click node_doc_routes "https://github.com/twishaachary4/medsync/blob/main/server.js"
click node_query_routes "https://github.com/twishaachary4/medsync/blob/main/server.js"
click node_sqlite "https://github.com/twishaachary4/medsync/blob/main/server.js"
click node_summary_route "https://github.com/twishaachary4/medsync/blob/main/server.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_shim,node_page,node_browser toneBlue
class node_express,node_doc_routes,node_query_routes toneAmber
class node_sqlite,node_anthropic toneMint
class node_summary_route toneRose
```

## Components

### Browser compatibility

- [Claude API shim](https://github.com/twishaachary4/medsync/blob/main/public/shim.js): `public/shim.js`
- [Served page](https://github.com/twishaachary4/medsync/blob/main/public/index.html): `public/index.html`

### Server API

- [HTTP server](https://github.com/twishaachary4/medsync/blob/main/server.js): `server.js`
- [Document endpoints](https://github.com/twishaachary4/medsync/blob/main/server.js): `server.js`
- [Query endpoint](https://github.com/twishaachary4/medsync/blob/main/server.js): `server.js`

### Document storage

- [SQLite database](https://github.com/twishaachary4/medsync/blob/main/server.js): `server.js`

### AI summaries

- [Summary endpoint](https://github.com/twishaachary4/medsync/blob/main/server.js): `server.js`

### Other components

- **Browser caller**
- **Anthropic Messages API**

## Connections

- Browser caller → Served page: opens
- Served page → Claude API shim: loads
- Claude API shim → HTTP server: posts requests (evidence: `public/shim.js`)
- HTTP server → Document endpoints: routes requests (evidence: `server.js`)
- HTTP server → Query endpoint: routes requests (evidence: `server.js`)
- HTTP server → Summary endpoint: routes requests (evidence: `server.js`)
- Document endpoints → SQLite database: reads and writes (evidence: `server.js`)
- Query endpoint → SQLite database: queries (evidence: `server.js`)
- Summary endpoint → Anthropic Messages API: sends prompt (evidence: `server.js`)
- Anthropic Messages API → Summary endpoint: returns summary (evidence: `server.js`)
