# iurreta/databaseeditor architecture

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

- Interactive diagram: https://gitdiagram.com/iurreta/databaseeditor
- Repository: https://github.com/iurreta/databaseeditor

## Overview

##### Main Components
- Frontend:
- Located under src/js/frontend and src/index.html.
- Components such as calendar.js, config.js, renderer.js, teams.js, and others provide the user interface and handle client-side interactions.
- Assets (assets/ directory) contribute to styling (fonts, images) and overall visual consistency.
- Backend:
- Found in src/js/backend, which includes various modules for save file handling.
- The UESaveTool subdirectory (with files such as Gvas.js, Serializer.js, properties/, arrays/) encapsulates the save file parsing and serialization logic.
- Other core backend modules include command.js, dbManager.js, worker.js, and scriptUtils for functions like calendarUtils, carAnalysisUtils, and transferUtils.
- Data:
- The src/data folder holds JSON files that could represent configuration or mapping data (e.g., contracts.json, 2025_changes.json, members.json).
- Build & Deployment:
- Configuration files like package.json, webpack.config.js, vercel.json indicate that the project uses Node’s package manager, webpack bundling, and deployment via Vercel.

##### Relationships and Interactions
- The Frontend communicates with the Backend:
- User actions in the UI (triggered via renderer.js or teams.js) call backend functions to process save file data.
- Data flow is likely established via direct function calls or even asynchronous communication using the worker (src/js/backend/worker.js).
- Backend Processing:
- The UESaveTool modules parse and modify save files. They also handle data validation/error checking (as suggested by PropertyErrors.js) and convert between different representations (using serializers, arrays, and property modules).
- Script utilities act as helpers for business logic such as calendar adjustments, contract editing, and transfer utilities.
- Data Management:
- Store/Update operations on the game’s save files are encapsulated by modules like dbManager.js.
- Static JSON data in the src/data directory might be used for default configurations or mapping data within the application.

##### Architectural Patterns and Design Principles
- Modular Structure:
- The clear segregation into frontend and backend directories illustrates a modular design. Each module has a defined responsibility.
- Separation of Concerns:
- UI components are separated from data handling and business logic. The pattern resembles MVC or similar layered architectures.
- Use of Build Tools and Configuration Management:
- The presence of webpack and vercel configuration suggests a focus on automated builds and streamlined deployment.
- Reusability and Extensibility:
- The UESaveTool’s structure with factories, arrays, and properties directories implies that adding support for new save file elements or customizations is straightforward.

##### Relevant Technologies and Frameworks
- JavaScript is the primary language for both frontend and backend logic.
- Webpack is used for bundling.
- Deployment is managed via Vercel (as seen in vercel.json).
- The project may rely on Node.js for dependency management (as indicated by package.json).

##### Specific Elements
- Clear Labels:
- Grouping Nodes:
- Cluster related modules together (e.g., group all UESaveTool components with a boundary that indicates “Save File Processing”).
- Supplementary Information:
- Annotations for any integration points (such as the auto-update mechanism mentioned in the README that takes advantage of being web-hosted).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        A["Index.html"]:::frontend
        B["Frontend Modules"]:::frontend
        C["Assets"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        D["Backend Modules"]:::backend
        E["Save File Parsing (UESaveTool)"]:::backend
    end

    %% Data & Deployment
    subgraph "Data & Deployment"
        F["Data Store"]:::data
        subgraph "Build & Deployment"
            G["package.json"]:::build
            H["webpack.config.js"]:::build
            I["vercel.json"]:::build
        end
    end

    %% Connections
    A -->|"triggers"| B
    B -->|"loads"| C
    B -->|"API_call"| D
    D -->|"calls"| E
    D -->|"read/write"| F

    %% Click Events
    click A "https://github.com/iurreta/databaseeditor/blob/release/src/index.html"
    click B "https://github.com/iurreta/databaseeditor/tree/release/src/js/frontend"
    click C "https://github.com/iurreta/databaseeditor/tree/release/assets/"
    click D "https://github.com/iurreta/databaseeditor/tree/release/src/js/backend"
    click E "https://github.com/iurreta/databaseeditor/tree/release/src/js/backend/UESaveTool"
    click F "https://github.com/iurreta/databaseeditor/tree/release/src/data"
    click G "https://github.com/iurreta/databaseeditor/blob/release/package.json"
    click H "https://github.com/iurreta/databaseeditor/blob/release/webpack.config.js"
    click I "https://github.com/iurreta/databaseeditor/blob/release/vercel.json"

    %% Styles
    classDef frontend fill:#b3d9ff,stroke:#4d79ff,stroke-width:2px;
    classDef backend fill:#ffcc99,stroke:#ff9900,stroke-width:2px;
    classDef data fill:#ccffcc,stroke:#66cc66,stroke-width:2px;
    classDef build fill:#ffcccc,stroke:#ff6666,stroke-width:2px;
```
