# conorg-mcc/drivvo-stats architecture

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

- Interactive diagram: https://gitdiagram.com/conorg-mcc/drivvo-stats
- Repository: https://github.com/conorg-mcc/drivvo-stats

## Overview

##### Project Type & Purpose
- This is a CLI tool for managing Drivvo vehicle data. It accepts command-line arguments for filtering based on vehicle plate and optionally saves the data into JSON files.
- Key functions include logging into the Drivvo API, fetching vehicle data, fueling entries, and servicing records.

##### Directories & Files
- /src/main.js: Acts as the entry point – it parses command-line arguments, reads the configuration (from environment variables in the .env file), and orchestrates the rest of the application.
- /src/config/config.js: Holds configuration settings (e.g., API credentials) needed for API integration.
- /src/requests: Contains separate modules for different API endpoints:
- login.js: Handles authentication.
- fuellingEntries.js, servicingEntries.js, vehicleEntries.js: Manage fetching various types of vehicle data.
- /src/utilities/util.js: Likely contains helper functions used throughout the project.
- Other top-level files (package.json, template.env, etc.) indicate Node.js package dependencies and environment variable configuration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CLI["CLI Command Input"]:::cli
    MAIN["Entry Point (main.js)"]:::internal
    CONFIG["Configuration (config.js)"]:::internal
    LOGIN["API Authentication (login.js)"]:::internal
    VEHICLE["Vehicle Data (vehicleEntries.js)"]:::internal
    FUELING["Fuelling Data (fuellingEntries.js)"]:::internal
    SERVICING["Servicing Data (servicingEntries.js)"]:::internal
    UTIL["Utilities (util.js)"]:::internal
    OUTPUT["Data Output (JSON file)"]:::internal
    API["Drivvo API"]:::external

    CLI -->|"parsesArgs"| MAIN
    MAIN -->|"loadsConfig"| CONFIG
    MAIN -->|"callsAuth"| LOGIN
    MAIN -->|"callsVehicle"| VEHICLE
    MAIN -->|"callsFuelling"| FUELING
    MAIN -->|"callsServicing"| SERVICING
    MAIN -->|"usesUtil"| UTIL
    MAIN -->|"savesDataIfFlagged"| OUTPUT

    LOGIN -->|"authenticates"| API
    VEHICLE -->|"fetchesData"| API
    FUELING -->|"fetchesData"| API
    SERVICING -->|"fetchesData"| API

    click MAIN "https://github.com/conorg-mcc/drivvo-stats/blob/main/src/main.js"
    click CONFIG "https://github.com/conorg-mcc/drivvo-stats/blob/main/src/config/config.js"
    click LOGIN "https://github.com/conorg-mcc/drivvo-stats/blob/main/src/requests/login.js"
    click VEHICLE "https://github.com/conorg-mcc/drivvo-stats/blob/main/src/requests/vehicleEntries.js"
    click FUELING "https://github.com/conorg-mcc/drivvo-stats/blob/main/src/requests/fuellingEntries.js"
    click SERVICING "https://github.com/conorg-mcc/drivvo-stats/blob/main/src/requests/servicingEntries.js"
    click UTIL "https://github.com/conorg-mcc/drivvo-stats/blob/main/src/utilities/util.js"

    classDef cli fill:#ffeb3b,stroke:#333,stroke-width:2px
    classDef internal fill:#bbdefb,stroke:#31708f,stroke-width:2px
    classDef external fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
```
