# jbreckmckye/daylight architecture

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

- Interactive diagram: https://gitdiagram.com/jbreckmckye/daylight
- Repository: https://github.com/jbreckmckye/daylight

## Overview

##### Project type and purpose
- From the file tree (.goreleaser.yaml, go.mod, internal/, main.go, makefile) and the lack of any frontend folder or web‐server code, we can see this is a Go-based command-line utility. The purpose is to parse CLI arguments, dispatch to subcommands (formatting, daylight lookup, IP lookup, JSON viewing, ASCII art), call any external HTTP services, and render output in the terminal.

##### File structure
- Top level:
- main.go – entry point, initializes the CLI
- makefile/.goreleaser.yaml – build/release orchestration
- internal/:
- cmd.go, args.go – command registration & argument parsing (likely using cobra or a custom dispatcher)
- config.go – loading and validating any shared flags or config file
- art.go, condensed.go, daylight.go (+ daylight_test.go), ipinfo.go, jsonview.go, summary.go, view.go, format.go (+ format_test.go) – one module per CLI feature
- No database, no persistent storage—this is a stateless utility.

##### (empty) README
- Since no architectural description is present, infer component responsibilities from filenames and standard Go project conventions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% I/O
    UserTerminal["User / Terminal"]:::io

    %% Core
    Main["main.go"]:::module
    Args["Argument Parser"]:::module
    Cmd["Command Dispatcher"]:::module
    Config["Configuration Loader"]:::module

    %% Feature Modules
    subgraph "Feature Modules"
        direction TB
        Art["Art Module"]:::module
        Condensed["Condensed Module"]:::module
        Daylight["Daylight Module"]:::module
        IPInfo["IP Info Module"]:::module
        JSONView["JSON View Module"]:::module
        Summary["Summary Module"]:::module
        ViewMod["View Renderer Module"]:::module
        FormatMod["Format Module"]:::module
    end

    %% External Services
    IPinfoAPI[(IPinfo API)]:::external
    SunriseAPI[(Sunrise-Sunset API)]:::external

    %% Output
    OutputRenderer["Output Renderer"]:::module
    TerminalDisplay["Terminal Display"]:::io

    %% Connections
    UserTerminal --> Main
    Main --> Args
    Args --> Config
    Config --> Cmd
    Cmd --> Art
    Cmd --> Condensed
    Cmd --> Daylight
    Cmd --> IPInfo
    Cmd --> JSONView
    Cmd --> Summary
    Cmd --> ViewMod
    Cmd --> FormatMod

    Daylight -->|HTTP call| SunriseAPI
    IPInfo -->|HTTP call| IPinfoAPI

    Art --> OutputRenderer
    Condensed --> OutputRenderer
    Daylight --> OutputRenderer
    IPInfo --> OutputRenderer
    JSONView --> OutputRenderer
    Summary --> OutputRenderer
    ViewMod --> OutputRenderer
    FormatMod --> OutputRenderer

    OutputRenderer --> TerminalDisplay

    %% Click Events
    click Main "https://github.com/jbreckmckye/daylight/blob/main/main.go"
    click Args "https://github.com/jbreckmckye/daylight/blob/main/internal/args.go"
    click Cmd "https://github.com/jbreckmckye/daylight/blob/main/internal/cmd.go"
    click Config "https://github.com/jbreckmckye/daylight/blob/main/internal/config.go"
    click Art "https://github.com/jbreckmckye/daylight/blob/main/internal/art.go"
    click Condensed "https://github.com/jbreckmckye/daylight/blob/main/internal/condensed.go"
    click Daylight "https://github.com/jbreckmckye/daylight/blob/main/internal/daylight.go"
    click IPInfo "https://github.com/jbreckmckye/daylight/blob/main/internal/ipinfo.go"
    click JSONView "https://github.com/jbreckmckye/daylight/blob/main/internal/jsonview.go"
    click Summary "https://github.com/jbreckmckye/daylight/blob/main/internal/summary.go"
    click ViewMod "https://github.com/jbreckmckye/daylight/blob/main/internal/view.go"
    click FormatMod "https://github.com/jbreckmckye/daylight/blob/main/internal/format.go"
    click .goreleaser.yaml "https://github.com/jbreckmckye/daylight/blob/main/.goreleaser.yaml"
    click makefile "https://github.com/jbreckmckye/daylight/tree/main/makefile"

    %% Styling
    classDef module fill:#DDEEFF,stroke:#333,stroke-width:1px;
    classDef io fill:#EEF3FF,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef external fill:#E8FFEA,stroke:#333,stroke-width:1px;
```
