# kenny-fred/sayto architecture

> Architecture diagram of the GitHub repository kenny-fred/sayto, 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/sayto
- Repository: https://github.com/kenny-fred/sayto

## Overview

TranslateHCI is a browser-based translation app with user history, favorites, autocomplete, voice input, and administrative review and notification features. The primary workflow sends text from the browser to the translation API, calls LibreTranslate, then saves and returns the result. The graph includes the JSON-backed persistence and the separately implemented server-side admin/review APIs. Some frontend and server wiring is unsampled, so uncertain links are dashed.

Main entry points: [`backend/server.js`](https://github.com/kenny-fred/sayto/blob/main/backend/server.js) (HTTP server), [`backend/routes/translate.js`](https://github.com/kenny-fred/sayto/blob/main/backend/routes/translate.js) (Translation routes), [`backend/database/db.js`](https://github.com/kenny-fred/sayto/blob/main/backend/database/db.js) (Translation database), [`frontend/js/app.js`](https://github.com/kenny-fred/sayto/blob/main/frontend/js/app.js) (Translation UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

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

subgraph group_api["API and admin"]
  node_server["HTTP server<br/>[server.js]"]
  node_translate_routes["Translation routes<br/>[translate.js]"]
end

subgraph group_translation["Translation services"]
  node_controller["Translation controller"]
  node_autocomplete["Autocomplete"]
  node_libre["LibreTranslate"]
end

subgraph group_data["Persistent data"]
  node_database[("Translation database<br/>[db.js]")]
  node_reviews["Review data<br/>[sayto.json]"]
  node_admin_data["Admin data<br/>[admin.json]"]
  node_notifications["Notifications data<br/>[notifications.json]"]
  node_translation_data["Translation data file<br/>[translations.json]"]
end

node_user(("Translator"))
node_admin(("Administrator"))
node_libretranslate_service["LibreTranslate API<br/>external service"]

node_user -->|"uses"| node_webapp
node_webapp -->|"starts recording"| node_voice
node_webapp -.->|"requests translation"| node_translate_routes
node_translate_routes -->|"routes requests"| node_controller
node_controller -->|"translates text"| node_libre
node_controller -->|"saves and reads"| node_database
node_translate_routes -->|"requests predictions"| node_autocomplete
node_autocomplete -->|"reads vocabulary"| node_database
node_server -->|"mounts routes"| node_translate_routes
node_admin -.->|"uses"| node_adminui
node_adminui -.->|"uses admin APIs"| node_server
node_server -->|"reads statistics and history"| node_database
node_server -.->|"manages review data"| node_reviews
node_server -.->|"manages admin data"| node_admin_data
node_server -.->|"manages notifications"| node_notifications
node_database -->|"reads and writes"| node_translation_data
node_libre -->|"sends translation requests"| node_libretranslate_service

click node_webapp "https://github.com/kenny-fred/sayto/blob/main/frontend/js/app.js"
click node_voice "https://github.com/kenny-fred/sayto/blob/main/frontend/js/voiceService.js"
click node_adminui "https://github.com/kenny-fred/sayto/blob/main/frontend/admin.html"
click node_server "https://github.com/kenny-fred/sayto/blob/main/backend/server.js"
click node_translate_routes "https://github.com/kenny-fred/sayto/blob/main/backend/routes/translate.js"
click node_controller "https://github.com/kenny-fred/sayto/blob/main/backend/controllers/translateController.js"
click node_autocomplete "https://github.com/kenny-fred/sayto/blob/main/backend/services/autoCompleteService.js"
click node_libre "https://github.com/kenny-fred/sayto/blob/main/backend/services/libreTranslateService.js"
click node_database "https://github.com/kenny-fred/sayto/blob/main/backend/database/db.js"
click node_reviews "https://github.com/kenny-fred/sayto/blob/main/backend/database/sayto.json"
click node_admin_data "https://github.com/kenny-fred/sayto/blob/main/backend/database/admin.json"
click node_notifications "https://github.com/kenny-fred/sayto/blob/main/backend/database/notifications.json"
click node_translation_data "https://github.com/kenny-fred/sayto/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_adminui toneBlue
class node_server,node_translate_routes toneAmber
class node_controller,node_autocomplete,node_libre,node_libretranslate_service toneMint
class node_database,node_reviews,node_admin_data,node_notifications,node_translation_data toneRose
class node_user,node_admin toneIndigo
```

## Components

### Browser app

- [Translation UI](https://github.com/kenny-fred/sayto/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Voice input](https://github.com/kenny-fred/sayto/blob/main/frontend/js/voiceService.js): `frontend/js/voiceService.js`
- [Admin interface](https://github.com/kenny-fred/sayto/blob/main/frontend/admin.html): `frontend/admin.html`

### API and admin

- [HTTP server](https://github.com/kenny-fred/sayto/blob/main/backend/server.js): `backend/server.js`
- [Translation routes](https://github.com/kenny-fred/sayto/blob/main/backend/routes/translate.js): `backend/routes/translate.js`

### Translation services

- [Translation controller](https://github.com/kenny-fred/sayto/blob/main/backend/controllers/translateController.js): `backend/controllers/translateController.js`
- [Autocomplete](https://github.com/kenny-fred/sayto/blob/main/backend/services/autoCompleteService.js): `backend/services/autoCompleteService.js`
- [LibreTranslate](https://github.com/kenny-fred/sayto/blob/main/backend/services/libreTranslateService.js): `backend/services/libreTranslateService.js`

### Persistent data

- [Translation database](https://github.com/kenny-fred/sayto/blob/main/backend/database/db.js): `backend/database/db.js`
- [Review data](https://github.com/kenny-fred/sayto/blob/main/backend/database/sayto.json): `backend/database/sayto.json`
- [Admin data](https://github.com/kenny-fred/sayto/blob/main/backend/database/admin.json): `backend/database/admin.json`
- [Notifications data](https://github.com/kenny-fred/sayto/blob/main/backend/database/notifications.json): `backend/database/notifications.json`
- [Translation data file](https://github.com/kenny-fred/sayto/blob/main/backend/database/translations.json): `backend/database/translations.json`

### Other components

- **Translator**
- **Administrator**
- **LibreTranslate API**: external service

## Connections

- Translator → Translation UI: uses
- Translation UI → Voice input: starts recording (evidence: `frontend/js/app.js`)
- Translation UI → Translation routes: requests translation (evidence: `frontend/js/app.js`)
- Translation routes → Translation controller: routes requests (evidence: `backend/routes/translate.js`)
- Translation controller → LibreTranslate: translates text (evidence: `backend/controllers/translateController.js`)
- Translation controller → Translation database: saves and reads (evidence: `backend/controllers/translateController.js`)
- Translation routes → Autocomplete: requests predictions (evidence: `backend/routes/translate.js`)
- Autocomplete → Translation database: reads vocabulary (evidence: `backend/services/autoCompleteService.js`)
- HTTP server → Translation routes: mounts routes (evidence: `backend/server.js`)
- Administrator → Admin interface: uses
- Admin interface → HTTP server: uses admin APIs
- HTTP server → Translation database: reads statistics and history (evidence: `backend/server.js`)
- HTTP server → Review data: manages review data
- HTTP server → Admin data: manages admin data
- HTTP server → Notifications data: manages notifications
- Translation database → Translation data file: reads and writes (evidence: `backend/database/db.js`)
- LibreTranslate → LibreTranslate API: sends translation requests (evidence: `backend/services/libreTranslateService.js`)
