# duckduckgo/macos-browser architecture

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

- Interactive diagram: https://gitdiagram.com/duckduckgo/macos-browser
- Repository: https://github.com/duckduckgo/macos-browser

## Overview

This repository is the DuckDuckGo macOS browser. Its broad user workflow is browsing pages in tabs, with privacy protections and browser features such as bookmarks, downloads, and tab cleanup; it also includes data import/export, AI Chat, and Data Broker Protection. The tree establishes these product areas, but most implementation files were not sampled, so the graph avoids asserting their internal wiring. The sampled code does show drag-and-drop managers dispatching mutations and the Data Broker Protection operation manager invoking scan/opt-out runners and recording state.

Main entry points: [`DuckDuckGo/ContentBlocker/ContentBlocking.swift`](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/ContentBlocker/ContentBlocking.swift) (Web content), [`LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift`](https://github.com/duckduckgo/macos-browser/blob/main/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift) (Profile operations), [`DuckDuckGo/Bookmarks/Model/BookmarkManager.swift`](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Bookmarks/Model/BookmarkManager.swift) (Bookmarks), [`DuckDuckGo/Application/Application.swift`](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Application/Application.swift) (Application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Browser shell"]
  node_application["Application<br/>[Application.swift]"]
  node_tabs["Tab management"]
  node_preview["Tab preview"]
end

subgraph group_browse["Browsing and privacy"]
  node_web["Web content"]
  node_blocking["Tracker blocking"]
  node_autoconsent["Consent handling"]
  node_fire["Fire cleanup<br/>[Fire.swift]"]
end

subgraph group_organize["Browser data"]
  node_bookmarks["Bookmarks"]
  node_bookmarkstore[("Bookmark storage")]
  node_bookmarkdrag["Bookmark drag-drop"]
  node_import["Data import"]
  node_export["Data export"]
  node_downloads["Downloads"]
end

subgraph group_services["Additional features"]
  node_aichat["AI Chat"]
  node_dbp["Broker protection"]
  node_dbpops["Profile operations"]
  node_brokerdb[("Protection state")]
  node_runner["Scan opt-out runner"]
end

node_user(("Browser user"))
node_broker(("Data brokers"))

node_user -->|"uses"| node_application
node_application -->|"manages tabs"| node_tabs
node_tabs -->|"shows preview"| node_preview
node_user -->|"browses"| node_web
node_web -->|"applies rules"| node_blocking
node_web -.->|"handles consent"| node_autoconsent
node_user -->|"organizes pages"| node_bookmarks
node_bookmarkdrag -->|"moves items"| node_bookmarks
node_bookmarks -->|"persists bookmarks"| node_bookmarkstore
node_user -->|"imports data"| node_import
node_user -->|"exports bookmarks"| node_export
node_user -->|"downloads files"| node_downloads
node_user -->|"clears browsing data"| node_fire
node_user -->|"opens assistant"| node_aichat
node_user -->|"uses protection"| node_dbp
node_dbp -->|"schedules operations"| node_dbpops
node_dbpops -->|"runs scan or opt-out"| node_runner
node_dbpops -->|"records state"| node_brokerdb
node_broker -->|"provides profiles"| node_runner

click node_application "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Application/Application.swift"
click node_tabs "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/TabBar/View/TabDragAndDropManager.swift"
click node_preview "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/TabPreview/TabPreviewWindowController.swift"
click node_web "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/ContentBlocker/ContentBlocking.swift"
click node_blocking "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift"
click node_autoconsent "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Autoconsent/AutoconsentManagement.swift"
click node_fire "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Fire/Model/Fire.swift"
click node_bookmarks "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Bookmarks/Model/BookmarkManager.swift"
click node_bookmarkstore "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Bookmarks/Services/LocalBookmarkStore.swift"
click node_bookmarkdrag "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Bookmarks/Model/BookmarkDragDropManager.swift"
click node_import "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/DataImport/DataImportExtension.swift"
click node_export "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/DataExport/BookmarksExporter.swift"
click node_downloads "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/FileDownload/Model/FileDownloadManager.swift"
click node_aichat "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/AIChat/UserScript/AIChatUserScript.swift"
click node_dbp "https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/DBP/DataBrokerProtectionManager.swift"
click node_dbpops "https://github.com/duckduckgo/macos-browser/blob/main/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift"
click node_brokerdb "https://github.com/duckduckgo/macos-browser/blob/main/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift"
click node_runner "https://github.com/duckduckgo/macos-browser/blob/main/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.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_application,node_tabs,node_preview,node_user toneBlue
class node_web,node_blocking,node_autoconsent,node_fire toneAmber
class node_bookmarks,node_bookmarkstore,node_bookmarkdrag,node_import,node_export,node_downloads toneMint
class node_aichat,node_dbp,node_dbpops,node_brokerdb,node_runner toneRose
class node_broker toneIndigo
```

## Components

### Browser shell

- [Application](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Application/Application.swift): `DuckDuckGo/Application/Application.swift`
- [Tab management](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/TabBar/View/TabDragAndDropManager.swift): `DuckDuckGo/TabBar/View/TabDragAndDropManager.swift`
- [Tab preview](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/TabPreview/TabPreviewWindowController.swift): `DuckDuckGo/TabPreview/TabPreviewWindowController.swift`

### Browsing and privacy

- [Web content](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/ContentBlocker/ContentBlocking.swift): `DuckDuckGo/ContentBlocker/ContentBlocking.swift`
- [Tracker blocking](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift): `DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift`
- [Consent handling](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Autoconsent/AutoconsentManagement.swift): `DuckDuckGo/Autoconsent/AutoconsentManagement.swift`
- [Fire cleanup](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Fire/Model/Fire.swift): `DuckDuckGo/Fire/Model/Fire.swift`

### Browser data

- [Bookmarks](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Bookmarks/Model/BookmarkManager.swift): `DuckDuckGo/Bookmarks/Model/BookmarkManager.swift`
- [Bookmark storage](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Bookmarks/Services/LocalBookmarkStore.swift): `DuckDuckGo/Bookmarks/Services/LocalBookmarkStore.swift`
- [Bookmark drag-drop](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/Bookmarks/Model/BookmarkDragDropManager.swift): `DuckDuckGo/Bookmarks/Model/BookmarkDragDropManager.swift`
- [Data import](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/DataImport/DataImportExtension.swift): `DuckDuckGo/DataImport/DataImportExtension.swift`
- [Data export](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/DataExport/BookmarksExporter.swift): `DuckDuckGo/DataExport/BookmarksExporter.swift`
- [Downloads](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/FileDownload/Model/FileDownloadManager.swift): `DuckDuckGo/FileDownload/Model/FileDownloadManager.swift`

### Additional features

- [AI Chat](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/AIChat/UserScript/AIChatUserScript.swift): `DuckDuckGo/AIChat/UserScript/AIChatUserScript.swift`
- [Broker protection](https://github.com/duckduckgo/macos-browser/blob/main/DuckDuckGo/DBP/DataBrokerProtectionManager.swift): `DuckDuckGo/DBP/DataBrokerProtectionManager.swift`
- [Profile operations](https://github.com/duckduckgo/macos-browser/blob/main/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift): `LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift`
- [Protection state](https://github.com/duckduckgo/macos-browser/blob/main/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift): `LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift`
- [Scan opt-out runner](https://github.com/duckduckgo/macos-browser/blob/main/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift): `LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Shared/Operations/DataBrokerProfileQueryOperationManager.swift`

### Other components

- **Browser user**
- **Data brokers**

## Connections

- Browser user → Application: uses
- Application → Tab management: manages tabs
- Tab management → Tab preview: shows preview
- Browser user → Web content: browses
- Web content → Tracker blocking: applies rules
- Web content → Consent handling: handles consent
- Browser user → Bookmarks: organizes pages
- Bookmark drag-drop → Bookmarks: moves items
- Bookmarks → Bookmark storage: persists bookmarks
- Browser user → Data import: imports data
- Browser user → Data export: exports bookmarks
- Browser user → Downloads: downloads files
- Browser user → Fire cleanup: clears browsing data
- Browser user → AI Chat: opens assistant
- Browser user → Broker protection: uses protection
- Broker protection → Profile operations: schedules operations
- Profile operations → Scan opt-out runner: runs scan or opt-out
- Profile operations → Protection state: records state
- Data brokers → Scan opt-out runner: provides profiles
