# w4rh4wk/debloat-windows-10 architecture

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

- Interactive diagram: https://gitdiagram.com/w4rh4wk/debloat-windows-10
- Repository: https://github.com/w4rh4wk/debloat-windows-10

## Overview

##### Project Type and Purpose
- This is an open-source, CLI-based Windows system-administration tool (“Debloat Windows 10”).
- It provides a collection of PowerShell scripts (.ps1) and helper modules (.psm1) to automate the removal or disabling of unwanted Windows components and to apply common system tweaks.
- Utility files (.bat, .reg, additional .ps1) live in a separate folder and can be invoked directly or by the main scripts.

##### File Structure Analysis
- Top-level folders:
- lib/ – PowerShell modules (New-FolderForced.psm1, take-own.psm1) exporting reusable functions.
- scripts/ – Main .ps1 scripts for debloating tasks (disable-windows-defender.ps1, remove-default-apps.ps1, etc.).
- utils/ – Batch files and registry‐import scripts for one-off tweaks (dark-theme.reg, ssd-tune.ps1, etc.).
- No frontend/backend separation—instead a modular, script‐centric structure.
- No build/deploy configs; it runs directly on Windows PowerShell with Administrator rights.

##### README Insights
- Emphasizes non-interactive execution (scripts must be pre-edited).
- Requires Windows 10 Pro 64-bit.
- Modules must be unblocked and execution policy set to Unrestricted.
- No external cloud or third-party APIs—only Windows OS internals (Registry, Services, AppX packages).

