Privacy Radar is a comprehensive privacy monitoring application built with Electron, React, and TypeScript. It provides real-time network traffic analysis and system permission monitoring to help users understand and control their digital privacy.
Privacy Radar offers two main monitoring capabilities:
- Network Monitoring: Real-time packet capture and analysis with process attribution, geographic visualization, and detailed traffic statistics
- System Monitoring: Platform-specific permission tracking (macOS TCC, Linux hardware access, Windows Event Logs)
The application features a modern, accessible UI with both basic and advanced monitoring modes, dark mode support, and comprehensive data visualization.
- Real-time Packet Capture: Live network traffic capture from selected network interfaces
- Process Attribution: Automatically matches network packets to running processes and applications
- Traffic Analysis:
- Packet and byte statistics per application
- Protocol breakdown (TCP, UDP, IPv4, IPv6)
- Inbound/outbound traffic tracking
- Throughput calculations (bytes per second)
- Geographic Visualization: Interactive world map showing network connections with animated connection lines
- Application Insights: Detailed statistics for each application including:
- Total packets and bytes
- Unique remote IPs and domains
- Geographic locations of connections
- Interface-specific statistics
- Data Export: Export network data to Excel using custom SQL queries
- Interface Selection: Choose which network interfaces to monitor
- Visualizations:
- Line charts for data transfer rates over time
- Doughnut charts for inbound/outbound traffic distribution
- Permission Tracking (Platform-specific):
- macOS: TCC (Transparency, Consent, and Control) log monitoring for privacy permissions
- Linux: Hardware device access monitoring
- Windows: Event log monitoring (stub implementation)
- Active Sessions: Real-time tracking of applications currently using system resources
- Event History: Complete log of permission requests and usage events
- Service Types: Monitors various system services including:
- Camera, Microphone, Screen Capture
- Location, Contacts, Calendar
- File access (Documents, Downloads, Desktop)
- Full Disk Access, Accessibility, and more
- Dual View Modes: Switch between Network and System monitoring views
- Basic & Advanced Modes: Simplified view for casual users, detailed view for power users
- Dark Mode: Full dark mode support with theme persistence
- Color Accessibility: Colorblind-friendly color schemes
- Responsive Design: Modern UI built with Tailwind CSS and Framer Motion animations
- Settings Persistence: User preferences saved across sessions
- Electron
- ReactJS
- Tailwind CSS: Utility-first CSS framework
- Framer Motion: Animation library
- Chart.js: Data visualization charts
- D3.js: Geographic map visualizations
- Radix UI: Accessible UI components
- Lucide React: Icon library
- better-sqlite3: High-performance SQLite database
- Drizzle ORM: Type-safe database ORM
- cap: Packet capture library (libpcap wrapper)
- pino: Fast JSON logger
- Vite: Fast build tool and dev server
- electron-vite: Electron-specific Vite integration
- Vitest: Unit testing framework
- Playwright: End-to-end testing
- ESLint: Code linting
- Prettier: Code formatting
PrivacyRadar/
├── src/
│ ├── main/ # Electron main process
│ │ ├── app/ # Application lifecycle
│ │ │ ├── bootstrap.ts # App initialization
│ │ │ ├── lifecycle.ts # Lifecycle handlers
│ │ │ ├── window-manager.ts # Window management
│ │ │ └── analyzer-runner.ts # Network analyzer orchestration
│ │ ├── core/ # Core monitoring logic
│ │ │ ├── network/ # Network monitoring
│ │ │ │ ├── network-analyzer.ts # Main analyzer orchestrator
│ │ │ │ ├── traffic-capture.ts # Packet capture
│ │ │ │ ├── process-tracker.ts # Process monitoring
│ │ │ │ ├── connection-tracker.ts # Network connection tracking
│ │ │ │ ├── proc-con-manager.ts # Process-connection matching
│ │ │ │ ├── registry-manager.ts # Data aggregation
│ │ │ │ ├── packet-decoder.ts # Packet parsing
│ │ │ │ ├── geo-location.ts # IP geolocation
│ │ │ │ └── db-writer.ts # Database persistence
│ │ │ └── system/ # System monitoring
│ │ │ ├── base-system-monitor.ts # Base interface
│ │ │ ├── darwin-tcc-monitor.ts # macOS TCC monitoring
│ │ │ ├── linux-system-monitor.ts # Linux monitoring
│ │ │ ├── windows-system-monitor.ts # Windows monitoring
│ │ │ └── system-monitor-factory.ts # Platform factory
│ │ ├── infrastructure/ # Infrastructure services
│ │ │ ├── db/ # Database setup and services
│ │ │ │ ├── schema.ts # Database schema definitions
│ │ │ │ ├── migrate.ts # Migration runner
│ │ │ │ └── services/ # Database services
│ │ │ └── logging/ # Logging infrastructure
│ │ ├── shared/ # Shared utilities
│ │ │ ├── interfaces/ # TypeScript interfaces
│ │ │ ├── lookups/ # Protocol/port lookups
│ │ │ └── utils/ # Utility functions
│ │ └── config/ # Configuration constants
│ ├── renderer/ # Electron renderer process (React app)
│ │ └── src/
│ │ ├── components/ # React components
│ │ │ ├── NetworkMonitor.tsx # Main network view
│ │ │ ├── BasicNetworkMonitor.tsx # Basic mode
│ │ │ ├── AdvancedNetworkMonitor.tsx # Advanced mode
│ │ │ ├── SystemMonitor.tsx # System monitoring view
│ │ │ ├── Visualization.tsx # Charts and graphs
│ │ │ ├── GlobalMap.tsx # Geographic map
│ │ │ ├── ProcessList.tsx # Process listing
│ │ │ ├── ActivityList.tsx # Packet activity feed
│ │ │ ├── AppInsights.tsx # Application statistics
│ │ │ ├── ExportReports.tsx # Data export
│ │ │ └── ui/ # Reusable UI components
│ │ ├── lib/ # Client-side utilities
│ │ └── types.ts # TypeScript types
│ └── preload/ # Preload scripts (IPC bridge)
├── drizzle/ # Database migrations
├── tests/ # Test files
│ ├── unit/ # Unit tests
│ └── e2e/ # End-to-end tests
└── build/ # Build resources
- Packet Capture:
TrafficCapturecaptures raw packets from network interfaces - Packet Processing: Packets are decoded and matched to processes via
ProcConManager - Registry Aggregation:
RegistryManageraggregates data by process, application, and globally - Database Persistence: Snapshots are written to SQLite via
DBWriter - UI Updates: Data flows to React components via Electron IPC
- Visualization: Components render charts, maps, and lists in real-time
The application uses SQLite with the following main tables:
- settings: Application configuration and user preferences
- global_snapshots: Global network statistics over time
- application_snapshots: Per-application network statistics
- process_snapshots: Per-process network statistics
Each snapshot table includes:
- Timestamp information
- Packet and byte counts (total, IPv4/IPv6, TCP/UDP)
- Inbound/outbound traffic
- Protocol percentages
- Geographic location data (JSON)
- Unique remote IPs and domains (JSON)
- Interface statistics (JSON)
npm installThis will:
- Install all npm dependencies
- Rebuild native modules (better-sqlite3, cap) for your platform
- Set up Electron dependencies
npm run devThis starts the Electron app in development mode with hot reloading for both main and renderer processes.
# Type checking
npm run typecheck # Check both main and renderer
npm run typecheck:node # Check main process only
npm run typecheck:web # Check renderer process only
# Code quality
npm run lint # Run ESLint
npm run format # Format code with Prettier
npm run format:check # Check formatting without changes
# Renderer-only dev server (for UI development)
npm run dev:renderer# Run unit tests once
npm run test:unit
# Run in watch mode
npm run test:unit:watchUnit tests use Vitest and are located in tests/unit/.
# Install Playwright browsers (first time only)
npx playwright install --with-deps
# Run E2E tests
npm run test:e2e
# Run E2E tests in headed mode
npm run test:e2e:headedE2E tests use Playwright and are located in tests/e2e/. The test suite:
- Spins up a renderer-only Vite dev server
- Injects stubbed Electron APIs
- Tests the dashboard UI in a real browser
- Targets Chromium only (mirroring Electron's engine)
# Build for current platform
npm run build
# Build for specific platforms
npm run build:win # Windows
npm run build:mac # macOS
npm run build:linux # Linux
# Build unpacked directory (for testing)
npm run build:unpackBuild outputs are created in dist/ directory.
Build configuration is in electron-builder.yml:
- Windows: Creates NSIS installer with desktop shortcut
- macOS: Creates DMG with entitlements for system access
- Linux: Creates AppImage, Snap, and DEB packages
- Development:
.dev-data/dev.db(gitignored, safe for testing) - Production: User data directory (
app.getPath('userData')/data/app.db)
Database schema is defined in src/main/infrastructure/db/schema.ts. The schema includes:
settingstable for application configurationglobal_snapshotstable for global network statisticsapplication_snapshotstable for per-application statisticsprocess_snapshotstable for per-process statistics
Migrations are managed using Drizzle Kit and are automatically applied on application startup.
After modifying the schema in src/main/infrastructure/db/schema.ts:
# Generate a new migration
npm run db:generateThis creates a new SQL migration file in the drizzle/ directory.
Migrations are automatically applied when the application starts. For manual migration management:
# Push schema changes directly to database (dev only)
npm run db:push
# View and edit database in Drizzle Studio
npm run db:studio- Migration files are stored in
drizzle/ - They are committed to git for version control
- They are bundled with production builds in
extraResources - They are applied automatically on app startup
npm run db:studio- Open Drizzle Studio to browse and edit data visuallynpm run db:generate- Generate migrations from schema changesnpm run db:push- Push schema changes directly (dev only, skips migrations)
Network monitoring is supported on all platforms: macOS, Linux, Windows
System monitoring is platform-specific:
- macOS: Full TCC (Transparency, Consent, and Control) log monitoring
- Linux: Hardware device access monitoring
- Windows: Event log monitoring (stub implementation, limited support)