# mohsenmehri/fam architecture

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

- Interactive diagram: https://gitdiagram.com/mohsenmehri/fam
- Repository: https://github.com/mohsenmehri/fam

## Overview

This repository contains two user-facing products: FAM, a workbook and equipment-management service, and Protocol Explorer, a browser-based network-protocol learning tool. In FAM, users work through the central service for validated, permission-aware state operations; equipment tasks additionally use bounded SSH probing and diagnostic evidence. Protocol Explorer assembles protocol lessons and translations into interactive network scenes. The graph preserves documented/source-index relationships; several FAM modules and the protocol UI were not excerpted, so uncertain runtime links are omitted.

Main entry points: [`FAM-Linux-Lab/server/app.py`](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/app.py) (Central Service), [`protocol-explorer/js/app.js`](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/app.js) (Explorer UI), [`FAM-Linux-Lab/server/equipment_ops.py`](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_ops.py) (Equipment API), [`protocol-explorer/js/data-catalog.js`](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data-catalog.js) (Protocol Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fam["FAM Service"]
  node_service["Central Service<br/>[app.py]"]
  node_policy["Account Policy<br/>[account_policy.py]"]
  node_admin["Backup Restore<br/>[manage.py]"]
  node_state[("FAM State<br/>[fam.sqlite3]")]
  node_candidate["Candidate Service Snapshot<br/>[app.candidate.py]"]
end

subgraph group_equipment["Equipment Operations"]
  node_inventory["Equipment Inventory"]
  node_operations["Equipment API<br/>[equipment_ops.py]"]
  node_probe["SSH Probe<br/>[equipment_probe.py]"]
  node_guard["Operation Guard<br/>[equipment_guard.py]"]
  node_diagnostics["Port Diagnostics"]
  node_groups["Equipment Groups<br/>[equipment_group.py]"]
  node_replacement["Equipment Replacement"]
end

subgraph group_protocoldata["Protocol Content"]
  node_datafacade["Data Facade<br/>[data.js]"]
  node_catalog["Protocol Catalog<br/>[data-catalog.js]"]
  node_coredata["Core Lessons<br/>[data-core.js]"]
  node_moredata["Additional Lessons<br/>[data-more.js]"]
end

subgraph group_protocolexplorer["Protocol Explorer"]
  node_ui["Explorer UI<br/>[app.js]"]
  node_scene["Scene Renderer<br/>[scene.js]"]
  node_translations["Translations<br/>[i18n.js]"]
end

node_famuser(("FAM User"))
node_exploreruser(("Explorer User"))

node_famuser -.->|"uses"| node_service
node_service -->|"checks policy"| node_policy
node_service -->|"delegates administration"| node_admin
node_service -->|"uses inventory"| node_inventory
node_service -->|"routes operations"| node_operations
node_admin -->|"checks managers"| node_policy
node_service -.->|"persists state"| node_state
node_operations -->|"runs probe"| node_probe
node_operations -->|"checks operations"| node_guard
node_probe -->|"uses diagnostics"| node_diagnostics
node_groups -->|"uses evidence"| node_diagnostics
node_groups -->|"uses replacement"| node_replacement
node_replacement -->|"uses evidence"| node_diagnostics
node_exploreruser -.->|"explores"| node_ui
node_ui -->|"loads data"| node_datafacade
node_ui -->|"renders scenes"| node_scene
node_ui -->|"loads language"| node_translations
node_datafacade -->|"exports catalog"| node_catalog
node_catalog -->|"imports lessons"| node_coredata
node_catalog -->|"imports lessons"| node_moredata

click node_service "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/app.py"
click node_policy "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/account_policy.py"
click node_admin "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/manage.py"
click node_state "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/data/fam.sqlite3"
click node_inventory "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_inventory.py"
click node_operations "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_ops.py"
click node_probe "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_probe.py"
click node_guard "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_guard.py"
click node_diagnostics "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_diagnostics.py"
click node_groups "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_group.py"
click node_replacement "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_replacement.py"
click node_candidate "https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/data/fam-auth-fix-1hdngowc/app.candidate.py"
click node_ui "https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/app.js"
click node_scene "https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/scene.js"
click node_translations "https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/i18n.js"
click node_datafacade "https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data.js"
click node_catalog "https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data-catalog.js"
click node_coredata "https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data-core.js"
click node_moredata "https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data-more.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_service,node_policy,node_admin,node_state,node_candidate,node_famuser,node_exploreruser toneBlue
class node_inventory,node_operations,node_probe,node_guard,node_diagnostics,node_groups,node_replacement toneAmber
class node_datafacade,node_catalog,node_coredata,node_moredata toneMint
class node_ui,node_scene,node_translations toneRose
```

## Components

### FAM Service

- [Central Service](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/app.py): `FAM-Linux-Lab/server/app.py`
- [Account Policy](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/account_policy.py): `FAM-Linux-Lab/server/account_policy.py`
- [Backup Restore](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/manage.py): `FAM-Linux-Lab/server/manage.py`
- [FAM State](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/data/fam.sqlite3): `FAM-Linux-Lab/data/fam.sqlite3`
- [Candidate Service Snapshot](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/data/fam-auth-fix-1hdngowc/app.candidate.py): `FAM-Linux-Lab/data/fam-auth-fix-1hdngowc/app.candidate.py`

### Equipment Operations

- [Equipment Inventory](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_inventory.py): `FAM-Linux-Lab/server/equipment_inventory.py`
- [Equipment API](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_ops.py): `FAM-Linux-Lab/server/equipment_ops.py`
- [SSH Probe](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_probe.py): `FAM-Linux-Lab/server/equipment_probe.py`
- [Operation Guard](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_guard.py): `FAM-Linux-Lab/server/equipment_guard.py`
- [Port Diagnostics](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_diagnostics.py): `FAM-Linux-Lab/server/equipment_diagnostics.py`
- [Equipment Groups](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_group.py): `FAM-Linux-Lab/server/equipment_group.py`
- [Equipment Replacement](https://github.com/mohsenmehri/fam/blob/main/FAM-Linux-Lab/server/equipment_replacement.py): `FAM-Linux-Lab/server/equipment_replacement.py`

### Protocol Content

- [Data Facade](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data.js): `protocol-explorer/js/data.js`
- [Protocol Catalog](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data-catalog.js): `protocol-explorer/js/data-catalog.js`
- [Core Lessons](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data-core.js): `protocol-explorer/js/data-core.js`
- [Additional Lessons](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/data-more.js): `protocol-explorer/js/data-more.js`

### Protocol Explorer

- [Explorer UI](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/app.js): `protocol-explorer/js/app.js`
- [Scene Renderer](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/scene.js): `protocol-explorer/js/scene.js`
- [Translations](https://github.com/mohsenmehri/fam/blob/main/protocol-explorer/js/i18n.js): `protocol-explorer/js/i18n.js`

### Other components

- **FAM User**
- **Explorer User**

## Connections

- FAM User → Central Service: uses
- Central Service → Account Policy: checks policy (evidence: `FAM-Linux-Lab/server/app.py`)
- Central Service → Backup Restore: delegates administration (evidence: `FAM-Linux-Lab/server/app.py`)
- Central Service → Equipment Inventory: uses inventory (evidence: `FAM-Linux-Lab/server/app.py`)
- Central Service → Equipment API: routes operations (evidence: `FAM-Linux-Lab/server/app.py`)
- Backup Restore → Account Policy: checks managers (evidence: `FAM-Linux-Lab/server/manage.py`)
- Central Service → FAM State: persists state
- Equipment API → SSH Probe: runs probe (evidence: `FAM-Linux-Lab/server/equipment_ops.py`)
- Equipment API → Operation Guard: checks operations (evidence: `FAM-Linux-Lab/server/equipment_ops.py`)
- SSH Probe → Port Diagnostics: uses diagnostics (evidence: `FAM-Linux-Lab/server/equipment_probe.py`)
- Equipment Groups → Port Diagnostics: uses evidence (evidence: `FAM-Linux-Lab/server/equipment_group.py`)
- Equipment Groups → Equipment Replacement: uses replacement (evidence: `FAM-Linux-Lab/server/equipment_group.py`)
- Equipment Replacement → Port Diagnostics: uses evidence (evidence: `FAM-Linux-Lab/server/equipment_replacement.py`)
- Explorer User → Explorer UI: explores
- Explorer UI → Data Facade: loads data (evidence: `protocol-explorer/js/app.js`)
- Explorer UI → Scene Renderer: renders scenes (evidence: `protocol-explorer/js/app.js`)
- Explorer UI → Translations: loads language (evidence: `protocol-explorer/js/app.js`)
- Data Facade → Protocol Catalog: exports catalog (evidence: `protocol-explorer/js/data.js`)
- Protocol Catalog → Core Lessons: imports lessons (evidence: `protocol-explorer/js/data-catalog.js`)
- Protocol Catalog → Additional Lessons: imports lessons (evidence: `protocol-explorer/js/data-catalog.js`)