a. Main Components
- User / Administrator invoking PowerShell CLI
- PowerShell Host (Engine)
- scripts/ folder (individual .ps1 task scripts)
- lib/ folder (PowerShell modules providing shared functions)
- utils/ folder (batch, registry, helper scripts)
- Windows OS subsystems:
– Registry
– Service Manager (SC.exe)
– AppX Package Manager
– File System & NTFS permissions
b. Relationships & Data Flow
1. User launches a .ps1 script from scripts/
2. Script imports functions from lib/*.psm1
3. Script executes commands against Windows subsystems (e.g., Set-Service, Remove-AppxPackage, reg import)
4. Scripts may invoke utils/* files directly or call them via Start-Process
c. Architectural Patterns & Principles
- Modularization: common tasks abstracted into .psm1 modules for reuse.
- Single-responsibility: one script = one tweak or removal job.
- Plain-text, idempotent commands—no hidden state or database.
d. Key Technologies
- Windows PowerShell (v5+)
- PowerShell Modules (.psm1)
- Windows Registry (.reg)
- Batch files (.bat)
- Windows Service Control (SC.exe)
- AppX Package Manager (Get-AppxPackage / Remove-AppxPackage)

##### Detail
- Major interactions: scripts → modules → OS.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Environment
    User["User / Administrator"]:::user
    PSHost["PowerShell Host"]:::host

    %% Directories and Scripts Subgraphs
    subgraph "scripts/" 
        direction TB
        ScriptsDir[/"Debloat Scripts Directory"/]:::code
        RDA["remove-default-apps.ps1"]:::code
        DWD["disable-windows-defender.ps1"]:::code
        DSVC["disable-services.ps1"]:::code
        BTEL["block-telemetry.ps1"]:::code
        EXP["experimental_unfuckery.ps1"]:::code
        FPS["fix-privacy-settings.ps1"]:::code
        OUI["optimize-user-interface.ps1"]:::code
        OWU["optimize-windows-update.ps1"]:::code
        ROD["remove-onedrive.ps1"]:::code
    end

    subgraph "lib/" 
        direction TB
        LibDir[/"Shared Modules Directory"/]:::code
        NF["New-FolderForced.psm1"]:::code
        TO["take-own.psm1"]:::code
    end

    subgraph "utils/"
        direction TB
        UtilsDir[/"Utility Scripts & Tweaks"/]:::code
        BAT1["boot-advanced-startup.bat"]:::code
        BAT2["disable-ShellExperienceHost.bat"]:::code
        BAT3["disable-searchUI.bat"]:::code
        REG1["dark-theme.reg"]:::code
        REG2["disable-edge-prelaunch.reg"]:::code
        REG3["enable-photo-viewer.reg"]:::code
        REG4["lower-ram-usage.reg"]:::code
        PS1["disable-memory-compression.ps1"]:::code
        PS2["disable-prefetch-prelaunch.ps1"]:::code
        PS3["disable-scheduled-tasks.ps1"]:::code
        PS4["enable-god-mode.ps1"]:::code
        PS5["install-basic-software.ps1"]:::code
        PS6["ssd-tune.ps1"]:::code
    end

    %% Windows OS Subsystems
    subgraph "Windows OS Internals"
        direction TB
        Registry["Registry"]:::os
        Services["Service Manager"]:::os
        AppX["AppX Package Manager"]:::os
        FS["File System & NTFS"]:::os
    end

    %% Prerequisites Note
    Prereq["Prerequisites:\n- ExecutionPolicy=Unrestricted\n- Unblocked Modules\n- Admin Rights"]:::note

    %% Connections
    User -->|"Invoke script"| PSHost
    PSHost -->|"Load .ps1"| ScriptsDir
    PSHost -->|"Start-Process"| UtilsDir

    ScriptsDir -->|"Import-Module"| LibDir
    RDA -->|"Import-Module"| LibDir
    DWD -->|"Import-Module"| LibDir
    DSVC -->|"Import-Module"| LibDir
    BTEL -->|"Import-Module"| LibDir
    EXP -->|"Import-Module"| LibDir
    FPS -->|"Import-Module"| LibDir
    OUI -->|"Import-Module"| LibDir
    OWU -->|"Import-Module"| LibDir
    ROD -->|"Import-Module"| LibDir

    %% Scripts to OS
    ScriptsDir -->|"reg import"| Registry
    ScriptsDir -->|"Set-Service / SC.exe"| Services
    ScriptsDir -->|"Remove-AppxPackage"| AppX
    ScriptsDir -->|"NTFS Permissions"| FS

    %% Utils to OS
    UtilsDir -.->|"reg import"| Registry
    UtilsDir -.->|"Batch Execution"| Services
    UtilsDir -.->|"Batch Execution"| AppX
    UtilsDir -.->|"PowerShell Commands"| FS

    PSHost --> Prereq

    %% Click Events
    click User "https://github.com/w4rh4wk/debloat-windows-10/blob/master/README.md"
    click ScriptsDir "https://github.com/w4rh4wk/debloat-windows-10/tree/master/scripts/"
    click RDA "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/remove-default-apps.ps1"
    click DWD "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/disable-windows-defender.ps1"
    click DSVC "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/disable-services.ps1"
    click BTEL "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/block-telemetry.ps1"
    click EXP "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/experimental_unfuckery.ps1"
    click FPS "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/fix-privacy-settings.ps1"
    click OUI "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/optimize-user-interface.ps1"
    click OWU "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/optimize-windows-update.ps1"
    click ROD "https://github.com/w4rh4wk/debloat-windows-10/blob/master/scripts/remove-onedrive.ps1"

    click LibDir "https://github.com/w4rh4wk/debloat-windows-10/tree/master/lib/"
    click NF "https://github.com/w4rh4wk/debloat-windows-10/blob/master/lib/New-FolderForced.psm1"
    click TO "https://github.com/w4rh4wk/debloat-windows-10/blob/master/lib/take-own.psm1"

    click UtilsDir "https://github.com/w4rh4wk/debloat-windows-10/tree/master/utils/"
    click BAT1 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/boot-advanced-startup.bat"
    click BAT2 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/disable-ShellExperienceHost.bat"
    click BAT3 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/disable-searchUI.bat"
    click REG1 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/dark-theme.reg"
    click REG2 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/disable-edge-prelaunch.reg"
    click REG3 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/enable-photo-viewer.reg"
    click REG4 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/lower-ram-usage.reg"
    click PS1 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/disable-memory-compression.ps1"
    click PS2 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/disable-prefetch-prelaunch.ps1"
    click PS3 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/disable-scheduled-tasks.ps1"
    click PS4 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/enable-god-mode.ps1"
    click PS5 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/install-basic-software.ps1"
    click PS6 "https://github.com/w4rh4wk/debloat-windows-10/blob/master/utils/ssd-tune.ps1"

    click Prereq "https://github.com/w4rh4wk/debloat-windows-10/blob/master/README.md"

    %% Styles
    classDef code fill:#cfe2f3,stroke:#6fa8dc,stroke-width:1px
    classDef host fill:#d9ead3,stroke:#6aa84f,stroke-width:1px
    classDef os fill:#e7e6e6,stroke:#999999,stroke-width:1px
    classDef note fill:#fff2cc,stroke:#f1c232,stroke-width:1px
    class User,PSHost,Prereq code
    class User user
    class PSHost host
    class Prereq note
```
