# bhavesh2105/greythr-automation architecture

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

- Interactive diagram: https://gitdiagram.com/bhavesh2105/greythr-automation
- Repository: https://github.com/bhavesh2105/greythr-automation

## Overview

##### Project type and purpose
- This is a Node.js–based CLI automation tool (“GreytHR-automation”) whose sole responsibility is to sign you into and out of the greytHR system on a schedule (9 AM sign-in, 7 PM sign-out), with overrides for “late” or manual sign-in/sign-out.
- It’s not a web app or microservice ecosystem—just a single process that runs under Node.js, reads/stores credentials, schedules tasks, and makes HTTP requests to the external greytHR service.

##### File structure
- Top‐level files only:
· index.js – the entry point.
· package.json / package-lock.json – dependency and script definitions.
· README.md – usage instructions.
· .gitignore – excludes node_modules, credentials, etc.
- No frontend/backend split, no subdirectories, no database server—this is a self-contained CLI utility.

##### README for additional insights
- Dependencies: Node.js runtime + installed NPM modules (likely commander/yargs for CLI parsing, node-cron or similar for scheduling, and axios/fetch for HTTP).
- Behavior:
· On first run, user supplies `--user` and `--password` → credentials persist locally (probably in a file like `.credentials`).
· Subsequent runs, the scheduler automatically signs in/out.
· `--late` flag toggles override behavior.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Internal Modules"
        CLI["CLI Parser Module"]:::internal
        Engine["Node.js Engine"]:::internal
        Scheduler["Scheduler Module"]:::internal
        Service["Automation Service"]:::internal
        HTTPClient["HTTP Client"]:::internal
        Store["Credential Store"]:::store
    end

    CLI -->|parses flags| Engine
    CLI -->|manual override| Service
    Engine -->|reads/writes| Store
    Scheduler -->|triggers| Service
    Service -->|calls| HTTPClient
    HTTPClient -->|HTTP requests| greytHR["greytHR System"]:::external

    CLI -->|initial credentials| Store

    subgraph "Project Files"
        packageJSON["package.json"]:::docs
        README["README.md"]:::docs
    end

    Engine --> packageJSON
    Engine --> README

    click CLI "https://github.com/bhavesh2105/greythr-automation/blob/master/index.js"
    click Engine "https://github.com/bhavesh2105/greythr-automation/blob/master/index.js"
    click Scheduler "https://github.com/bhavesh2105/greythr-automation/blob/master/index.js"
    click Service "https://github.com/bhavesh2105/greythr-automation/blob/master/index.js"
    click HTTPClient "https://github.com/bhavesh2105/greythr-automation/blob/master/index.js"
    click Store "https://github.com/bhavesh2105/greythr-automation/blob/master/index.js"
    click packageJSON "https://github.com/bhavesh2105/greythr-automation/blob/master/package.json"
    click README "https://github.com/bhavesh2105/greythr-automation/blob/master/README.md"

    classDef internal fill:#AEDFF7,stroke:#333,stroke-width:1px
    classDef external fill:#F9D7AA,stroke:#333,stroke-width:1px
    classDef store fill:#C2F7AE,stroke:#333,stroke-width:1px
    classDef docs fill:#E2E2E2,stroke:#333,stroke-width:1px
```
