Fastfetch is a cross-platform system information fetching tool written primarily in C11 (with optional C++17 components). It detects and displays hardware and software information through a modular, extensible architecture that supports 70+ detection modules across 9+ operating systems. The project emphasizes performance, configurability, and platform abstraction.
This page provides a high-level architectural overview of the entire fastfetch codebase. For specific topics, see:
Sources: README.md1-16 CMakeLists.txt1-10
Fastfetch follows a layered architecture with clear separation of concerns:
The design prioritizes compile-time polymorphism over runtime dispatch, using function pointers in FFModuleBaseInfo structures registered at compile time rather than virtual function tables or dynamic plugin loading.
Sources: src/fastfetch.h1-48 src/modules/modules.c1-184
The following diagram illustrates the major system components and their relationships using actual code entities:
Diagram: Fastfetch System Architecture with Code Entities
This architecture enables:
ffModuleInfos provides constant-time initial lookupinstance global variable (defined in src/common/impl/init.c) provides access to configuration and state throughout the codebaseSources: src/fastfetch.h23-48 src/fastfetch.c1-17 src/modules/modules.c1-184 src/flashfetch.c1-148
Diagram: Fastfetch Execution Flow
Key execution characteristics:
| Phase | Function | Source File | Purpose |
|---|---|---|---|
| Initialization | ffInitInstance() | src/common/impl/init.c | Set up global instance variable |
| Argument Parsing | parseCommand() | src/fastfetch.c590-743 | Process CLI flags and commands |
| Config Loading | parseJsoncFile() | src/fastfetch.c383-433 | Parse JSONC/JSON5 configuration |
| Validation | ffOptionsParseLogoJsonConfig() | src/options/logo.c | Validate against JSON schema |
| Platform Init | ffStart() | src/common/impl/init.c | Detect OS, terminal, initialize FFPlatform |
| Logo Rendering | ffLogoPrint() | src/logo/logo.c | Display ASCII art or image |
| Module Execution | run() | src/fastfetch.c744-893 | Iterate through modules |
| Cleanup | ffDestroyInstance() | src/common/impl/init.c | Free resources |
Sources: src/fastfetch.c1-1000 src/common/impl/init.c
The entire application state is contained in the instance global variable:
FFconfig contains three major option groups:
| Field | Type | Purpose | Default Config File Location |
|---|---|---|---|
logo | FFOptionsLogo | Logo type, source, colors, padding | src/options/logo.c |
display | FFOptionsDisplay | Output formatting, colors, units, bars | src/options/display.c |
general | FFOptionsGeneral | Platform-specific settings, timeouts | src/options/general.c |
FFstate tracks runtime information:
| Field | Type | Purpose |
|---|---|---|
logoWidth | uint32_t | Width of printed logo in characters |
logoHeight | uint32_t | Height of printed logo in lines |
keysHeight | uint32_t | Number of module outputs printed |
terminalLightTheme | bool | Whether terminal uses light theme |
platform | FFPlatform | Platform-specific paths and information |
dynamicInterval | uint32_t | Milliseconds between refreshes (0 = disabled) |
Sources: src/fastfetch.h23-48 src/options/logo.h src/options/display.h src/options/general.h
Every detection module implements the FFModuleBaseInfo interface:
Modules are registered in ffModuleInfos[26] arrays indexed by first letter (A-Z). Example from src/modules/modules.c20-31:
Sources: src/modules/modules.h1-77 src/modules/modules.c1-184
Fastfetch implements a compile-time module registry with 70+ modules organized alphabetically. Each module follows a consistent pattern:
Diagram: Module System Architecture (CPU Module Example)
Module categories by functionality:
| Category | Modules | Example Files |
|---|---|---|
| Hardware | CPU, GPU, Memory, Disk, Battery, Monitor | src/modules/cpu/ src/modules/gpu/ |
| Software | OS, Kernel, Packages, Shell, Terminal, DE, WM | src/modules/os/ src/modules/packages/ |
| Network | LocalIP, PublicIP, WiFi, DNS | src/modules/localip/ src/modules/wifi/ |
| Media | Player, Media (song info) | src/modules/player/ src/modules/media/ |
| System State | Uptime, Processes, Users, DateTime | src/modules/uptime/ src/modules/processes/ |
| Presentation | Title, Separator, Break, Colors, Custom | src/modules/title/ src/modules/colors/ |
Sources: src/modules/modules.c1-184 src/modules/modules.h1-77 src/modules/cpu/cpu.c src/detection/cpu/cpu.c
Fastfetch achieves cross-platform support through a three-tier abstraction:
Diagram: Three-Tier Platform Abstraction Pattern
Platform-specific file naming convention:
| Pattern | Example | Platform |
|---|---|---|
*_linux.c | cpu_linux.c | Linux (GNU/Linux) |
*_windows.c | cpu_windows.c | Windows |
*_apple.c | cpu_apple.c | macOS (C code) |
*_apple.m | disk_apple.m | macOS (Objective-C) |
*_bsd.c | cpu_bsd.c | FreeBSD, MidnightBSD, DragonFly |
*_obsd.c | cpu_obsd.c | OpenBSD |
*_nbsd.c | cpu_nbsd.c | NetBSD |
*_android.c | os_android.c | Android |
*_nosupport.c | btrfs_nosupport.c | Platform doesn't support feature |
Sources: CMakeLists.txt515-845 src/detection/cpu/cpu_linux.c src/detection/cpu/cpu_windows.c src/detection/cpu/cpu_apple.c
Fastfetch supports 9+ operating systems with varying feature completeness:
| Platform | Detected In | Build Configuration | Key Detection Files |
|---|---|---|---|
| Linux | CMakeLists.txt28-29 | LINUX=TRUE | src/common/impl/FFPlatform_unix.c |
| Windows | CMakeLists.txt48 | WIN32 | src/common/impl/FFPlatform_windows.c |
| macOS | CMakeLists.txt48 | APPLE | src/common/impl/FFPlatform_unix.c |
| FreeBSD | CMakeLists.txt30-31 | FreeBSD=TRUE | src/common/impl/FFPlatform_unix.c |
| OpenBSD | CMakeLists.txt32-33 | OpenBSD=TRUE | src/common/impl/FFPlatform_unix.c |
| NetBSD | CMakeLists.txt37-38 | NetBSD=TRUE | src/common/impl/FFPlatform_unix.c |
| DragonFly | CMakeLists.txt39-41 | DragonFly=TRUE | src/common/impl/FFPlatform_unix.c |
| Android | CMakeLists.txt26-27 | ANDROID | src/common/impl/FFPlatform_unix.c |
| SunOS | CMakeLists.txt42-43 | SunOS=TRUE | src/common/impl/FFPlatform_unix.c |
| Haiku | CMakeLists.txt44-45 | Haiku=TRUE | src/common/impl/FFPlatform_unix.c |
| GNU/Hurd | CMakeLists.txt46-47 | GNU=TRUE | src/common/impl/FFPlatform_unix.c |
Architecture support includes: x86_64, i686, aarch64, armv7l, armv6l, riscv64, ppc64le, s390x.
Sources: CMakeLists.txt24-50 README.md16 .github/workflows/ci.yml64-342
~/.config/fastfetch/, data directories, executable path{name}, {cores}, {freq}/proc, sysfs (Linux); Registry, WMI (Windows); sysctl, IOKit (macOS)ENABLE_VULKAN, ENABLE_WAYLAND, ENABLE_IMAGEMAGICK7, etc.BINARY_LINK_TYPESources: src/fastfetch.c383-569 src/logo/builtin.c1-21000 CMakeLists.txt67-128
Fastfetch relies on two core utility libraries:
Both types use RAII-style cleanup with FF_AUTO_DESTROY macros.
Sources: src/common/FFstrbuf.h src/common/FFlist.h src/common/impl/FFstrbuf.c src/common/impl/FFlist.c
For deeper exploration of specific subsystems:
Sources: README.md1-342 Wiki Table of Contents
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.