# adnanak8/frontfix architecture

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

- Interactive diagram: https://gitdiagram.com/adnanak8/frontfix
- Repository: https://github.com/adnanak8/frontfix

## Overview

FrontFix AI is a frontend-support chatbot: a developer submits an error or question, the web client uses the FastAPI diagnostic endpoint when available, and displays a suggested fix with explanation and documentation reference. The backend sanitizes input, matches its knowledge data, and returns a diagnostic; the client can instead use local fallback knowledge when offline. The README also describes preset testing and React/SSR, network, JavaScript, CSS, and Hooks guidance. Sampled code supports the main API and diagnostic links; unsampled UI and preset details are represented only where documented.

Main entry points: [`backend/app/engine.py`](https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py) (Diagnostic engine), [`frontend/app.js`](https://github.com/adnanak8/frontfix/blob/main/frontend/app.js) (Request handling), [`backend/app/main.py`](https://github.com/adnanak8/frontfix/blob/main/backend/app/main.py) (HTTP API), [`frontend/index.html`](https://github.com/adnanak8/frontfix/blob/main/frontend/index.html) (Chat interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_studio["Chat interface<br/>[index.html]"]
  node_client_logic["Client logic<br/>[app.js]"]
  node_submit["Request handling<br/>[app.js]"]
  node_offline["Offline matching<br/>[app.js]"]
  node_response_view["Fix display and copy<br/>[app.js]"]
  node_offline_catalog[("Offline knowledge<br/>[app.js]")]
end

subgraph group_service["Diagnostic service"]
  node_api["HTTP API<br/>[main.py]"]
  node_engine["Diagnostic engine<br/>[engine.py]"]
  node_privacy["Credential redaction<br/>[engine.py]"]
  node_matcher["Pattern matching<br/>[engine.py]"]
  node_fallback["Heuristic fallback<br/>[engine.py]"]
  node_presets["Preset listing<br/>[engine.py]"]
end

subgraph group_knowledge["Knowledge and fixes"]
  node_catalog[("Diagnostic knowledge<br/>[knowledge.json]")]
  node_diff_guidance["Code fix guidance<br/>[knowledge.json]"]
  node_docs_refs["Documentation references<br/>[knowledge.json]"]
end

node_developer(("Developer"))
node_api_service["HTTP client"]

node_developer -->|"enters query"| node_studio
node_studio -->|"submits query"| node_submit
node_submit -->|"posts diagnosis"| node_api_service
node_api_service -->|"calls endpoint"| node_api
node_submit -->|"falls back"| node_offline
node_offline -->|"matches locally"| node_offline_catalog
node_api -->|"calls diagnosis"| node_engine
node_engine -->|"sanitizes input"| node_privacy
node_engine -->|"matches patterns"| node_matcher
node_matcher -->|"reads knowledge"| node_catalog
node_engine -->|"uses when unmatched"| node_fallback
node_engine -->|"lists presets"| node_presets
node_api -->|"requests presets"| node_presets
node_matcher -->|"returns code fix"| node_diff_guidance
node_matcher -->|"returns references"| node_docs_refs
node_submit -->|"displays result"| node_response_view
node_offline -->|"provides result"| node_response_view
node_api -.->|"returns result"| node_submit
node_response_view -->|"shows fix"| node_developer
node_client_logic -->|"checks health"| node_api_service

click node_studio "https://github.com/adnanak8/frontfix/blob/main/frontend/index.html"
click node_client_logic "https://github.com/adnanak8/frontfix/blob/main/frontend/app.js"
click node_submit "https://github.com/adnanak8/frontfix/blob/main/frontend/app.js"
click node_offline "https://github.com/adnanak8/frontfix/blob/main/frontend/app.js"
click node_response_view "https://github.com/adnanak8/frontfix/blob/main/frontend/app.js"
click node_api "https://github.com/adnanak8/frontfix/blob/main/backend/app/main.py"
click node_engine "https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py"
click node_privacy "https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py"
click node_matcher "https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py"
click node_fallback "https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py"
click node_presets "https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py"
click node_catalog "https://github.com/adnanak8/frontfix/blob/main/backend/app/knowledge.json"
click node_offline_catalog "https://github.com/adnanak8/frontfix/blob/main/frontend/app.js"
click node_diff_guidance "https://github.com/adnanak8/frontfix/blob/main/backend/app/knowledge.json"
click node_docs_refs "https://github.com/adnanak8/frontfix/blob/main/backend/app/knowledge.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_studio,node_client_logic,node_submit,node_offline,node_response_view,node_offline_catalog,node_api_service toneBlue
class node_api,node_engine,node_privacy,node_matcher,node_fallback,node_presets toneAmber
class node_catalog,node_diff_guidance,node_docs_refs toneMint
class node_developer toneIndigo
```

## Components

### Web client

- [Chat interface](https://github.com/adnanak8/frontfix/blob/main/frontend/index.html): `frontend/index.html`
- [Client logic](https://github.com/adnanak8/frontfix/blob/main/frontend/app.js): `frontend/app.js`
- [Request handling](https://github.com/adnanak8/frontfix/blob/main/frontend/app.js): `frontend/app.js`
- [Offline matching](https://github.com/adnanak8/frontfix/blob/main/frontend/app.js): `frontend/app.js`
- [Fix display and copy](https://github.com/adnanak8/frontfix/blob/main/frontend/app.js): `frontend/app.js`
- [Offline knowledge](https://github.com/adnanak8/frontfix/blob/main/frontend/app.js): `frontend/app.js`

### Diagnostic service

- [HTTP API](https://github.com/adnanak8/frontfix/blob/main/backend/app/main.py): `backend/app/main.py`
- [Diagnostic engine](https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py): `backend/app/engine.py`
- [Credential redaction](https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py): `backend/app/engine.py`
- [Pattern matching](https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py): `backend/app/engine.py`
- [Heuristic fallback](https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py): `backend/app/engine.py`
- [Preset listing](https://github.com/adnanak8/frontfix/blob/main/backend/app/engine.py): `backend/app/engine.py`

### Knowledge and fixes

- [Diagnostic knowledge](https://github.com/adnanak8/frontfix/blob/main/backend/app/knowledge.json): `backend/app/knowledge.json`
- [Code fix guidance](https://github.com/adnanak8/frontfix/blob/main/backend/app/knowledge.json): `backend/app/knowledge.json`
- [Documentation references](https://github.com/adnanak8/frontfix/blob/main/backend/app/knowledge.json): `backend/app/knowledge.json`

### Other components

- **Developer**
- **HTTP client**

## Connections

- Developer → Chat interface: enters query (evidence: `README.md`)
- Chat interface → Request handling: submits query (evidence: `README.md`)
- Request handling → HTTP client: posts diagnosis (evidence: `frontend/app.js`)
- HTTP client → HTTP API: calls endpoint (evidence: `README.md`)
- Request handling → Offline matching: falls back (evidence: `frontend/app.js`)
- Offline matching → Offline knowledge: matches locally (evidence: `frontend/app.js`)
- HTTP API → Diagnostic engine: calls diagnosis (evidence: `backend/app/main.py`)
- Diagnostic engine → Credential redaction: sanitizes input (evidence: `backend/app/engine.py`)
- Diagnostic engine → Pattern matching: matches patterns (evidence: `backend/app/engine.py`)
- Pattern matching → Diagnostic knowledge: reads knowledge (evidence: `backend/app/engine.py`)
- Diagnostic engine → Heuristic fallback: uses when unmatched (evidence: `backend/app/engine.py`)
- Diagnostic engine → Preset listing: lists presets (evidence: `backend/app/main.py`)
- HTTP API → Preset listing: requests presets (evidence: `backend/app/main.py`)
- Pattern matching → Code fix guidance: returns code fix (evidence: `backend/app/engine.py`)
- Pattern matching → Documentation references: returns references (evidence: `backend/app/engine.py`)
- Request handling → Fix display and copy: displays result (evidence: `frontend/app.js`)
- Offline matching → Fix display and copy: provides result (evidence: `frontend/app.js`)
- HTTP API → Request handling: returns result
- Fix display and copy → Developer: shows fix (evidence: `README.md`)
- Client logic → HTTP client: checks health (evidence: `frontend/app.js`)
