# thangphan205/tacacs-ng-ui architecture

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

- Interactive diagram: https://gitdiagram.com/thangphan205/tacacs-ng-ui
- Repository: https://github.com/thangphan205/tacacs-ng-ui

## Overview

TACACS-NG-UI is a full-stack administration console for managing tac_plus-ng, its configuration, and operational security. The main workflow is an administrator editing TACACS+ entities in the web UI; the frontend calls the authenticated API, which persists changes. Configuration is then generated, reviewed or compared, and explicitly activated by a person. Separate branches cover log-based observability, alerting, anomaly scoring, high availability, and MCP access. The README documents these product capabilities; sampled source confirms the frontend/API pattern, service CRUD and audit calls, and background work, but not every subsystem’s internal wiring.

Main entry points: [`backend/app/api/routes`](https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/app/api/routes) (Entity endpoints), [`backend/scripts`](https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/scripts) (AAA log collection), [`backend/app/core/db.py`](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/core/db.py) (Application database), [`frontend/src/routes`](https://github.com/thangphan205/tacacs-ng-ui/tree/main/frontend/src/routes) (Management UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webapp["Management UI"]
  node_frontend_api["API client"]
  node_auth_hook["Authentication state<br/>[useAuth.ts]"]
end

subgraph group_api["API and data"]
  node_api_entry["API router<br/>[main.py]"]
  node_entity_routes["Entity endpoints"]
  node_tacacs_crud["Entity CRUD"]
  node_audit["Audit logging<br/>[audit_logs.py]"]
  node_database[("Application database<br/>[db.py]")]
  node_models["Domain models<br/>[models.py]"]
end

subgraph group_operations["Operations and security"]
  node_config_mgmt["Config versions<br/>[tacacs_configs.py]"]
  node_log_collection["AAA log collection"]
  node_stats["Statistics and logs"]
  node_alerts["Alert evaluation<br/>[alert_evaluator.py]"]
  node_anomaly["Anomaly scoring"]
  node_notifications["Notification dispatch"]
  node_ha["High availability<br/>[sync.py]"]
end

subgraph group_integrations["External integrations"]
  node_tacacs_daemon["tac_plus-ng daemon"]
  node_siem["SIEM destinations"]
  node_peers["Standby peers"]
  node_mcp["MCP service<br/>[server.py]"]
  node_mcp_tools["MCP tools<br/>[tools.py]"]
end

node_admin(("Administrator"))
node_mcp_client(("MCP client"))

node_admin -->|"manages entities"| node_webapp
node_webapp -->|"requests data"| node_frontend_api
node_webapp -->|"uses auth state"| node_auth_hook
node_frontend_api -->|"HTTP requests"| node_api_entry
node_api_entry -->|"dispatches routes"| node_entity_routes
node_entity_routes -->|"calls CRUD"| node_tacacs_crud
node_entity_routes -->|"records actions"| node_audit
node_tacacs_crud -->|"reads and writes"| node_database
node_entity_routes -->|"queries entities"| node_database
node_entity_routes -->|"uses schemas"| node_models
node_config_mgmt -->|"stores versions"| node_database
node_config_mgmt -->|"activates config"| node_tacacs_daemon
node_tacacs_daemon -->|"writes logs"| node_log_collection
node_log_collection -->|"feeds statistics"| node_stats
node_log_collection -->|"feeds evaluation"| node_alerts
node_alerts -->|"dispatches alerts"| node_notifications
node_notifications -.->|"forwards events"| node_siem
node_log_collection -->|"supplies behavior data"| node_anomaly
node_ha -->|"synchronizes peers"| node_peers
node_mcp_client -->|"sends requests"| node_mcp
node_mcp -->|"dispatches tools"| node_mcp_tools
node_mcp_tools -->|"reads and changes entities"| node_database

click node_webapp "https://github.com/thangphan205/tacacs-ng-ui/tree/main/frontend/src/routes"
click node_frontend_api "https://github.com/thangphan205/tacacs-ng-ui/tree/main/frontend/src/client"
click node_auth_hook "https://github.com/thangphan205/tacacs-ng-ui/blob/main/frontend/src/hooks/useAuth.ts"
click node_api_entry "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/api/main.py"
click node_entity_routes "https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/app/api/routes"
click node_tacacs_crud "https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/app/crud"
click node_audit "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/audit_logs.py"
click node_database "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/core/db.py"
click node_models "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/models.py"
click node_config_mgmt "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/api/routes/tacacs_configs.py"
click node_log_collection "https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/scripts"
click node_stats "https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/app/api/routes"
click node_alerts "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/alert_evaluator.py"
click node_anomaly "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/ml_anomaly_scorer.py"
click node_notifications "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/notification_dispatcher.py"
click node_ha "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/api/routes/sync.py"
click node_mcp "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/mcp_server/server.py"
click node_mcp_tools "https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/mcp_server/tools.py"

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_frontend_api,node_auth_hook,node_mcp_client toneBlue
class node_api_entry,node_entity_routes,node_tacacs_crud,node_audit,node_database,node_models toneAmber
class node_config_mgmt,node_log_collection,node_stats,node_alerts,node_anomaly,node_notifications,node_ha toneMint
class node_tacacs_daemon,node_siem,node_peers,node_mcp,node_mcp_tools toneRose
class node_admin toneIndigo
```

## Components

### Web interface

- [Management UI](https://github.com/thangphan205/tacacs-ng-ui/tree/main/frontend/src/routes): `frontend/src/routes`
- [API client](https://github.com/thangphan205/tacacs-ng-ui/tree/main/frontend/src/client): `frontend/src/client`
- [Authentication state](https://github.com/thangphan205/tacacs-ng-ui/blob/main/frontend/src/hooks/useAuth.ts): `frontend/src/hooks/useAuth.ts`

### API and data

- [API router](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/api/main.py): `backend/app/api/main.py`
- [Entity endpoints](https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/app/api/routes): `backend/app/api/routes`
- [Entity CRUD](https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/app/crud): `backend/app/crud`
- [Audit logging](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/audit_logs.py): `backend/app/crud/audit_logs.py`
- [Application database](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [Domain models](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/models.py): `backend/app/models.py`

### Operations and security

- [Config versions](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/api/routes/tacacs_configs.py): `backend/app/api/routes/tacacs_configs.py`
- [AAA log collection](https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/scripts): `backend/scripts`
- [Statistics and logs](https://github.com/thangphan205/tacacs-ng-ui/tree/main/backend/app/api/routes): `backend/app/api/routes`
- [Alert evaluation](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/alert_evaluator.py): `backend/app/crud/alert_evaluator.py`
- [Anomaly scoring](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/ml_anomaly_scorer.py): `backend/app/crud/ml_anomaly_scorer.py`
- [Notification dispatch](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/crud/notification_dispatcher.py): `backend/app/crud/notification_dispatcher.py`
- [High availability](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/api/routes/sync.py): `backend/app/api/routes/sync.py`

### External integrations

- **tac_plus-ng daemon**
- **SIEM destinations**
- **Standby peers**
- [MCP service](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/mcp_server/server.py): `backend/app/mcp_server/server.py`
- [MCP tools](https://github.com/thangphan205/tacacs-ng-ui/blob/main/backend/app/mcp_server/tools.py): `backend/app/mcp_server/tools.py`

### Other components

- **Administrator**
- **MCP client**

## Connections

- Administrator → Management UI: manages entities
- Management UI → API client: requests data
- Management UI → Authentication state: uses auth state
- API client → API router: HTTP requests
- API router → Entity endpoints: dispatches routes
- Entity endpoints → Entity CRUD: calls CRUD
- Entity endpoints → Audit logging: records actions
- Entity CRUD → Application database: reads and writes
- Entity endpoints → Application database: queries entities
- Entity endpoints → Domain models: uses schemas
- Config versions → Application database: stores versions
- Config versions → tac_plus-ng daemon: activates config
- tac_plus-ng daemon → AAA log collection: writes logs
- AAA log collection → Statistics and logs: feeds statistics
- AAA log collection → Alert evaluation: feeds evaluation
- Alert evaluation → Notification dispatch: dispatches alerts
- Notification dispatch → SIEM destinations: forwards events
- AAA log collection → Anomaly scoring: supplies behavior data
- High availability → Standby peers: synchronizes peers
- MCP client → MCP service: sends requests
- MCP service → MCP tools: dispatches tools
- MCP tools → Application database: reads and changes entities
