# spectrumdev-tech/archfetch architecture

> Architecture diagram of the GitHub repository spectrumdev-tech/archfetch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spectrumdev-tech/archfetch
- Repository: https://github.com/spectrumdev-tech/archfetch

## Overview

Archfetch is a small C11 system-information fetcher. A user runs the program; `src/main.c` loads display settings, gathers system and session details, then formats the values with Arch ASCII art and ANSI colors for terminal output. The sampled code confirms most collectors and their inputs; kernel and configuration behavior is included from the README, tree, and calls in `main.c`, while unsampled implementation details are not inferred.

Main entry points: [`src/main.c`](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/main.c) (Fetch and render), [`src/osinfo.c`](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/osinfo.c) (OS identity), [`src/cpu.c`](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/cpu.c) (CPU details), [`src/config.c`](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/config.c) (Display settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Collection and display"]
  node_main["Fetch and render<br/>[main.c]"]
end

subgraph group_system["System details"]
  node_os["OS identity<br/>[osinfo.c]"]
  node_kernel["Kernel version<br/>[kernel.c]"]
  node_cpu["CPU details<br/>[cpu.c]"]
  node_utils["Text utilities<br/>[utils.c]"]
end

subgraph group_session["Session and settings"]
  node_shell["Shell details<br/>[shell.c]"]
  node_wm["Desktop session<br/>[wm.c]"]
  node_config["Display settings<br/>[config.c]"]
end

subgraph group_runtime["Runtime and packages"]
  node_memory["Memory usage<br/>[memory.c]"]
  node_uptime["System uptime<br/>[uptime.c]"]
  node_packages["Package count<br/>[packages.c]"]
end

node_user(("User"))
node_terminal["Terminal"]
node_osrelease["OS release file"]
node_kernelrelease["Kernel release file"]
node_procinfo["Proc system files"]
node_pacmandb[("Pacman local database")]
node_environment["Environment variables"]

node_user -->|"runs"| node_main
node_main -->|"loads settings"| node_config
node_config -->|"returns settings"| node_main
node_main -->|"gets color"| node_config
node_main -->|"gets OS name"| node_os
node_main -->|"gets version"| node_kernel
node_main -->|"gets CPU"| node_cpu
node_main -->|"gets memory"| node_memory
node_main -->|"gets uptime"| node_uptime
node_main -->|"counts packages"| node_packages
node_main -->|"gets shell"| node_shell
node_main -->|"gets desktop"| node_wm
node_main -->|"prints report"| node_terminal
node_os -->|"reads"| node_osrelease
node_kernel -->|"reads"| node_kernelrelease
node_cpu -->|"reads"| node_procinfo
node_memory -->|"reads"| node_procinfo
node_uptime -->|"reads"| node_procinfo
node_packages -->|"counts entries"| node_pacmandb
node_shell -->|"reads"| node_environment
node_wm -->|"reads"| node_environment
node_os -->|"trims quotes"| node_utils
node_cpu -->|"trims newline"| node_utils

click node_main "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/main.c"
click node_os "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/osinfo.c"
click node_kernel "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/kernel.c"
click node_cpu "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/cpu.c"
click node_memory "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/memory.c"
click node_uptime "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/uptime.c"
click node_packages "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/packages.c"
click node_shell "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/shell.c"
click node_wm "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/wm.c"
click node_config "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/config.c"
click node_utils "https://github.com/spectrumdev-tech/archfetch/blob/dev/src/utils.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_user toneBlue
class node_os,node_kernel,node_cpu,node_utils,node_pacmandb toneAmber
class node_shell,node_wm,node_config toneMint
class node_memory,node_uptime,node_packages toneRose
class node_terminal,node_osrelease,node_kernelrelease,node_procinfo,node_environment toneIndigo
```

## Components

### Collection and display

- [Fetch and render](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/main.c): `src/main.c`

### System details

- [OS identity](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/osinfo.c): `src/osinfo.c`
- [Kernel version](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/kernel.c): `src/kernel.c`
- [CPU details](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/cpu.c): `src/cpu.c`
- [Text utilities](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/utils.c): `src/utils.c`

### Session and settings

- [Shell details](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/shell.c): `src/shell.c`
- [Desktop session](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/wm.c): `src/wm.c`
- [Display settings](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/config.c): `src/config.c`

### Runtime and packages

- [Memory usage](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/memory.c): `src/memory.c`
- [System uptime](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/uptime.c): `src/uptime.c`
- [Package count](https://github.com/spectrumdev-tech/archfetch/blob/dev/src/packages.c): `src/packages.c`

### Other components

- **User**
- **Terminal**
- **OS release file**
- **Kernel release file**
- **Proc system files**
- **Pacman local database**
- **Environment variables**

## Connections

- User → Fetch and render: runs
- Fetch and render → Display settings: loads settings
- Display settings → Fetch and render: returns settings
- Fetch and render → Display settings: gets color
- Fetch and render → OS identity: gets OS name
- Fetch and render → Kernel version: gets version
- Fetch and render → CPU details: gets CPU
- Fetch and render → Memory usage: gets memory
- Fetch and render → System uptime: gets uptime
- Fetch and render → Package count: counts packages
- Fetch and render → Shell details: gets shell
- Fetch and render → Desktop session: gets desktop
- Fetch and render → Terminal: prints report
- OS identity → OS release file: reads
- Kernel version → Kernel release file: reads
- CPU details → Proc system files: reads
- Memory usage → Proc system files: reads
- System uptime → Proc system files: reads
- Package count → Pacman local database: counts entries
- Shell details → Environment variables: reads
- Desktop session → Environment variables: reads
- OS identity → Text utilities: trims quotes
- CPU details → Text utilities: trims newline
