# lengo0951/cryptopricebot architecture

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

- Interactive diagram: https://gitdiagram.com/lengo0951/cryptopricebot
- Repository: https://github.com/lengo0951/cryptopricebot

## Overview

##### Project type and purpose
- From the file tree and README (“CryptoPriceBot”), this is a small full-stack Node.js application.
- It fetches cryptocurrency prices from an external API, computes technical indicators, and presents the data in a browser.

##### File structure
- Top‐level files:
- .env – secrets/config for API keys
- Procfile – “web: node index.js” for Heroku deployment
- package.json / package-lock.json – Node.js dependencies and scripts
- dataFetcher.js – module handling external API calls
- indicatiors.js – module calculating crypto indicators (e.g., moving averages)
- index.js – entry point, an Express (or http) server that ties everything together
- index.html – simple front-end UI, served as a static asset
- No separate “frontend”/“backend” directories, but functionally it splits into:
- Server (index.js + dataFetcher.js + indicatiors.js)
- Client (index.html + browser JS loaded by it)

##### README for additional insights
- README is minimal (“# CryptoPriceBot”) – no further architecture notes.

##### Elements
- Clear labels: “Browser (UI)”, “Node.js Server (index.js)”, “DataFetcher module”, “Indicators module”, “External Crypto API”, “Config (.env)”, “Heroku (Procfile)”.
- Browser → Server (HTTP requests)
- Server → External API (data fetch)
- Server → Indicators module (function call)
- Server → Browser (JSON response)
- One for server modules
- One for external services and deployment environment

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        BrowserUI["Browser UI\n(index.html)"]:::client
    end

    %% Server Layer
    subgraph "Server Layer"
        ServerApp["Node.js Server\n(index.js)"]:::server
        DataFetcher["DataFetcher Module\n(dataFetcher.js)"]:::module
        Indicators["Indicators Module\n(indicatiors.js)"]:::module
        Config["Config Store\n(.env)"]:::config
    end

    %% External Services
    subgraph "External Services"
        ExternalAPI["External Crypto API"]:::external
    end

    %% Deployment & Documentation
    subgraph "Deployment & Docs"
        ProcfileNode["Procfile"]:::deploy
        Heroku["Heroku"]:::deploy
        PackageNode["Dependencies\n(package.json)"]:::doc
        ReadmeNode["Project Docs\n(README.md)"]:::doc
    end

    %% Connections
    BrowserUI -->|"HTTP GET /"| ServerApp
    ServerApp -->|"Serves index.html"| BrowserUI
    BrowserUI -->|"AJAX /prices"| ServerApp
    ServerApp -->|"fetchData()"| DataFetcher
    DataFetcher -->|"HTTP GET"| ExternalAPI
    ServerApp -->|"computeIndicators()"| Indicators
    Indicators -->|"returns metrics"| ServerApp
    ServerApp -->|"respond JSON"| BrowserUI
    Config -->|"loaded at startup"| ServerApp
    ProcfileNode -->|"deploys to"| Heroku
    PackageNode -->|"provides deps"| ServerApp

    %% Click Events
    click BrowserUI "https://github.com/lengo0951/cryptopricebot/blob/main/index.html"
    click ServerApp "https://github.com/lengo0951/cryptopricebot/blob/main/index.js"
    click DataFetcher "https://github.com/lengo0951/cryptopricebot/blob/main/dataFetcher.js"
    click Indicators "https://github.com/lengo0951/cryptopricebot/blob/main/indicatiors.js"
    click Config "https://github.com/lengo0951/cryptopricebot/blob/main/.env"
    click ProcfileNode "https://github.com/lengo0951/cryptopricebot/tree/main/Procfile"
    click PackageNode "https://github.com/lengo0951/cryptopricebot/blob/main/package.json"
    click ReadmeNode "https://github.com/lengo0951/cryptopricebot/blob/main/README.md"

    %% Styles
    classDef client fill:#f0f8ff,stroke:#333,stroke-width:1px
    classDef server fill:#add8e6,stroke:#333,stroke-width:1px
    classDef module fill:#90ee90,stroke:#333,stroke-width:1px
    classDef external fill:#ffe4e1,stroke:#333,stroke-width:1px
    classDef config fill:#fffacd,stroke:#333,stroke-width:1px
    classDef deploy fill:#e0ffff,stroke:#333,stroke-width:1px
    classDef doc fill:#f5f5f5,stroke:#333,stroke-width:1px
```
