$ show mihomo-party-org/clash-party
This is an Electron desktop application (branded 'Clash Party' / 'mihomo-party') that serves as a full-featured GUI manager for the Mihomo (Clash Meta) proxy core. It manages proxy subscriptions, profiles, rules, DNS, TUN, system proxy, connections, traffic logging, and provides both a standard mode and a simplified 'simple mode' for configuration. A standout feature is its custom plugin system (cpx-plugin/2) that enables third-party proxy providers to integrate via OAuth, Ed25519-signed discovery, and encrypted vault storage, with a reference gateway server included in the repository. The application also includes traffic usage analytics (SQLite database with multi-resolution aggregation), a smart core integration using LightGBM models for routing, and extensive platform-specific support (Windows, macOS, Linux, AUR packages). While primarily an application, it contains data engineering elements in its traffic recording and model download pipelines. The codebase is well-structured with extensive unit tests, reusable patterns (atomic writes, operation budgets, SSRF guards), and a large IPC surface. However, it has a very large feature surface, mixed-language comments, and some legacy build paths that increase maintenance complexity.
The LLM identified 5 files worth highlighting for reuse:
Provides atomic file write operations (atomicWriteFile, atomicWriteFileSync) using temp-file-and-rename pattern, and a WriteQueue/KeyedWriteQueue for serialized, abort-aware writes. This is a self-contained utility that can be extracted into any Node.js project needing safe concurrent file writes without corruption.
Implements network guard utilities to prevent SSRF and DNS rebinding attacks: isPrivateIp, isForbiddenHost, resolveAllPublicOrThrow, createGuardedLookup. Heavily tested with edge cases. Can be reused in any application that needs to validate outbound network requests against internal network targets.
Defines a generic operation framework with budget (AbortController + deadline), route failover policies, preflight SSRF guard, and staged metadata commit. Used for plugin operations but the pattern is reusable for any multi-step, cancellable, failover-aware operation in Node.js.
Wraps Electron's net module (Chromium stack) into a fetch-like API with proxy support, timeout, progress tracking, redirect handling, and abort. Used for downloading profiles, core updates, and Gist sync. Can be extracted as a standalone HTTP client for Electron apps needing proxy-aware requests.
Factory function that creates a React context provider for a config type, using SWR for data fetching and IPC event subscriptions for real-time updates. This pattern is reused for app config, core config, profile config, override config, and plugin config. It demonstrates a clean separation of state management and can be adapted for any Electron app with IPC-driven config state.