# kheemwel/odds-finder architecture

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

- Interactive diagram: https://gitdiagram.com/kheemwel/odds-finder
- Repository: https://github.com/kheemwel/odds-finder

## Overview

1. **Project shape**
   - This is a **single-page, client-side probability calculator** called *Odds Finder*.
   - There is **no backend or API layer** in the repo; all calculations happen in the browser.

2. **App shell and startup**
   - `index.html` is the Vite entry document.
   - `src/index.tsx` is the client bootstrap that mounts the app.
   - `src/App.tsx` is the top-level UI composition point for the calculator experience.

3. **UI / presentation boundary**
   - The UI appears to be centered around:
     - a **win-rate control** (slider and numeric input, per README),
     - **live calculated outputs** for several confidence thresholds,
     - responsive styling for desktop and mobile.
   - The app component likely wires user input directly to the calculator state layer rather than doing math inline.

4. **Calculator domain logic**
   - `src/calculator/calculator.ts` is the core **pure computation module**.
   - This is where the probability math should live: given a win rate, compute attempts needed to reach thresholds like **30%, 50%, 90%, and 99%** confidence.
   - This module is the main domain boundary and should be diagrammed separately from the UI.

5. **State management**
   - `src/calculator/calculator.store.ts` is a dedicated **state/store layer**.
   - It likely holds the selected win rate and exposes derived calculator results to the UI.
   - This layer sits between the form controls and the pure math functions, keeping UI logic thin and making updates real-time.

6. **Data flow**
   - The expected flow is:
     - user changes win rate in the UI,
     - the store updates,
     - calculator functions recompute required attempts,
     - `App.tsx` re-renders the displayed thresholds.
   - This is a **one-way reactive flow** from input to state to derived output.

7. **Testing boundaries**
   - `src/calculator/calculator.test.ts` validates the **math logic**.
   - `src/calculator/calculator.store.test.ts` validates the **state/store behavior**.
   - The presence of separate tests for logic and store indicates a clear split between deterministic computation and reactive wiring.

8. **Styling and layout**
   - `src/index.css` provides global styling.
   - The README says the UI uses **TailwindCSS + DaisyUI**, so styling is likely utility-driven with component-level theme classes.
   - This affects architecture mainly at the presentation layer; it does not introduce a separate runtime subsystem.

9. **Build/runtime toolchain**
   - The project uses **Vite** as the build/dev server tool.
   - `package-lock.json`, `package.json`, `tsconfig.json`, and `vite.config.ts` indicate a standard TypeScript front-end toolchain.
   - Vite is the only build-time infrastructure that materially affects runtime delivery.

10. **PWA and static assets**
   - The README states **Vite PWA Plugin** support.
   - `public/` likely contains static assets used for installability/offline support, such as icons or manifest-related files.
   - In architecture diagrams, treat PWA support as an **edge capability** around the app shell rather than a separate subsystem.

11. **Important architectural takeaway**
   - The repo is organized around a **small, testable calculation core** surrounded by a thin reactive UI shell.
   - The strongest boundary is between:
     - **presentation/state** in `App.tsx` and `calculator.store.ts`,
     - **pure domain math** in `calculator.ts`.
   - That separation is the key to understanding and diagramming the system accurately.

12. **Note on framework description**
   - The README describes the app as **SolidJS-based**, and the source is structured as TSX components in a Vite app.
   - For diagramming, the exact component model is less important than the overall structure: **browser-only app, reactive UI, pure calculator domain, testable store layer, and PWA packaging**.

