# ashutosh00710/github-readme-activity-graph architecture

> Architecture diagram of the GitHub repository ashutosh00710/github-readme-activity-graph, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashutosh00710/github-readme-activity-graph
- Repository: https://github.com/ashutosh00710/github-readme-activity-graph

## Overview

##### File structure
- Top-level static assets:
– `index.html`, `script.js`, `styles.css`: a simple landing page or demo client
– `asset/`: logos and theme preview images
- Core application code in `src/`:
– `main.ts`: entry point / HTTP server or serverless handler
– `handlers.ts`: request routing and orchestration
– `fetcher.ts`: GitHub API integration (fetch commits/activity)
– `createChart.ts` + `GraphCards.ts`: chart data preparation and card assembly
– `svgs.ts`: SVG template generation
– `styles/`: theme definitions, graph styles, animations
– `utils.ts` + `interfaces/interface.ts`: helper functions and TypeScript types
- Configuration and deployment:
– `tsconfig.json`, `package.json`, `vercel.json`, Replit config (`replit.nix`, `.replit`, `replit.sh`)
- Tests in `__test__/`: unit-tests and snapshot tests for fetcher, chart logic, utilities, SVG outputs

##### Key insights from the README
- Core feature: dynamic SVG graph generation via URL parameters
- Supported by JetBrains; deployable on Vercel or Replit
- Uses Chartist.js under the hood for chart construction

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Entities
    Client["Client (Browser / GitHub README)"]:::external
    GitHubAPI["GitHub REST API"]:::external

    %% Infrastructure Layer
    subgraph "Infrastructure (Serverless Runtime)"  
        direction TB
        Vercel["Vercel / Cyclic / Replit"]:::infra
    end

    %% Static Assets Layer
    subgraph "Static Assets"  
        direction TB
        IndexHTML["index.html"]:::static
        ScriptJS["script.js"]:::static
        StylesCSS["styles.css"]:::static
        Asset["asset/"]:::static
    end

    %% Application Layer
    subgraph "Application Logic (Node.js / TypeScript)"
        direction TB
        Main["main.ts\n(Entry Point / HTTP Server)"]:::app
        Handlers["handlers.ts\n(Request Routing & Orchestration)"]:::app
        Fetcher["fetcher.ts\n(Fetcher Service)"]:::app
        CreateChart["createChart.ts\n(Chart Data Prep)"]:::app
        GraphCards["GraphCards.ts\n(Chart Card Assembly)"]:::app
        SVGs["svgs.ts\n(SVG Generator)"]:::app
        subgraph "Theme Manager"  
            direction TB
            Themes["themes.ts"]:::theme
            GraphStyle["graphStyle.ts"]:::theme
            GraphAnim["graphAnimation.ts"]:::theme
        end
        subgraph "Utilities & Types"  
            direction TB
            Utils["utils.ts"]:::util
            Interfaces["interface.ts"]:::util
        end
    end

    %% Configuration & Deployment
    subgraph "Config & Deployment"  
        direction TB
        VercelConfig["vercel.json"]:::config
        TSConfig["tsconfig.json"]:::config
        PackageJSON["package.json"]:::config
        ReplitNix["replit.nix"]:::config
        ReplitDot[".replit"]:::config
        ReplitSh["replit.sh"]:::config
    end

    %% Tests
    subgraph "Tests"  
        direction TB
        TestsRoot["__test__/"]:::test
        Snapshots["__snapshots__/"]:::test
        FetchTest["fetching.test.ts"]:::test
        SVGTest["svgs.test.ts"]:::test
        UtilsTest["utils.test.ts"]:::test
        ThemesTest["themes.test.ts"]:::test
    end

    %% Data Flows
    Client -->|HTTP GET /graph?params| Vercel
    Vercel --> Main
    Main --> Handlers
    Handlers -->|extract params| Fetcher
    Fetcher -->|HTTPS JSON| GitHubAPI
    GitHubAPI -->|JSON data| Fetcher
    Fetcher --> Handlers
    Handlers --> CreateChart
    CreateChart --> GraphCards
    GraphCards --> SVGs
    Themes --> CreateChart
    GraphStyle --> CreateChart
    GraphAnim --> CreateChart
    Utils --> Handlers
    Interfaces --> Handlers
    SVGs --> Handlers
    Handlers -->|SVG response| Client

    %% Optional Landing Page Flow
    Client --> IndexHTML
    IndexHTML --> ScriptJS
    IndexHTML --> StylesCSS

    %% Click Events
    click IndexHTML "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/index.html"
    click ScriptJS "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/script.js"
    click StylesCSS "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/styles.css"
    click Asset "https://github.com/ashutosh00710/github-readme-activity-graph/tree/main/asset/"
    click Main "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/main.ts"
    click Handlers "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/handlers.ts"
    click Fetcher "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/fetcher.ts"
    click CreateChart "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/createChart.ts"
    click GraphCards "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/GraphCards.ts"
    click SVGs "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/svgs.ts"
    click Themes "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/styles/themes.ts"
    click GraphStyle "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/styles/graphStyle.ts"
    click GraphAnim "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/styles/graphAnimation.ts"
    click Utils "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/utils.ts"
    click Interfaces "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/src/interfaces/interface.ts"
    click VercelConfig "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/vercel.json"
    click TSConfig "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/tsconfig.json"
    click PackageJSON "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/package.json"
    click ReplitNix "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/replit.nix"
    click ReplitDot "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/.replit"
    click ReplitSh "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/replit.sh"
    click TestsRoot "https://github.com/ashutosh00710/github-readme-activity-graph/tree/main/__test__/"
    click Snapshots "https://github.com/ashutosh00710/github-readme-activity-graph/tree/main/__test__/__snapshots__/"
    click FetchTest "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/__test__/fetching.test.ts"
    click SVGTest "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/__test__/svgs.test.ts"
    click UtilsTest "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/__test__/utils.test.ts"
    click ThemesTest "https://github.com/ashutosh00710/github-readme-activity-graph/blob/main/__test__/themes.test.ts"

    %% Styles
    classDef external fill:#ffe4e1,stroke:#d62728,color:#000
    classDef infra fill:#e0ffff,stroke:#1f77b4,color:#000
    classDef static fill:#fafad2,stroke:#ff7f0e,color:#000
    classDef app fill:#e6e6fa,stroke:#9467bd,color:#000
    classDef theme fill:#f0fff0,stroke:#2ca02c,color:#000
    classDef util fill:#f5f5f5,stroke:#8c564b,color:#000
    classDef config fill:#fff5ee,stroke:#d62728,color:#000
    classDef test fill:#fff0f5,stroke:#e377c2,color:#000
```
