# peter-svensson/dotfiles architecture

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

- Interactive diagram: https://gitdiagram.com/peter-svensson/dotfiles
- Repository: https://github.com/peter-svensson/dotfiles

## Overview

##### Main Components

a. Configuration Management Layer
- Chezmoi as the central management tool
- LastPass integration for secrets management
- Template files (.tmpl extensions)

b. Development Environment Components
- Shell Configuration (zsh, bash)
- Development Tools
- Security & Authentication
- Project-specific Configurations

**┌─────────────────────────────────────────────────────────────┐**
- Chezmoi Core (Controller)                 │
- ┤

- ┌─────────────┐    ┌──────────────┐    ┌────────────┐   │
- Templates  │    │   LastPass   │    │  Scripts   │   │
- (.tmpl)  │    │   Secrets    │    │  (*.sh)    │   │
- ┘    └──────────────┘    └────────────┘   │

- ┘

- ▼                    ▼                    ▼

**┌─────────────────────────────────────────────────────────────┐**
- Managed Configurations                       │
- ┬───────────────┬──────────────┬─────────────┤
- Shell Config │  Dev Tools    │  Security    │  Projects   │
- .zshrc     │  - vim       │  - .ssh      │  - goodfeed │
- .bashrc    │  - tmux      │  - .gnupg    │  - stc      │
- aliases    │  - git       │              │  - etc.     │
- ┴───────────────┴──────────────┴─────────────┘

##### Important Elements to Highlight

a. Template System
- How .tmpl files are processed
- Template inheritance where applicable

b. Security Layer
- SSH key management
- GPG key configuration
- Credential storage

c. Project-Specific Configurations
- Relationship between source/ directory and project configs
- Infrastructure configurations for different environments

##### Implementation Details

- The role of chezmoi in managing dotfiles
- The separation between private and public configurations
- The template system for generating environment-specific configs
- The relationship between source files and their final locations

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph ChezmoidCore["Chezmoi Core (Controller)"]
        direction TB
        CC[Chezmoi Controller]:::controller
        TP[Templates Processor]:::processor
        LP[LastPass Integration]:::security
        SC[Scripts Controller]:::controller
    end

    subgraph ConfigTemplates["Template System"]
        direction TB
        NT["Ngrok Template"]:::template
        ET["Environment Template"]:::template
        ST["SSH Templates"]:::template
        AT["Auth Template"]:::template
    end

    subgraph SecurityAuth["Security & Authentication"]
        direction TB
        SSH["SSH Configuration"]:::security
        GPG["GPG Keys"]:::security
        Auth["Authentication"]:::security
    end

    subgraph ShellConfig["Shell Configuration"]
        direction TB
        ZSH["Zsh Config"]:::shell
        BASH["Bash Config"]:::shell
        Aliases["Aliases"]:::shell
        Functions["Functions"]:::shell
        Exports["Exports"]:::shell
        History["History Options"]:::shell
    end

    subgraph DevTools["Development Tools"]
        direction TB
        Vim["Vim"]:::tool
        Tmux["Tmux"]:::tool
        Git["Git Config"]:::tool
        Brew["Brew Packages"]:::tool
    end

    subgraph Projects["Project Configurations"]
        direction TB
        GF["Goodfeed"]:::project
        LI["Life Inside"]:::project
        PT["Product Tale"]:::project
        STC["STC"]:::project
        Smart["Smart"]:::project
    end

    subgraph Scripts["System Scripts"]
        direction TB
        GB["Go Brew"]:::script
        PX["Pipx"]:::script
        PKG["Package Install"]:::script
        SUDO["Sudo Config"]:::script
        ZSH_SW["ZSH Switch"]:::script
        MACOS["MacOS Config"]:::script
    end

    ChezmoidCore --> ConfigTemplates
    ChezmoidCore --> SecurityAuth
    ChezmoidCore --> ShellConfig
    ChezmoidCore --> DevTools
    ChezmoidCore --> Projects
    ChezmoidCore --> Scripts

    %% Click Events
    click CC "https://github.com/peter-svensson/dotfiles/blob/main/.chezmoiexternal.toml"
    click NT "https://github.com/peter-svensson/dotfiles/blob/main/private_dot_ngrok2/private_ngrok.yml.tmpl"
    click ET "https://github.com/peter-svensson/dotfiles/blob/main/source/dot_envrc.tmpl"
    click ST "https://github.com/peter-svensson/dotfiles/blob/main/private_dot_ssh/config.d/config_home.tmpl"
    click SSH "https://github.com/peter-svensson/dotfiles/tree/main/private_dot_ssh/"
    click GPG "https://github.com/peter-svensson/dotfiles/tree/main/private_dot_gnupg/"
    click Auth "https://github.com/peter-svensson/dotfiles/blob/main/private_dot_auths.tmpl"
    click ZSH "https://github.com/peter-svensson/dotfiles/tree/main/dot_zshrc"
    click BASH "https://github.com/peter-svensson/dotfiles/tree/main/dot_bashrc"
    click Aliases "https://github.com/peter-svensson/dotfiles/tree/main/dot_aliases"
    click Functions "https://github.com/peter-svensson/dotfiles/tree/main/dot_functions"
    click Exports "https://github.com/peter-svensson/dotfiles/tree/main/dot_exports"
    click History "https://github.com/peter-svensson/dotfiles/tree/main/dot_historyopts"
    click Vim "https://github.com/peter-svensson/dotfiles/tree/main/dot_vim/"
    click Tmux "https://github.com/peter-svensson/dotfiles/blob/main/dot_tmux.conf"
    click Git "https://github.com/peter-svensson/dotfiles/tree/main/dot_gitconfig"
    click GF "https://github.com/peter-svensson/dotfiles/tree/main/source/goodfeed/"
    click LI "https://github.com/peter-svensson/dotfiles/tree/main/source/lifeinside/"
    click PT "https://github.com/peter-svensson/dotfiles/tree/main/source/producttale/"
    click STC "https://github.com/peter-svensson/dotfiles/tree/main/source/stc/"
    click Smart "https://github.com/peter-svensson/dotfiles/tree/main/source/smart/"
    click GB "https://github.com/peter-svensson/dotfiles/blob/main/run_once_add_gobrew.sh"
    click PX "https://github.com/peter-svensson/dotfiles/blob/main/run_once_add_pipx.sh"
    click PKG "https://github.com/peter-svensson/dotfiles/blob/main/run_once_before_install-packages-darwin.sh.tmpl"
    click SUDO "https://github.com/peter-svensson/dotfiles/blob/main/run_once_passwordless_sudo.sh"
    click ZSH_SW "https://github.com/peter-svensson/dotfiles/blob/main/run_once_switch_zsh.sh"
    click MACOS "https://github.com/peter-svensson/dotfiles/blob/main/run_once_zz_modify_macos.sh"

    %% Styling
    classDef controller fill:#2374ab
    classDef processor fill:#57a773
    classDef security fill:#f7d794
    classDef template fill:#786fa6
    classDef shell fill:#48dbfb
    classDef tool fill:#32ff7e
    classDef project fill:#7158e2
    classDef script fill:#ff4d4d

    %% Legend
    subgraph Legend
        direction TB
        L1[Controller]:::controller
        L2[Processor]:::processor
        L3[Security]:::security
        L4[Template]:::template
        L5[Shell]:::shell
        L6[Tool]:::tool
        L7[Project]:::project
        L8[Script]:::script
    end
```