Main entry points: [`src/App.tsx`](https://github.com/kheemwel/odds-finder/blob/main/src/App.tsx) (App), [`package.json`](https://github.com/kheemwel/odds-finder/blob/main/package.json) (Package Manifest), [`vite.config.ts`](https://github.com/kheemwel/odds-finder/blob/main/vite.config.ts) (Vite Config), [`src/index.tsx`](https://github.com/kheemwel/odds-finder/blob/main/src/index.tsx) (Bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Browser App"]
  node_index_html["index.html<br/>entry document<br/>[index.html]"]
  node_src_index_tsx["Bootstrap<br/>client entry<br/>[index.tsx]"]
  node_src_app_tsx["App<br/>ui shell<br/>[App.tsx]"]
  node_src_index_css["Global CSS<br/>styles<br/>[index.css]"]
  node_public_assets["Public Assets<br/>static assets"]
end

subgraph group_domain["Calculator Domain"]
  node_calculator_store["Calculator Store<br/>reactive store"]
  node_calculator_core["Calculator<br/>pure math<br/>[calculator.ts]"]
  node_store_test["Store Test"]
  node_calc_test["Math Test<br/>logic tests<br/>[calculator.test.ts]"]
end

subgraph group_tooling["Tooling & Build"]
  node_vite_config["Vite Config<br/>build config<br/>[vite.config.ts]"]
  node_package_json["Package Manifest<br/>dependencies<br/>[package.json]"]
  node_package_lock["Lockfile<br/>dependency lock<br/>[package-lock.json]"]
  node_tsconfig["TS Config<br/>compiler config<br/>[tsconfig.json]"]
  node_readme["README<br/>project docs<br/>[README.md]"]
end

node_index_html -->|"loads"| node_src_index_tsx
node_src_index_tsx -->|"mounts"| node_src_app_tsx
node_src_app_tsx -->|"reads/writes"| node_calculator_store
node_calculator_store -->|"derives"| node_calculator_core
node_src_app_tsx -->|"styles"| node_src_index_css
node_src_app_tsx -.->|"uses"| node_public_assets
node_store_test -.->|"verifies"| node_calculator_store
node_calc_test -.->|"verifies"| node_calculator_core
node_vite_config -->|"serves"| node_index_html
node_vite_config -->|"bundles"| node_src_index_tsx
node_package_json -->|"configures"| node_vite_config
node_package_json -.->|"depends on"| node_tsconfig
node_package_json -.->|"pins"| node_package_lock
node_readme -.->|"describes"| node_src_app_tsx
node_readme -.->|"describes"| node_calculator_core

click node_index_html "https://github.com/kheemwel/odds-finder/blob/main/index.html"
click node_src_index_tsx "https://github.com/kheemwel/odds-finder/blob/main/src/index.tsx"
click node_src_app_tsx "https://github.com/kheemwel/odds-finder/blob/main/src/App.tsx"
click node_src_index_css "https://github.com/kheemwel/odds-finder/blob/main/src/index.css"
click node_public_assets "https://github.com/kheemwel/odds-finder/tree/main/public"
click node_calculator_store "https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.store.ts"
click node_calculator_core "https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.ts"
click node_store_test "https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.store.test.ts"
click node_calc_test "https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.test.ts"
click node_vite_config "https://github.com/kheemwel/odds-finder/blob/main/vite.config.ts"
click node_package_json "https://github.com/kheemwel/odds-finder/blob/main/package.json"
click node_package_lock "https://github.com/kheemwel/odds-finder/blob/main/package-lock.json"
click node_tsconfig "https://github.com/kheemwel/odds-finder/blob/main/tsconfig.json"
click node_readme "https://github.com/kheemwel/odds-finder/blob/main/README.md"

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_src_index_tsx,node_src_app_tsx,node_src_index_css,node_public_assets toneBlue
class node_calculator_store,node_calculator_core,node_store_test,node_calc_test toneAmber
class node_vite_config,node_package_json,node_package_lock,node_tsconfig,node_readme toneMint
```

## Components

### Browser App

Client-side runtime, UI shell, and presentation assets.

- [index.html](https://github.com/kheemwel/odds-finder/blob/main/index.html): entry document · Vite entry document for the single-page app. · `index.html`
- [Bootstrap](https://github.com/kheemwel/odds-finder/blob/main/src/index.tsx): client entry · Mounts the app into the browser DOM. · `src/index.tsx`
- [App](https://github.com/kheemwel/odds-finder/blob/main/src/App.tsx): ui shell · Top-level calculator composition and reactive UI wiring. · `src/App.tsx`
- [Global CSS](https://github.com/kheemwel/odds-finder/blob/main/src/index.css): styles · Base styling and layout rules for the app. · `src/index.css`
- [Public Assets](https://github.com/kheemwel/odds-finder/tree/main/public): static assets · Static files for installability and browser delivery. · `public`

### Calculator Domain

Pure probability logic and reactive state store.

- [Calculator Store](https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.store.ts): reactive store · Holds win rate state and derived calculator outputs. · `src/calculator/calculator.store.ts`
- [Calculator](https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.ts): pure math · Computes attempts needed for confidence thresholds from win rate. · `src/calculator/calculator.ts`
- [Store Test](https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.store.test.ts): store tests · Validates store updates and reactive behavior. · `src/calculator/calculator.store.test.ts`
- [Math Test](https://github.com/kheemwel/odds-finder/blob/main/src/calculator/calculator.test.ts): logic tests · Validates probability calculations and threshold results. · `src/calculator/calculator.test.ts`

### Tooling & Build

Vite-based development, packaging, and static deployment support.

- [Vite Config](https://github.com/kheemwel/odds-finder/blob/main/vite.config.ts): build config · Build and dev-server configuration, including plugin wiring. · `vite.config.ts`
- [Package Manifest](https://github.com/kheemwel/odds-finder/blob/main/package.json): dependencies · Project scripts and runtime/build dependency declarations. · `package.json`
- [Lockfile](https://github.com/kheemwel/odds-finder/blob/main/package-lock.json): dependency lock · Resolved dependency versions for reproducible installs. · `package-lock.json`
- [TS Config](https://github.com/kheemwel/odds-finder/blob/main/tsconfig.json): compiler config · TypeScript compiler settings for the project. · `tsconfig.json`
- [README](https://github.com/kheemwel/odds-finder/blob/main/README.md): project docs · Describes the app, UI behavior, and stack choices. · `README.md`

## Connections

- index.html → Bootstrap: loads · The entry document loads the client bootstrap.
- Bootstrap → App: mounts · Bootstrap mounts the top-level app component.
- App → Calculator Store: reads/writes · UI state flows through the calculator store.
- Calculator Store → Calculator: derives · Store uses pure math to produce threshold outputs.
- App → Global CSS: styles · App presentation is shaped by global styles.
- App → Public Assets: uses · The app shell can consume static public assets.
- Store Test → Calculator Store: verifies · Tests the store layer behavior.
- Math Test → Calculator: verifies · Tests the core probability calculations.
- Vite Config → index.html: serves · Vite uses the entry document during development and build.
- Vite Config → Bootstrap: bundles · Vite compiles the client entry and its imports.
- Package Manifest → Vite Config: configures · Project scripts and dependencies drive the Vite setup.
- Package Manifest → TS Config: depends on · TypeScript settings support the application build.
- Package Manifest → Lockfile: pins · Lockfile fixes dependency resolution for installs.
- README → App: describes · Documentation explains the browser calculator experience.
- README → Calculator: describes · Documentation outlines the core win-rate math.
