$ show pixelspark/sushitrain
Sushitrain is a native iOS and macOS file synchronization client that embeds the Syncthing P2P sync engine via a Go core exposed through gomobile bindings. The application provides selective synchronization (per-file pick via .stignore), on-demand file streaming, media preview, photo backup from the device camera roll, encrypted folders, and full Apple platform integration including Shortcuts, Handoff, Quick Actions, and background tasks. The architecture separates a SwiftUI frontend from a Go backend that manages Syncthing instance lifecycle, folder/device configuration, block-level downloading (MiniPuller), and local HTTP streaming servers. The codebase demonstrates solid engineering with clean module boundaries, reusable patterns like a pluggable custom filesystem for Syncthing, archive abstraction for ZIP/ISO browsing, and an event-driven UI update mechanism. However, there are signs of technical drift: heavy reliance on a forked Syncthing version with a pre-release pseudo-version, use of older Go libraries, and some duplicated or fragile code paths in the Swift layer (e.g., migration logic, iOS 26 API workarounds). Overall, it is a well-crafted application that fulfills its purpose effectively, though some internal coupling to Syncthing internals limits reusability of the Go components without adaptation.
The LLM identified 5 files worth highlighting for reuse:
Implements a block-level download engine (MiniPuller) that retrieves file blocks from peers with latency-aware ordering, configurable retries, and an LRU block cache. It is self-contained and could be extracted for any application requiring resilient, peer-to-peer block transfers, provided the peer interface is adapted.
Manages selective synchronization by parsing and generating .stignore files with a custom pattern format. It validates pattern strings and produces normalized ignore rules. The pattern-handling logic is isolated and could be reused for any system needing ignore/selection rules similar to .gitignore or .stignore.
Provides a common interface (ArchiveFile) for browsing and extracting contents from ZIP and ISO archives. Supports directory downloads with progress callbacks. The abstraction is clean and could be extended to support additional archive formats or reused in other projects needing unified archive access.
A thumbnail caching system with memory and disk tiers, folder-specific persistent caches, remote fetching from Syncthing peers, and a concurrency limiter implemented as an actor. The pattern is reusable for any app needing efficient, off-main-thread image thumbnail generation and caching, with minimal dependency on the rest of the application.
Defines a global registry for custom filesystem implementations that can be injected into Syncthing's file system layer. The interface is minimal (ReadDir, Open, Lstat, etc.) and allows new filesystem types (e.g., photo albums) to be added without modifying Syncthing core. This pattern is reusable for any project needing to extend a virtual filesystem with custom backends.