# naf7111/midinfo architecture

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

- Interactive diagram: https://gitdiagram.com/naf7111/midinfo
- Repository: https://github.com/naf7111/midinfo

## Overview

MedInfo is a lightweight medical-blog CMS: staff manage categories and publish posts, while readers browse, search, and view posts. The documented browser pages are served as static files, and the API handles category and post operations backed by SQLite. The graph follows the explicit routes in `server.js`; `app.js` contains a second, overlapping API implementation, and the supplied tree does not include the `bin/www` entry referenced by the start script. UI behavior and the documented editor/image features are not verified in sampled page source.

Main entry points: [`public/admin.html`](https://github.com/naf7111/midinfo/blob/master/public/admin.html) (Admin page), [`public/index.html`](https://github.com/naf7111/midinfo/blob/master/public/index.html) (Post listing), [`server.js`](https://github.com/naf7111/midinfo/blob/master/server.js) (Post endpoints), [`public/post.html`](https://github.com/naf7111/midinfo/blob/master/public/post.html) (Post detail)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_admin["Admin page<br/>[admin.html]"]
  node_listing["Post listing<br/>[index.html]"]
  node_detail["Post detail<br/>[post.html]"]
  node_browse["Browse and search<br/>[index.html]"]
  node_editor["Post editor<br/>[admin.html]"]
  node_category_ui["Category management<br/>[admin.html]"]
end

subgraph group_api["API operations"]
  node_api_server["Express API<br/>[server.js]"]
  node_category_api["Category endpoints<br/>[server.js]"]
  node_post_api["Post endpoints<br/>[server.js]"]
end

subgraph group_data["Persistence"]
  node_sqlite[("SQLite database<br/>[database.js]")]
end

node_staff(("Staff"))
node_readers(("Readers"))

node_staff -->|"uses"| node_admin
node_readers -->|"uses"| node_listing
node_readers -->|"opens"| node_detail
node_api_server -->|"serves static"| node_admin
node_api_server -->|"serves static"| node_listing
node_api_server -->|"serves static"| node_detail
node_admin -->|"requests"| node_category_api
node_admin -->|"requests"| node_post_api
node_listing -->|"requests"| node_post_api
node_detail -->|"requests"| node_post_api
node_category_api -->|"reads/writes"| node_sqlite
node_post_api -->|"reads/writes"| node_sqlite
node_editor -->|"manages"| node_category_ui
node_listing -->|"supports"| node_browse

click node_admin "https://github.com/naf7111/midinfo/blob/master/public/admin.html"
click node_listing "https://github.com/naf7111/midinfo/blob/master/public/index.html"
click node_detail "https://github.com/naf7111/midinfo/blob/master/public/post.html"
click node_browse "https://github.com/naf7111/midinfo/blob/master/public/index.html"
click node_editor "https://github.com/naf7111/midinfo/blob/master/public/admin.html"
click node_category_ui "https://github.com/naf7111/midinfo/blob/master/public/admin.html"
click node_api_server "https://github.com/naf7111/midinfo/blob/master/server.js"
click node_category_api "https://github.com/naf7111/midinfo/blob/master/server.js"
click node_post_api "https://github.com/naf7111/midinfo/blob/master/server.js"
click node_sqlite "https://github.com/naf7111/midinfo/blob/master/database.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_admin,node_listing,node_detail,node_browse,node_editor,node_category_ui toneBlue
class node_api_server,node_category_api,node_post_api toneAmber
class node_sqlite toneMint
class node_staff,node_readers toneIndigo
```

## Components

### Web experience

- [Admin page](https://github.com/naf7111/midinfo/blob/master/public/admin.html): `public/admin.html`
- [Post listing](https://github.com/naf7111/midinfo/blob/master/public/index.html): `public/index.html`
- [Post detail](https://github.com/naf7111/midinfo/blob/master/public/post.html): `public/post.html`
- [Browse and search](https://github.com/naf7111/midinfo/blob/master/public/index.html): `public/index.html`
- [Post editor](https://github.com/naf7111/midinfo/blob/master/public/admin.html): `public/admin.html`
- [Category management](https://github.com/naf7111/midinfo/blob/master/public/admin.html): `public/admin.html`

### API operations

- [Express API](https://github.com/naf7111/midinfo/blob/master/server.js): `server.js`
- [Category endpoints](https://github.com/naf7111/midinfo/blob/master/server.js): `server.js`
- [Post endpoints](https://github.com/naf7111/midinfo/blob/master/server.js): `server.js`

### Persistence

- [SQLite database](https://github.com/naf7111/midinfo/blob/master/database.js): `database.js`

### Other components

- **Staff**
- **Readers**

## Connections

- Staff → Admin page: uses
- Readers → Post listing: uses
- Readers → Post detail: opens
- Express API → Admin page: serves static
- Express API → Post listing: serves static
- Express API → Post detail: serves static
- Admin page → Category endpoints: requests
- Admin page → Post endpoints: requests
- Post listing → Post endpoints: requests
- Post detail → Post endpoints: requests
- Category endpoints → SQLite database: reads/writes
- Post endpoints → SQLite database: reads/writes
- Post editor → Category management: manages
- Post listing → Browse and search: supports
