# ashish0kumar/stormy architecture

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

- Interactive diagram: https://gitdiagram.com/ashish0kumar/stormy
- Repository: https://github.com/ashish0kumar/stormy

## Overview

##### Project type and purpose
- stormy is a standalone, command-line weather utility written in Go.
- It fetches weather data from external APIs (OpenMeteo or OpenWeatherMap), parses it, and renders an ASCII art summary in the terminal.
- Its architecture is modular, with a CLI entrypoint, configuration loader, pluggable provider implementations, data models, and display logic.

##### File structure
Top-level files and directories:
- main.go – CLI entrypoint; flag parsing and orchestration
- internal/weather/ – core domain logic
– config.go – loads and validates ~/.config/stormy/stormy.toml
– models.go – defines Go structs matching API responses
- assets/ – screenshots and ASCII art samples (used for documentation)
- .github/, goreleaser, go.mod – CI/CD, packaging, and dependency management

##### README for additional insights
- Two provider implementations (no-key OpenMeteo, key-based OpenWeatherMap) – implies a strategy pattern for “provider.”
- Outputs to a terminal; no persistent storage beyond config file.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Flow
    CLI["CLI Entrypoint\n(main.go)"]:::internal
    Config["Config Loader\n(internal/weather/config.go)"]:::internal
    ConfigFile["Config File\n~/.config/stormy/stormy.toml"]:::external

    subgraph "Provider Layer"
        direction TB
        ProviderInterface["WeatherProvider Interface"]:::internal
        OpenMeteo["OpenMeteo Provider"]:::internal
        OpenWeather["OpenWeatherMap Provider"]:::internal
    end

    HTTPClient["HTTP Client"]:::internal

    Models["Data Models\n(internal/weather/models.go)"]:::internal
    Icons["ASCII Icon Mapper\n(internal/weather/icons.go)"]:::internal
    Renderer["Display Renderer\n(internal/weather/display.go)"]:::internal

    Terminal["Terminal Output\n(stdout)"]:::terminal

    subgraph "External APIs"
        direction TB
        OpenMeteoAPI["OpenMeteo API\n(api.open-meteo.com)"]:::external
        OpenWeatherAPI["OpenWeatherMap API"]:::external
    end

    %% Connections
    CLI -->|"loads flags"| Config
    ConfigFile --> Config
    Config -->|"selects provider"| ProviderInterface
    ProviderInterface -->|"implemented by"| OpenMeteo
    ProviderInterface -->|"implemented by"| OpenWeather
    OpenMeteo -->|"fetches data via"| HTTPClient
    OpenWeather -->|"fetches data via"| HTTPClient
    HTTPClient -->|"GET JSON"| OpenMeteoAPI
    HTTPClient -->|"GET JSON"| OpenWeatherAPI
    HTTPClient -->|"returns JSON"| Models
    Models -->|"maps to structs"| Icons
    Models -->|"maps to structs"| Renderer
    Icons -->|"adds ASCII icons"| Renderer
    Renderer -->|"formats output"| Terminal

    %% Click Events
    click CLI "https://github.com/ashish0kumar/stormy/blob/main/main.go"
    click Config "https://github.com/ashish0kumar/stormy/blob/main/internal/weather/config.go"
    click Models "https://github.com/ashish0kumar/stormy/blob/main/internal/weather/models.go"
    click Icons "https://github.com/ashish0kumar/stormy/blob/main/internal/weather/icons.go"
    click Renderer "https://github.com/ashish0kumar/stormy/blob/main/internal/weather/display.go"

    %% Styles
    classDef internal fill:#D0E8FF,stroke:#024A86,color:#000
    classDef external fill:#DFFFD0,stroke:#3A5F0B,color:#000
    classDef terminal fill:#FFE0E0,stroke-dasharray: 5 5,stroke:#A00;color:#000
```
