# khapaev/caliber-ads-calculator architecture

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

- Interactive diagram: https://gitdiagram.com/khapaev/caliber-ads-calculator
- Repository: https://github.com/khapaev/caliber-ads-calculator

## Overview

1. This repository is a small, browser-side calculator for Caliber ADS sensitivity. There is no backend, database, or build pipeline visible in the repo; the whole app appears to run as a static site.

2. The architecture is centered in `docs/`, which likely serves as the deployable front-end bundle:
   - `docs/index.html` provides the page structure and mounts the calculator UI.
   - `docs/styles.css` handles presentation.
   - `docs/app.js` contains the interactive logic and calculations.
   - `docs/weapons.json` is the static game-data source the calculator reads from.

3. The main domain boundary is between UI and game data. The UI lets the user pick an operator/weapon, while the JSON data defines the weapon inventory, compatible sights/modules, and other parameters needed for sensitivity math.

4. The core computation flow is client-side:
   - user selects an operative or weapon,
   - the app filters the available sights to only those compatible with that weapon,
   - the app calculates ADS sensitivity for the same `cm/360`,
   - it also calculates ADS sensitivity with FOV compensation,
   - and it outputs the final ADS FOV plus the resulting `AimSensitivityModifier` values.

5. `weapons.json` is the primary data dependency. It likely encodes the mapping between operatives, weapons, and supported modules/sights extracted from Caliber version `1.4.0.9646.13464`, so the correctness of the calculator depends on this file staying in sync with the game data.

6. `app.js` is the main orchestration layer. It likely owns:
   - loading/parsing `weapons.json`,
   - populating dropdowns or selectors,
   - reacting to user input,
   - performing all math for ADS/FOV/sensitivity,
   - rendering computed results back into the page.

7. `index.html` and `styles.css` form a simple presentation boundary. There are no signs of framework routing, server templates, or component hierarchy beyond what a small interactive page would need.

8. The app’s data flow is one-way and local: static JSON data plus user input produce computed sensitivity outputs in the browser. There is no evidence of network calls, persistence, authentication, or cross-service communication.

9. The repository is documentation-light and purpose-specific. The README confirms the calculator’s scope: it is a technical sensitivity tool for Caliber, not a general game companion or stats tracker.

10. For an architecture diagram, the key boxes are:
   - Browser/UI layer,
   - Calculation logic in `app.js`,
   - Game-data source in `weapons.json`,
   - Static hosting surface in `docs/`.

11. The important external dependency is the game’s internal data model, but it is already captured offline inside the repo. That means the system’s “integration point” is not a live API, but a curated static extraction from the game client.

12. In short: this is a self-contained static calculator where the front-end owns all interaction and computation, and the JSON file provides the authoritative compatibility/data model used by the sensitivity formulas.

Main entry points: [`docs/app.js`](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/app.js) (Calculator app), [`docs/weapons.json`](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/weapons.json) (Weapon data), [`docs/index.html`](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/index.html) (Page shell), [`docs/styles.css`](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/styles.css) (Styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["docs/ front-end"]
  node_index_html["Page shell<br/>HTML entry<br/>[index.html]"]
  node_styles_css["Styles<br/>CSS presentation<br/>[styles.css]"]
  node_app_js["Calculator app<br/>client logic<br/>[app.js]"]
  node_weapons_json[("Weapon data<br/>static catalog<br/>[weapons.json]")]
end

node_user(("User<br/>browser operator"))
node_ui_layer["UI layer<br/>browser UI"]
node_compatibility_filter["Compatibility filter<br/>data logic"]
node_ads_math["Sensitivity math<br/>calculation engine"]

node_user -->|"uses"| node_ui_layer
node_index_html -->|"hosts"| node_ui_layer
node_styles_css -->|"styles"| node_ui_layer
node_ui_layer -->|"events"| node_app_js
node_app_js -->|"loads"| node_weapons_json
node_app_js -->|"filters"| node_compatibility_filter
node_weapons_json -->|"provides data"| node_compatibility_filter
node_compatibility_filter -->|"feeds"| node_ads_math
node_app_js -->|"computes"| node_ads_math
node_ads_math -->|"renders"| node_ui_layer
node_app_js -->|"updates"| node_ui_layer

click node_index_html "https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/index.html"
click node_styles_css "https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/styles.css"
click node_app_js "https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/app.js"
click node_weapons_json "https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/weapons.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_index_html,node_styles_css,node_app_js,node_weapons_json toneBlue
class node_user,node_ui_layer,node_compatibility_filter,node_ads_math toneNeutral
```

## Components

### docs/ front-end

Static browser calculator bundle and assets

- [Page shell](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/index.html): HTML entry · Mount point and page structure for the calculator UI · `docs/index.html`
- [Styles](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/styles.css): CSS presentation · Visual styling for the static calculator page · `docs/styles.css`
- [Calculator app](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/app.js): client logic · Loads data, handles selection changes, performs ADS and FOV sensitivity calculations, and renders results · `docs/app.js`
- [Weapon data](https://github.com/khapaev/caliber-ads-calculator/blob/main/docs/weapons.json): static catalog · Authoritative weapon, operator, sight, and compatibility data used by the calculator · `docs/weapons.json`

### Other components

- **User**: browser operator · Selects weapons and views calculated ADS sensitivity outputs
- **UI layer**: browser UI · Interactive selectors and output display built from the static page and styles
- **Compatibility filter**: data logic · Restricts sights and modules to those supported by the selected weapon
- **Sensitivity math**: calculation engine · Computes same-cm/360 ADS values, FOV compensation, final ADS FOV, and AimSensitivityModifier results

## Connections

- User → UI layer: uses · Interacts with selectors and reads computed output
- Page shell → UI layer: hosts · Provides the page structure that mounts the calculator
- Styles → UI layer: styles · Defines presentation for the UI layer
- UI layer → Calculator app: events · User input is handled by the client script
- Calculator app → Weapon data: loads · Reads the static weapon catalog at runtime
- Calculator app → Compatibility filter: filters · Applies weapon-to-sight/module compatibility rules
- Weapon data → Compatibility filter: provides data · Supplies the weapon and module mapping used for filtering
- Compatibility filter → Sensitivity math: feeds · Selected weapon and sight constraints determine the sensitivity calculation inputs
- Calculator app → Sensitivity math: computes · Runs the ADS and FOV compensation formulas in the browser
- Sensitivity math → UI layer: renders · Outputs ADS FOV and AimSensitivityModifier values back to the page
- Calculator app → UI layer: updates · Refreshes the visible results after each selection change
