# kenny-fred/human-computer-interface architecture

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

- Interactive diagram: https://gitdiagram.com/kenny-fred/human-computer-interface
- Repository: https://github.com/kenny-fred/human-computer-interface
- Video tour (about a minute): https://gitdiagram.com/kenny-fred/human-computer-interface/video

## Overview

This is a browser-based translation app with per-user translation history, favorites and statistics, plus phrase prediction, voice input, reviews, and administration. The main flow is browser input through the translation API and controller to LibreTranslate; successful results are saved in JSON-backed history. Prediction uses vocabulary derived from that history. The server also implements review, admin, and notification endpoints. Those capabilities are visible in server excerpts, but their detailed persistence and the admin-page wiring are not; those links are therefore omitted.,

Main entry points: [`backend/routes/translate.js`](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/routes/translate.js) (Translation routes), [`backend/database/db.js`](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/database/db.js) (User history and stats), [`frontend/js/app.js`](https://github.com/kenny-fred/human-computer-interface/blob/main/frontend/js/app.js) (Translation interface), [`backend/controllers/translateController.js`](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/controllers/translateController.js) (Translation controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser app"]
  node_webapp["Translation interface<br/>[app.js]"]
  node_voice["Voice input<br/>[voiceService.js]"]
end

subgraph group_api["Translation API"]
  node_translate_routes["Translation routes<br/>[translate.js]"]
  node_translate_controller["Translation controller"]
  node_autocomplete["Phrase prediction"]
  node_libre_service["Translation service"]
end

subgraph group_data["Translation data"]
  node_history_db[("User history and stats<br/>[db.js]")]
  node_translation_file["Translation JSON<br/>[translations.json]"]
end

subgraph group_operations["Reviews and administration"]
  node_server["Server endpoints<br/>[server.js]"]
  node_admin_page["Admin interface<br/>[admin.html]"]
  node_reviews["Review endpoints<br/>[server.js]"]
  node_admin_features["Admin and notifications<br/>[server.js]"]
end

node_user(("App user"))
node_browser_speech["Browser speech API"]
node_libretranslate["LibreTranslate"]

node_user -->|"uses"| node_webapp
node_webapp -->|"requests predictions"| node_translate_routes
node_webapp -->|"loads favorites"| node_translate_routes
node_webapp -->|"starts voice input"| node_voice
node_voice -->|"uses recognition"| node_browser_speech
node_server -->|"mounts routes"| node_translate_routes
node_translate_routes -->|"dispatches"| node_translate_controller
node_translate_routes -->|"requests suggestions"| node_autocomplete
node_translate_routes -->|"checks duplicates"| node_history_db
node_translate_controller -->|"translates text"| node_libre_service
node_translate_controller -->|"saves and reads"| node_history_db
node_libre_service -->|"sends requests"| node_libretranslate
node_autocomplete -->|"reads vocabulary"| node_history_db
node_history_db -->|"persists data"| node_translation_file
node_server -->|"reads admin stats"| node_history_db
node_admin_page -.->|"admin workflow"| node_admin_features

click node_webapp "https://github.com/kenny-fred/human-computer-interface/blob/main/frontend/js/app.js"
click node_voice "https://github.com/kenny-fred/human-computer-interface/blob/main/frontend/js/voiceService.js"
click node_translate_routes "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/routes/translate.js"
click node_translate_controller "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/controllers/translateController.js"
click node_autocomplete "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/services/autoCompleteService.js"
click node_libre_service "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/services/libreTranslateService.js"
click node_server "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/server.js"
click node_admin_page "https://github.com/kenny-fred/human-computer-interface/blob/main/frontend/admin.html"
click node_reviews "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/server.js"
click node_admin_features "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/server.js"
click node_history_db "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/database/db.js"
click node_translation_file "https://github.com/kenny-fred/human-computer-interface/blob/main/backend/database/translations.json"

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_webapp,node_voice,node_user,node_browser_speech toneBlue
class node_translate_routes,node_translate_controller,node_autocomplete,node_libre_service toneAmber
class node_history_db,node_translation_file toneMint
class node_server,node_admin_page,node_reviews,node_admin_features toneRose
class node_libretranslate toneIndigo
```

## Components

### Browser app

- [Translation interface](https://github.com/kenny-fred/human-computer-interface/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Voice input](https://github.com/kenny-fred/human-computer-interface/blob/main/frontend/js/voiceService.js): `frontend/js/voiceService.js`

### Translation API

- [Translation routes](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/routes/translate.js): `backend/routes/translate.js`
- [Translation controller](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/controllers/translateController.js): `backend/controllers/translateController.js`
- [Phrase prediction](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/services/autoCompleteService.js): `backend/services/autoCompleteService.js`
- [Translation service](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/services/libreTranslateService.js): `backend/services/libreTranslateService.js`

### Translation data

- [User history and stats](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/database/db.js): `backend/database/db.js`
- [Translation JSON](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/database/translations.json): `backend/database/translations.json`

### Reviews and administration

- [Server endpoints](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/server.js): `backend/server.js`
- [Admin interface](https://github.com/kenny-fred/human-computer-interface/blob/main/frontend/admin.html): `frontend/admin.html`
- [Review endpoints](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/server.js): `backend/server.js`
- [Admin and notifications](https://github.com/kenny-fred/human-computer-interface/blob/main/backend/server.js): `backend/server.js`

### Other components

- **App user**
- **Browser speech API**
- **LibreTranslate**

## Connections

- App user → Translation interface: uses
- Translation interface → Translation routes: requests predictions (evidence: `frontend/js/app.js`)
- Translation interface → Translation routes: loads favorites (evidence: `frontend/js/app.js`)
- Translation interface → Voice input: starts voice input (evidence: `frontend/js/app.js`)
- Voice input → Browser speech API: uses recognition (evidence: `frontend/js/voiceService.js`)
- Server endpoints → Translation routes: mounts routes (evidence: `backend/server.js`)
- Translation routes → Translation controller: dispatches (evidence: `backend/routes/translate.js`)
- Translation routes → Phrase prediction: requests suggestions (evidence: `backend/routes/translate.js`)
- Translation routes → User history and stats: checks duplicates (evidence: `backend/routes/translate.js`)
- Translation controller → Translation service: translates text (evidence: `backend/controllers/translateController.js`)
- Translation controller → User history and stats: saves and reads (evidence: `backend/controllers/translateController.js`)
- Translation service → LibreTranslate: sends requests (evidence: `backend/services/libreTranslateService.js`)
- Phrase prediction → User history and stats: reads vocabulary (evidence: `backend/services/autoCompleteService.js`)
- User history and stats → Translation JSON: persists data (evidence: `backend/database/db.js`)
- Server endpoints → User history and stats: reads admin stats (evidence: `backend/server.js`)
- Admin interface → Admin and notifications: admin workflow
