# isaaclins/freesnitch architecture

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

- Interactive diagram: https://gitdiagram.com/isaaclins/freesnitch
- Repository: https://github.com/isaaclins/freesnitch

## Overview

FreeSnitch is a macOS outbound application firewall with a monitoring and rules interface. Users inspect connections, manage rules or profiles, and respond to connection alerts; the helper applies policy, while the Network System Extension provides per-process filtering in the firewall build. The helper also supports DNS filtering, pf enforcement, blocklists, and Insights. The graph combines sampled calls and imports with README-documented capabilities; unsampled feature links are documented rather than inferred from names.

Main entry points: [`Sources/Helper/HelperService.swift`](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/HelperService.swift) (Privileged helper), [`Sources/GUI/ViewModels/AppState.swift`](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/ViewModels/AppState.swift) (App state and navigation), [`Sources/NetExt/FilterDataProvider.swift`](https://github.com/isaaclins/freesnitch/blob/main/Sources/NetExt/FilterDataProvider.swift) (Per-process filter), [`Sources/Helper/DNSProxy.swift`](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/DNSProxy.swift) (DNS proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop app"]
  node_gui["App state and navigation<br/>[AppState.swift]"]
  node_rulesui["Rules and blocklists UI<br/>[RulesManager.swift]"]
  node_profilesui["Profiles UI"]
  node_monitorui["Connection monitor"]
  node_insightsui["Insights and map<br/>[InsightsView.swift]"]
  node_window["Window and alerts"]
  node_extmanager["Extension lifecycle"]
end

subgraph group_policy["Policy and storage"]
  node_helper["Privileged helper"]
  node_rules[("Rule and policy store<br/>[RuleStore.swift]")]
  node_matcher["Rule matcher<br/>[RuleMatcher.swift]"]
  node_blocklists["Blocklist manager"]
  node_monitor["Network monitor service<br/>[NetMonitor.swift]"]
  node_insights[("Insights storage")]
end

subgraph group_enforcement["Traffic enforcement"]
  node_dns["DNS proxy<br/>[DNSProxy.swift]"]
  node_pf["pf enforcement<br/>[PFManager.swift]"]
  node_netext["Per-process filter"]
end

subgraph group_shared["Shared interfaces"]
  node_bridge["Policy snapshot bridge"]
  node_ipc["XPC connection"]
  node_profiles["Profile client"]
end

subgraph group_operations["CLI operations"]
  node_cli["CLI commands<br/>[CLIRunner.swift]"]
  node_helperclient["CLI helper client"]
end

node_user(("Mac user"))
node_macos(("macOS networking"))

node_user -->|"uses"| node_gui
node_gui -->|"requests policy"| node_helper
node_rulesui -->|"edits rules"| node_gui
node_profilesui -->|"manages profiles"| node_profiles
node_profiles -.->|"sends commands"| node_helper
node_gui -->|"shows connections"| node_monitorui
node_gui -->|"publishes alerts"| node_window
node_gui -.->|"presents insights"| node_insightsui
node_gui -->|"manages extension"| node_extmanager
node_extmanager -->|"registers IPC"| node_ipc
node_cli -->|"invokes commands"| node_helperclient
node_helperclient -->|"sends requests"| node_helper
node_helper -->|"reads and writes"| node_rules
node_helper -->|"controls proxy"| node_dns
node_helper -->|"controls enforcement"| node_pf
node_helper -->|"starts monitoring"| node_monitor
node_helper -->|"records insights"| node_insights
node_helper -->|"manages lists"| node_blocklists
node_helper -->|"publishes policy"| node_bridge
node_helper -.->|"serves clients"| node_ipc
node_dns -->|"checks rules"| node_matcher
node_netext -->|"checks rules"| node_matcher
node_netext -->|"receives snapshots"| node_bridge
node_netext -->|"filters traffic"| node_macos
node_dns -.->|"handles DNS"| node_macos
node_pf -.->|"enforces rules"| node_macos
node_blocklists -->|"reads and updates"| node_rules
node_monitor -.->|"stores connections"| node_rules
node_insights -.->|"supplies summaries"| node_gui
node_ipc -->|"transports snapshots"| node_bridge

click node_gui "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/ViewModels/AppState.swift"
click node_rulesui "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/RulesManager.swift"
click node_profilesui "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/ProfilesSettings.swift"
click node_monitorui "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/NetworkMonitor.swift"
click node_insightsui "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/InsightsView.swift"
click node_window "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/App/WindowManager.swift"
click node_extmanager "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/App/SystemExtensionManager.swift"
click node_cli "https://github.com/isaaclins/freesnitch/blob/main/Sources/CLI/CLIRunner.swift"
click node_helperclient "https://github.com/isaaclins/freesnitch/blob/main/Sources/CLI/CLIHelperClient.swift"
click node_helper "https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/HelperService.swift"
click node_rules "https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/RuleStore.swift"
click node_matcher "https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/RuleMatcher.swift"
click node_blocklists "https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/BlocklistManager.swift"
click node_dns "https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/DNSProxy.swift"
click node_pf "https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/PFManager.swift"
click node_monitor "https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/NetMonitor.swift"
click node_insights "https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/InsightsStore.swift"
click node_netext "https://github.com/isaaclins/freesnitch/blob/main/Sources/NetExt/FilterDataProvider.swift"
click node_bridge "https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/SharedRuleBridge.swift"
click node_ipc "https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/IPCConnection.swift"
click node_profiles "https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/ViewModels/ProfileClient.swift"

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_gui,node_rulesui,node_profilesui,node_monitorui,node_insightsui,node_window,node_extmanager,node_user toneBlue
class node_helper,node_rules,node_matcher,node_blocklists,node_monitor,node_insights toneAmber
class node_dns,node_pf,node_netext toneMint
class node_bridge,node_ipc,node_profiles toneRose
class node_cli,node_helperclient,node_macos toneIndigo
```

## Components

### Desktop app

- [App state and navigation](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/ViewModels/AppState.swift): `Sources/GUI/ViewModels/AppState.swift`
- [Rules and blocklists UI](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/RulesManager.swift): `Sources/GUI/Views/RulesManager.swift`
- [Profiles UI](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/ProfilesSettings.swift): `Sources/GUI/Views/ProfilesSettings.swift`
- [Connection monitor](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/NetworkMonitor.swift): `Sources/GUI/Views/NetworkMonitor.swift`
- [Insights and map](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/Views/InsightsView.swift): `Sources/GUI/Views/InsightsView.swift`
- [Window and alerts](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/App/WindowManager.swift): `Sources/GUI/App/WindowManager.swift`
- [Extension lifecycle](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/App/SystemExtensionManager.swift): `Sources/GUI/App/SystemExtensionManager.swift`

### Policy and storage

- [Privileged helper](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/HelperService.swift): `Sources/Helper/HelperService.swift`
- [Rule and policy store](https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/RuleStore.swift): `Sources/Shared/RuleStore.swift`
- [Rule matcher](https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/RuleMatcher.swift): `Sources/Shared/RuleMatcher.swift`
- [Blocklist manager](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/BlocklistManager.swift): `Sources/Helper/BlocklistManager.swift`
- [Network monitor service](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/NetMonitor.swift): `Sources/Helper/NetMonitor.swift`
- [Insights storage](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/InsightsStore.swift): `Sources/Helper/InsightsStore.swift`

### Traffic enforcement

- [DNS proxy](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/DNSProxy.swift): `Sources/Helper/DNSProxy.swift`
- [pf enforcement](https://github.com/isaaclins/freesnitch/blob/main/Sources/Helper/PFManager.swift): `Sources/Helper/PFManager.swift`
- [Per-process filter](https://github.com/isaaclins/freesnitch/blob/main/Sources/NetExt/FilterDataProvider.swift): `Sources/NetExt/FilterDataProvider.swift`

### Shared interfaces

- [Policy snapshot bridge](https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/SharedRuleBridge.swift): `Sources/Shared/SharedRuleBridge.swift`
- [XPC connection](https://github.com/isaaclins/freesnitch/blob/main/Sources/Shared/IPCConnection.swift): `Sources/Shared/IPCConnection.swift`
- [Profile client](https://github.com/isaaclins/freesnitch/blob/main/Sources/GUI/ViewModels/ProfileClient.swift): `Sources/GUI/ViewModels/ProfileClient.swift`

### CLI operations

- [CLI commands](https://github.com/isaaclins/freesnitch/blob/main/Sources/CLI/CLIRunner.swift): `Sources/CLI/CLIRunner.swift`
- [CLI helper client](https://github.com/isaaclins/freesnitch/blob/main/Sources/CLI/CLIHelperClient.swift): `Sources/CLI/CLIHelperClient.swift`

### Other components

- **Mac user**
- **macOS networking**

## Connections

- Mac user → App state and navigation: uses (evidence: `README.md`)
- App state and navigation → Privileged helper: requests policy
- Rules and blocklists UI → App state and navigation: edits rules (evidence: `Sources/GUI/Views/RulesManager.swift`)
- Profiles UI → Profile client: manages profiles
- Profile client → Privileged helper: sends commands
- App state and navigation → Connection monitor: shows connections
- App state and navigation → Window and alerts: publishes alerts (evidence: `Sources/GUI/App/WindowManager.swift`)
- App state and navigation → Insights and map: presents insights (evidence: `README.md`)
- App state and navigation → Extension lifecycle: manages extension (evidence: `Sources/GUI/App/SystemExtensionManager.swift`)
- Extension lifecycle → XPC connection: registers IPC (evidence: `Sources/GUI/App/SystemExtensionManager.swift`)
- CLI commands → CLI helper client: invokes commands (evidence: `Sources/CLI/CLIRunner.swift`)
- CLI helper client → Privileged helper: sends requests (evidence: `Sources/CLI/CLIHelperClient.swift`)
- Privileged helper → Rule and policy store: reads and writes (evidence: `Sources/Helper/HelperService.swift`)
- Privileged helper → DNS proxy: controls proxy (evidence: `Sources/Helper/HelperService.swift`)
- Privileged helper → pf enforcement: controls enforcement (evidence: `Sources/Helper/HelperService.swift`)
- Privileged helper → Network monitor service: starts monitoring (evidence: `Sources/Helper/HelperService.swift`)
- Privileged helper → Insights storage: records insights (evidence: `Sources/Helper/HelperService.swift`)
- Privileged helper → Blocklist manager: manages lists (evidence: `Sources/Helper/HelperService.swift`)
- Privileged helper → Policy snapshot bridge: publishes policy (evidence: `Sources/Helper/HelperService.swift`)
- Privileged helper → XPC connection: serves clients
- DNS proxy → Rule matcher: checks rules (evidence: `Sources/Helper/DNSProxy.swift`)
- Per-process filter → Rule matcher: checks rules (evidence: `Sources/NetExt/FilterDataProvider.swift`)
- Per-process filter → Policy snapshot bridge: receives snapshots (evidence: `Sources/NetExt/FilterDataProvider.swift`)
- Per-process filter → macOS networking: filters traffic (evidence: `README.md`)
- DNS proxy → macOS networking: handles DNS (evidence: `README.md`)
- pf enforcement → macOS networking: enforces rules (evidence: `README.md`)
- Blocklist manager → Rule and policy store: reads and updates (evidence: `Sources/Helper/BlocklistManager.swift`)
- Network monitor service → Rule and policy store: stores connections
- Insights storage → App state and navigation: supplies summaries
- XPC connection → Policy snapshot bridge: transports snapshots (evidence: `Sources/Shared/IPCConnection.swift`)
