# petamorikei/demolisher-tracker architecture

> Architecture diagram of the GitHub repository petamorikei/demolisher-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/petamorikei/demolisher-tracker
- Repository: https://github.com/petamorikei/demolisher-tracker

## Overview

##### Project Type and Purpose
- This project is a desktop application built with Electron and React (using TypeScript) to track “demolisher” data in real time for the game Warframe.
- Its main function is to parse the Warframe log file (EE.log) from the local game directory and display live information by analyzing mission and demolisher events.

##### Analyzing the File Structure
- Top-Level Structure:
– Files like .eslintrc.json, .prettierrc, tsconfig.json, and package.json indicate a TypeScript/JavaScript project with code quality/configuration settings.
– The presence of a dedicated electron directory (containing main.ts and preload.ts) shows separation between the Electron main process and renderer process.
– The public folder houses static assets, including the main index.html, images, manifest, and robots.txt.
– The src directory contains the React code (App.tsx, index.tsx) along with domain-specific modules (Demolisher, Mission, Faction, etc.), utility functions (logParser.ts, regex.ts, calculator.ts), and UI components (under src/components).
– Typings and configuration files help enforce type safety and interfacing (e.g., myAPI.d.ts).

##### Key Architectural Areas
a. Main Components:
– Electron Main Process: Represented by files like electron/main.ts; this handles creating the application window, system-level integration, and potentially initiating the log reading.
– Preload Script: (electron/preload.ts) which securely bridges the gap between the Node.js backend and the renderer process.
– Renderer Process/React Interface: Represented by the src folder with App.tsx, index.tsx, and various components (such as DemolisherTable, MissionModeSelect, etc.). This is where UI and log data visualization happen.
– Log Parser and Domain Logic: Files like logParser.ts, Demolisher.ts, Mission.ts, and supporting modules handle the parsing of the Warframe log file and processing the game-related data.
– Static Assets & Configuration: The public folder (with index.html and images) and config files contribute to the overall application environment.

b. Relationships & Data Flow:
– The Electron Main Process initializes the application and loads the index.html (from public) into the window.
– The Preload Script exposes necessary APIs to the React renderer while enforcing security boundaries.
– The React application (UI) uses exposed APIs to access local system functions (like reading the log file from %LOCALAPPDATA%\Warframe\EE.log).
– Once the log file is read, it’s sent to the parser modules (logParser.ts, calculator.ts, etc.) which process real-time data.
– Processed data is then relayed to various React components (e.g., DemolisherTable, MissionNameSelect) to update the UI in real time.
– The overall design emphasizes separation of concerns between data acquisition, processing, and visualization.

c. Architectural Patterns and Design Principles:
– Separation between Electron’s main process and renderer process ensures a clear security model and modularity.
– The layer of domain logic (via log parsing and game event records) is separated from the UI, following a modular design.
– The use of TypeScript and clear directory structuring indicates strong emphasis on maintainability and scalability.
– Components appear to be designed following a modular and reusable approach (note the dedicated components for settings, mission mode, and data tables).

d. Relevant Technologies and Frameworks:
– Electron for building a desktop app.
– React for the user interface.
– TypeScript for static type checking.
– Possibly Node.js APIs (through preload) for file system access.
– CSS and possibly design systems defined in src/components/Styles.ts.

##### Final Advice for the Principal Software Engineer
- That every major part of the file tree (electron, src, public) is represented.
- Be detailed in showing how the log file is incorporated into the system: from being read via Electron’s Node APIs to its processing in the domain logic and finally its presentation in the React UI.
- Don’t hesitate to split components further if necessary – for example, detailing individual React components (like DemolisherTable or MissionModeSelect) when their roles are crucial to the overall functionality.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Static Assets & Config
    Assets["Static Assets & Config (public)"]:::asset

    %% Electron Backend
    EMP["Electron Main Process"]:::electron
    PS["Preload Script"]:::preload

    %% Renderer Process (React)
    subgraph "Renderer Process (React)"
        ReactIndex["React Entry (index.tsx)"]:::react
        ReactApp["React App (App.tsx)"]:::react
        UIComps["UI Components"]:::ui
    end

    %% Log File and Processing Pipeline
    LogFile["Log File Reader (EE.log)"]:::external
    LP["Log Parser Module"]:::parser
    subgraph "Domain Logic Modules"
        Demolisher["Demolisher"]:::domain
        Mission["Mission"]:::domain
        Faction["Faction"]:::domain
        Calculator["Calculator"]:::domain
        Regex["Regex"]:::domain
    end

    %% Data Flow Relationships
    Assets -- "loads" --> EMP
    EMP -- "initializes" --> PS
    PS -- "exposesAPIs" --> ReactIndex
    PS -- "exposesAPIs" --> ReactApp
    ReactApp -- "requestsLog" --> LogFile
    LogFile -- "sendsLogData" --> LP
    LP -- "parses" --> Demolisher
    LP -- "parses" --> Mission
    LP -- "parses" --> Faction
    LP -- "parses" --> Calculator
    LP -- "parses" --> Regex
    Demolisher -- "UIUpdate" --> UIComps
    Mission -- "UIUpdate" --> UIComps
    Faction -- "UIUpdate" --> UIComps
    Calculator -- "UIUpdate" --> UIComps
    Regex -- "UIUpdate" --> UIComps

    %% Click Events
    click EMP "https://github.com/petamorikei/demolisher-tracker/blob/main/electron/main.ts"
    click PS "https://github.com/petamorikei/demolisher-tracker/blob/main/electron/preload.ts"
    click ReactIndex "https://github.com/petamorikei/demolisher-tracker/blob/main/src/index.tsx"
    click ReactApp "https://github.com/petamorikei/demolisher-tracker/blob/main/src/App.tsx"
    click LP "https://github.com/petamorikei/demolisher-tracker/blob/main/src/logParser.ts"
    click Demolisher "https://github.com/petamorikei/demolisher-tracker/blob/main/src/Demolisher.ts"
    click Mission "https://github.com/petamorikei/demolisher-tracker/blob/main/src/Mission.ts"
    click Faction "https://github.com/petamorikei/demolisher-tracker/blob/main/src/Faction.ts"
    click Calculator "https://github.com/petamorikei/demolisher-tracker/blob/main/src/calculator.ts"
    click Regex "https://github.com/petamorikei/demolisher-tracker/blob/main/src/regex.ts"
    click UIComps "https://github.com/petamorikei/demolisher-tracker/tree/main/src/components"
    click Assets "https://github.com/petamorikei/demolisher-tracker/tree/main/public"

    %% Styles
    classDef electron fill:#f9c,stroke:#333,stroke-width:2px;
    classDef preload fill:#ccf,stroke:#333,stroke-width:2px;
    classDef react fill:#cfc,stroke:#333,stroke-width:2px;
    classDef parser fill:#fc9,stroke:#333,stroke-width:2px;
    classDef domain fill:#f9f,stroke:#333,stroke-width:2px;
    classDef ui fill:#cff,stroke:#333,stroke-width:2px;
    classDef asset fill:#ffc,stroke:#333,stroke-width:2px;
    classDef external fill:#eee,stroke:#333,stroke-width:2px;
```
