How zhom/donutbrowser works
Purpose and Top-Level Shape
Donut Browser is a cross-platform, anti-detect desktop browser. It manages isolated browser profiles with fingerprints, cookies, extensions, networking, and optional encrypted cloud synchronization. The product is a Tauri desktop application: a React/Next renderer drives a Rust native backend that launches and controls the Wayfern Chromium fork.
Key entry points:
• Web renderer: src/app/layout.tsx, src/app/page.tsx
• Tauri application/bootstrap: src-tauri/src/main.rs, src-tauri/src/lib.rs
• Tauri packaging/runtime configuration: src-tauri/tauri.conf.json
Renderer and Desktop IPC Boundary
The TypeScript UI provides profile management, networking setup, browser download/setup, sync, account, settings, and onboarding flows. Hooks centralize client-side state and backend event subscriptions; dialogs and tables are the principal interaction layer.
• Application shell: src/app/layout.tsx, src/components/client-providers.tsx
• Profile-centric UI: src/components/profile-data-table.tsx, src/components/create-profile-dialog.tsx
• Backend-facing state/hooks: src/hooks/use-browser-state.ts, src/hooks/use-profile-events.ts, src/hooks/use-sync-session.ts
The Tauri boundary separates untrusted renderer interactions from native filesystem, process, browser, proxy, and credential operations implemented in Rust.
Native Application and Browser Lifecycle
Rust owns native lifecycle and operating-system integration: app directories, settings, browser binary download/version management, browser process startup, default-browser behavior, updater flows, and event emission. It runs the configured Wayfern/Chromium engine rather than embedding browser logic in the renderer.
• Native composition and commands: src-tauri/src/lib.rs, src-tauri/src/main.rs
• Browser execution/versioning: src-tauri/src/browser_runner.rs, src-tauri/src/browser_version_manager.rs
• Wayfern integration: src-tauri/src/wayfern_manager.rs, src-tauri/src/wayfern_terms.rs
Profile Isolation and Identity Data
Profiles are the core domain boundary. The backend manages per-profile storage, fingerprint consistency, passwords/encryption, clear-on-close behavior, imports, groups, cookies, extensions, and tags. A launched browser receives the selected profile’s persisted data and networking/fingerprint configuration.
• Profile model/storage and lifecycle: src-tauri/src/profile/manager.rs, src-tauri/src/profile/types.rs
• Fingerprint and imports: src-tauri/src/fingerprint_consistency.rs, src-tauri/src/profile_importer.rs
• Related identity assets: src-tauri/src/cookie_manager.rs, src-tauri/src/extension_manager.rs
Network Routing and Privacy Services
Per-profile traffic can be routed through assigned HTTP(S)/SOCKS proxies or WireGuard VPN configuration. The native side manages proxy processes/storage and local SOCKS services; DNS blocklist support is another profile-oriented privacy control. Xray binaries/workers provide additional proxy execution support.
• Proxy orchestration/storage: src-tauri/src/proxy_manager.rs, src-tauri/src/proxy_runner.rs, src-tauri/src/proxy_storage.rs
• VPN/WireGuard and SOCKS: src-tauri/src/vpn/mod.rs, src-tauri/src/vpn/wireguard.rs, src-tauri/src/vpn/socks5_server.rs
• DNS/Xray support: src-tauri/src/dns_blocklist.rs, src-tauri/src/xray/
Sync and Self-Hosted Service
The desktop sync engine exchanges profiles, proxies, and groups with a sync HTTP service. Sync has manifest, scheduling, subscription, client, and optional encryption layers; it is distinct from local profile persistence. The separately deployable donut-sync NestJS service authenticates requests and exposes external and internal sync endpoints, with Docker deployment support.
• Desktop sync engine: src-tauri/src/sync/engine.rs, src-tauri/src/sync/client.rs, src-tauri/src/sync/encryption.rs
• Sync server bootstrap/API: donut-sync/src/main.ts, donut-sync/src/sync/sync.controller.ts, donut-sync/src/sync/sync.service.ts
• Service auth/deployment: donut-sync/src/auth/auth.guard.ts, donut-sync/Dockerfile
Automation, Local APIs, and Integrations
The native backend exposes local REST and MCP integration surfaces for external automation tools. It also includes browser daemon/proxy-server binaries and remote-session support, making automation an explicit native integration boundary rather than a UI feature.
• Local API endpoints: src-tauri/src/api_server.rs, src-tauri/src/api_client.rs
• MCP server/integrations: src-tauri/src/mcp_server.rs, src-tauri/src/mcp_integrations.rs
• Supporting processes: src-tauri/src/bin/proxy_server.rs, src-tauri/src/remote_session.rs
Runtimes and Delivery
The desktop product combines Node/React/Next/Tailwind in the renderer, Rust/Tauri for native execution, and Wayfern Chromium plus proxy/VPN helper binaries. The self-hosted sync service is Node/NestJS and Docker-ready. Tauri configuration and platform manifests target macOS, Windows, Linux, Android, and iOS assets/capabilities.
• Workspace/runtime definitions: package.json, src-tauri/Cargo.toml, donut-sync/package.json
• Native capabilities and packaging: src-tauri/capabilities/default.json, src-tauri/tauri.conf.json
• Browser/proxy binary acquisition: src-tauri/download-xray.mjs, src-tauri/copy-proxy-binary.mjs
Main entry points: lib.rs Tauri command host · manager.rs Profile manager · browser_runner.rs Browser runner · engine.rs Desktop sync engine
Components 20
React Renderer
Desktop UI and client-side state.
- App shell
src/app/layout.tsx - Profile UI · Profile tables and creation dialogs.
src/components/profile-data-table.tsx - Backend state hooks · Subscribes to native state, profile events, and sync sessions.
src/hooks/use-browser-state.ts
Tauri Native Backend
Trusted OS, profile, browser, and network operations.
- Tauri command host · Composes commands, lifecycle, and native integrations.
src-tauri/src/lib.rs - Profile manager · Owns profile lifecycle and persisted isolation data.
src-tauri/src/profile/manager.rs - Identity assets · Cookies and extensions associated with profiles.
src-tauri/src/cookie_manager.rs - Fingerprint and import · Maintains fingerprint consistency and imports profiles.
src-tauri/src/fingerprint_consistency.rs - Browser runner · Launches the selected profile in the browser engine.
src-tauri/src/browser_runner.rs - Browser version manager · Downloads and manages browser binaries.
src-tauri/src/browser_version_manager.rs - Proxy stack · Stores, configures, and runs profile proxy processes.
src-tauri/src/proxy_manager.rs - VPN and SOCKS · WireGuard and local SOCKS routing services.
src-tauri/src/vpn/wireguard.rs - DNS and Xray · DNS blocklist and additional proxy execution support.
src-tauri/src/dns_blocklist.rs - Desktop sync engine · Schedules encrypted synchronization of profiles, proxies, and groups.
src-tauri/src/sync/engine.rs - Local automation API · Integration surface for external automation tools.
src-tauri/src/api_server.rs - Remote sessions · Supports browser daemon and remote-session workflows.
src-tauri/src/remote_session.rs
Sync Service
Separately deployable NestJS synchronization API.
- Sync API · Authenticated external and internal synchronization endpoints.
donut-sync/src/sync/sync.controller.ts - Sync service · Applies synchronization operations for desktop clients.
donut-sync/src/sync/sync.service.ts - Service authentication
donut-sync/src/auth/auth.guard.ts - Docker deployment · Packages the self-hosted sync service.
donut-sync/Dockerfile
Other components
- Wayfern Chromium · External Chromium fork executed by the native host.
src-tauri/src/wayfern_manager.rs
Connections 25
- App shell → Profile UI: hosts
- App shell → Backend state hooks: provides state
- Profile UI → Backend state hooks: uses
- Backend state hooks → Tauri command host: Tauri IPC
- Tauri command host → Profile manager: manages
- Profile manager → Identity assets: persists
- Profile manager → Fingerprint and import: configures
- Tauri command host → Browser runner: launches
- Browser runner → Profile manager: loads profile
- Browser runner → Wayfern Chromium: executes
- Browser version manager → Wayfern Chromium: provisions
- Tauri command host → Browser version manager: manages
- Browser runner → Proxy stack: applies routing
- Browser runner → VPN and SOCKS: applies routing
- Proxy stack → DNS and Xray: uses helpers
- Tauri command host → Desktop sync engine: runs
- Desktop sync engine → Profile manager: syncs profiles
- Desktop sync engine → Proxy stack: syncs proxies
- Desktop sync engine → Sync API: HTTPS sync
- Sync API → Service authentication: authorizes
- Sync API → Sync service: delegates
- Docker deployment → Sync API: deploys
- Tauri command host → Local automation API: exposes
- Local automation API → Remote sessions: controls
- Local automation API → Profile manager: automates