# bagaart/alpha architecture

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

- Interactive diagram: https://gitdiagram.com/bagaart/alpha
- Repository: https://github.com/bagaart/alpha

## Overview

This is a browser-based scanner and tag map: the page loads map metadata and scanner records, fetches the map SVG, then renders selectable scanners and live tag positions with details in a sidebar. The backend serves the frontend and HTTP data, and broadcasts simulated tag updates over WebSocket. The map asset is referenced by the backend but is absent from the supplied tree; relationships are limited to those shown in the excerpts.

Main entry points: [`frontend/js/main.js`](https://github.com/bagaart/alpha/blob/master/frontend/js/main.js) (App initializer), [`backend/main.py`](https://github.com/bagaart/alpha/blob/master/backend/main.py) (HTTP and WebSocket API), [`frontend/js/tags.js`](https://github.com/bagaart/alpha/blob/master/frontend/js/tags.js) (Live tag markers), [`frontend/js/sidebar.js`](https://github.com/bagaart/alpha/blob/master/frontend/js/sidebar.js) (Entity sidebar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend services"]
  node_backend_app["HTTP and WebSocket API<br/>[main.py]"]
  node_schemas["Data models<br/>[models.py]"]
end

subgraph group_browser["Browser application"]
  node_browser_entry["App initializer<br/>[main.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_map_view["Map loader<br/>[map.js]"]
  node_scanner_view["Scanner rendering<br/>[scanners.js]"]
  node_tag_view["Live tag markers<br/>[tags.js]"]
  node_sidebar_view["Entity sidebar<br/>[sidebar.js]"]
end

subgraph group_data["Application data"]
  node_scanner_data["Scanner catalog<br/>[scanners.json]"]
end

node_visitor(("Map user"))

node_visitor -->|"opens map"| node_browser_entry
node_browser_entry -->|"requests data"| node_api_client
node_api_client -->|"fetches endpoints"| node_backend_app
node_backend_app -->|"loads records"| node_scanner_data
node_backend_app -->|"validates data"| node_schemas
node_browser_entry -->|"loads SVG"| node_map_view
node_browser_entry -->|"renders scanners"| node_scanner_view
node_browser_entry -->|"connects updates"| node_tag_view
node_backend_app -->|"streams tag updates"| node_tag_view
node_browser_entry -->|"shows selection"| node_sidebar_view
node_scanner_view -->|"selects scanner"| node_sidebar_view
node_tag_view -->|"selects tag"| node_sidebar_view

click node_backend_app "https://github.com/bagaart/alpha/blob/master/backend/main.py"
click node_schemas "https://github.com/bagaart/alpha/blob/master/backend/models.py"
click node_scanner_data "https://github.com/bagaart/alpha/blob/master/backend/data/scanners.json"
click node_browser_entry "https://github.com/bagaart/alpha/blob/master/frontend/js/main.js"
click node_api_client "https://github.com/bagaart/alpha/blob/master/frontend/js/api.js"
click node_map_view "https://github.com/bagaart/alpha/blob/master/frontend/js/map.js"
click node_scanner_view "https://github.com/bagaart/alpha/blob/master/frontend/js/scanners.js"
click node_tag_view "https://github.com/bagaart/alpha/blob/master/frontend/js/tags.js"
click node_sidebar_view "https://github.com/bagaart/alpha/blob/master/frontend/js/sidebar.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_backend_app,node_schemas,node_visitor toneBlue
class node_browser_entry,node_api_client,node_map_view,node_scanner_view,node_tag_view,node_sidebar_view toneAmber
class node_scanner_data toneMint
```

## Components

### Backend services

- [HTTP and WebSocket API](https://github.com/bagaart/alpha/blob/master/backend/main.py): `backend/main.py`
- [Data models](https://github.com/bagaart/alpha/blob/master/backend/models.py): `backend/models.py`

### Browser application

- [App initializer](https://github.com/bagaart/alpha/blob/master/frontend/js/main.js): `frontend/js/main.js`
- [API client](https://github.com/bagaart/alpha/blob/master/frontend/js/api.js): `frontend/js/api.js`
- [Map loader](https://github.com/bagaart/alpha/blob/master/frontend/js/map.js): `frontend/js/map.js`
- [Scanner rendering](https://github.com/bagaart/alpha/blob/master/frontend/js/scanners.js): `frontend/js/scanners.js`
- [Live tag markers](https://github.com/bagaart/alpha/blob/master/frontend/js/tags.js): `frontend/js/tags.js`
- [Entity sidebar](https://github.com/bagaart/alpha/blob/master/frontend/js/sidebar.js): `frontend/js/sidebar.js`

### Application data

- [Scanner catalog](https://github.com/bagaart/alpha/blob/master/backend/data/scanners.json): `backend/data/scanners.json`

### Other components

- **Map user**

## Connections

- Map user → App initializer: opens map (evidence: `frontend/js/main.js`)
- App initializer → API client: requests data (evidence: `frontend/js/main.js`)
- API client → HTTP and WebSocket API: fetches endpoints (evidence: `frontend/js/api.js`)
- HTTP and WebSocket API → Scanner catalog: loads records (evidence: `backend/main.py`)
- HTTP and WebSocket API → Data models: validates data (evidence: `backend/main.py`)
- App initializer → Map loader: loads SVG (evidence: `frontend/js/main.js`)
- App initializer → Scanner rendering: renders scanners (evidence: `frontend/js/main.js`)
- App initializer → Live tag markers: connects updates (evidence: `frontend/js/main.js`)
- HTTP and WebSocket API → Live tag markers: streams tag updates (evidence: `backend/main.py`)
- App initializer → Entity sidebar: shows selection (evidence: `frontend/js/main.js`)
- Scanner rendering → Entity sidebar: selects scanner (evidence: `frontend/js/main.js`)
- Live tag markers → Entity sidebar: selects tag (evidence: `frontend/js/main.js`)
