ShareThing is a privacy-first peer-to-peer file sharing client split into a Flutter UI and platform-specific libp2p nodes.
ui/- Flutter UI, persistent state, and process orchestration
- stores config and local friend data as JSON files
- does not perform peer discovery, transport negotiation, or file byte streaming
engine/- legacy Kotlin JVM desktop node source
- communicates with Flutter over newline-delimited JSON on stdin/stdout
p2pbridge/- Go libp2p implementation used by Android and desktop
- exposes the shared node runtime plus a native desktop executable
Flutter sends newline-delimited JSON commands to the node layer. The primary command types are:
START_NODESTOP_NODESEND_FILEACCEPT_FILEREJECT_FILE
The node emits JSON events back to Flutter. The primary event types are:
NODE_STARTEDPEER_DISCOVEREDPEER_NICKNAME_CHANGEDINCOMING_FILE_REQUESTTRANSFER_UPDATE
Client data is stored in platform-appropriate application directories:
- Linux
- config:
~/.config/sharething/ - data:
~/.local/share/sharething/
- config:
- Windows
- config:
%APPDATA%\\ShareThing\\ - data:
%LOCALAPPDATA%\\ShareThing\\
- config:
- macOS
~/Library/Application Support/ShareThing/
- Android
- app-specific support/data directories
- Desktop node startup and identity persistence are wired.
- Flutter friend/config storage is file-backed JSON.
- Dart-side LAN networking and Dart-side file streaming were removed to restore the intended architecture boundary.
SEND_FILE,ACCEPT_FILE, andREJECT_FILEare part of the shared contract, but full node-side transfer handling is not implemented yet.
cd p2pbridge
./build.shUse fvm:
cd ui
fvm flutter analyze
fvm flutter test
fvm flutter build linuxAndroid does not support JVM-based libp2p, so a separate Go bridge is used instead. This must be built once and copied into the Flutter project before running on Android.
Download and install Go from https://go.dev/dl/ (1.21 or newer). go get github.com/libp2p/go-libp2p@v0.38.1
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile initcd p2pbridge
gomobile bind -target android/arm64 -androidapi 21 -o p2p.aar .This produces two files: p2p.aar and p2p-sources.jar.
cp p2p.aar ../ui/android/app/libs/
cp p2p-sources.jar ../ui/android/app/libs/The desktop app now launches a native Go executable from ui/assets/engine/.
Development builds look for p2pbridge/build/p2p_engine[.exe] first, then fall back
to the bundled Flutter asset.
The desktop engine should always be built with CGO_ENABLED=0 so the resulting binary
is statically linked and can replace the previous jar-based package cleanly.