PortView is a cross-platform network connection monitoring application built with Tauri, Vue 3, and TypeScript. The application provides real-time visualization of system TCP/UDP connections, allowing users to monitor active network connections, associated processes, and perform actions like killing processes or opening process directories.
- Frontend: Vue 3 with TypeScript, using Composition API
- Backend: Rust with Tauri framework
- UI Framework: Native OS windows via Tauri
- Internationalization: Vue I18n with Chinese and English support
- Build Tool: Vite
The application follows a client-server architecture where:
- The frontend (Vue 3) provides the user interface and handles user interactions
- The backend (Rust) accesses system-level network information and process details
- Tauri bridges the frontend and backend, providing secure communication between JavaScript and Rust
- Real-time Network Monitoring: Displays active TCP/UDP connections with details like protocol, addresses, ports, and connection state
- Process Information: Shows associated process names, PIDs, and icons for each connection
- Process Management: Allows killing processes or opening their containing directories
- Filtering & Search: Filter connections by protocol, state, process name, or local port
- Auto-refresh: Automatic periodic updates of connection data
- Sorting: Sort table columns by clicking headers
- Dark/Light Theme: Support for system theme detection and manual theme switching
- Multi-language: Chinese and English localization
- Process Details Modal: Detailed view of process information including memory usage, CPU usage, and command line
- Node.js (with pnpm package manager)
- Rust and Cargo
- Tauri CLI
# Install dependencies
pnpm install
# Run in development mode
pnpm tauri dev
# Or separately:
pnpm dev # Frontend only (for web development)# Build the application
pnpm tauri build
# Alternative: Build frontend first, then Tauri
pnpm build
pnpm tauri buildpnpm dev: Start development serverpnpm build: Build frontend for productionpnpm preview: Preview production buildpnpm tauri: Run Tauri CLI commands
portview/
├── src/ # Vue 3 frontend source
│ ├── App.vue # Main application component
│ ├── main.ts # Application entry point
│ ├── i18n.ts # Internationalization setup
│ ├── components/ # Vue components
│ └── locales/ # Translation files
├── src-tauri/ # Rust backend source
│ ├── src/
│ │ └── lib.rs # Main Rust implementation
│ ├── Cargo.toml # Rust dependencies and scripts
│ └── tauri.conf.json # Tauri configuration
├── public/ # Static assets
├── index.html # HTML template
├── package.json # Node.js dependencies and scripts
├── vite.config.ts # Vite build configuration
└── tsconfig.json # TypeScript configuration
- Component-based architecture using Vue 3 Composition API
- TypeScript for type safety
- Internationalization using vue-i18n with JSON translation files
- Responsive design with CSS variables for theme support
- Event-driven communication between components
- Tauri commands for exposing Rust functionality to frontend
- Cross-platform network monitoring using
netstat2crate - Process information retrieval using
sysinfocrate - Platform-specific implementations for process icons
- Error handling with Result types
- Translation keys defined in
src/locales/zh-CN.jsonandsrc/locales/en-US.json - Language preference stored in localStorage
- Automatic system language detection
App.vue: Main application with connection management and UI controlsConnectionsTable: Displays network connections in a sortable tableMenuBar: Top menu with filtering, search, and theme controlsStatusBar: Shows connection statistics and refresh infoContextMenu: Right-click menu for process actionsProcessDetailsModal: Modal showing detailed process informationAboutDialog: About application dialog
get_connections: Retrieves all active network connectionsget_process_details: Gets detailed information for a specific processkill_process: Terminates a process by PIDopen_folder: Opens the directory containing a process executable
The application is designed to work across platforms:
- Windows: Full support with process icon extraction
- Linux: Network monitoring and process management
- macOS: Network monitoring and process management
Platform-specific features are handled through conditional compilation in Rust code.
- Tauri provides secure communication between frontend and backend
- Access to system-level information is restricted to backend Rust code
- Process management capabilities are limited to the current user's permissions
- CSP (Content Security Policy) is disabled in this configuration for development flexibility
While no explicit test files were found in the initial exploration, typical Tauri + Vue applications would include:
- Unit tests for Vue components
- Integration tests for Tauri commands
- End-to-end tests for the complete application flow
The Tauri build process creates native executables for each platform:
- Windows:
.exefile - macOS:
.appbundle - Linux: AppImage or deb/rpm packages depending on configuration
The application bundles both frontend assets and the Rust backend into a single executable.
The backend uses several key crates:
netstat2: For retrieving network socket informationsysinfo: For accessing system process informationtauri: For the framework integrationserde: For serialization/deserialization- Platform-specific crates for Windows (winapi) and macOS (tempfile)
The application supports both Chinese and English languages:
- Language files are located in
src/locales/ - Language preference is stored in localStorage
- Automatic detection of system language preference
- Vue I18n is used for translation management
The application supports both light and dark themes:
- Theme preference is stored in localStorage
- Automatic detection of system theme preference
- CSS variables are used for consistent theming across components
- Custom scrollbar styling for both themes
The application works with two main data structures:
TcpConnection: Represents a network connection with details like protocol, addresses, ports, state, and associated processProcessDetails: Contains detailed information about a process including memory usage, CPU usage, and command line
The application implements comprehensive error handling:
- Network connection errors are caught and displayed to the user
- Process operation errors (kill, open folder) are handled gracefully
- Notifications are shown for both success and failure cases
- Fallback mechanisms exist for missing process information
- Efficient data updates with change detection
- Filtering and sorting applied client-side for responsiveness
- Auto-refresh intervals are configurable to balance real-time updates with performance
- Memory-efficient data structures for large connection lists