vdemeester/syncwagon

Synctrain for android.

★ 2Forks 0KotlinGitHub ↗Compare

README

Syncwagon

Overview

Syncwagon is an Android application that brings “browse-first, download-later” functionality to mobile devices, similar to Synctrain (Sushitrain). It allows users to browse files located on remote Syncthing peers without synchronizing entire directories, enabling on-demand downloading and selective synchronization.

Key Features

  • Browse-First Paradigm: View remote files without downloading them
  • On-Demand Downloads: Download files only when you need them
  • Selective Sync: Pin specific files/folders for permanent synchronization
  • Hybrid Architecture: Go core (Syncthing protocol) + Android UI (Jetpack Compose)
  • Native Performance: Leverages official Syncthing Go implementation via gomobile

Architecture

High-Level Components

  • Frontend (Android/Kotlin): Jetpack Compose UI, OS interactions, file I/O, service lifecycle
  • Backend (Go/Gomobile): Syncthing protocol implementation, compiled to AAR library
  • Communication: JNI/Gomobile bindings between Android and Go layers

Directory Structure

/
├── .github/           # GitHub workflows and CI configuration
├── app/               # Android application (Kotlin + Jetpack Compose)
│   └── src/
│       ├── main/      # Main application code
│       ├── test/      # Unit tests
│       └── androidTest/ # Instrumentation tests
├── core/              # Go module (Syncthing wrapper)
│   ├── syncwagon.go   # Core Go implementation
│   ├── go.mod         # Go module definition
│   └── go.sum         # Go dependency checksums
├── docs/              # Documentation
│   └── spec.org       # Technical specification
├── flake.nix          # Nix development environment
├── flake.lock         # Nix dependency lock file
└── todo.org           # Development roadmap and checklist

Prerequisites

Required Tools

  • Nix (with flakes enabled) - For reproducible development environment
  • direnv (optional but recommended) - Automatic environment activation

System Requirements

  • Linux or macOS (x86_64 or aarch64)
  • ~10GB disk space for dependencies
  • Internet connection for initial setup

Development Setup

Quick Start with Nix

  1. Clone the repository:
    git clone https://github.com/vdemeester/syncwagon.git
    cd syncwagon
        
  2. Enter the Nix development environment:
    nix develop
        

    Or, if using direnv:

    direnv allow
        
  3. The development environment provides:
    • Go 1.25.4
    • gomobile (installed automatically on first use)
    • JDK 17
    • Android SDK (API 33-34, NDK 26)
    • Gradle 8.14.3
    • Code formatters (gofmt, ktlint)
    • Pre-commit hooks (via git-hooks.nix)

Environment Details

The Nix flake (flake.nix) provides a fully reproducible development environment including:

  • Android SDK: Managed via tadfisher/android-nixpkgs
  • Pre-commit Hooks: Automatic code formatting via git-hooks.nix
    • Go: gofmt, govet
    • Kotlin: ktlint (when enabled)
    • Standard checks: trailing whitespace, end-of-file fixers

Building

Build Android APK

Debug Build

./gradlew assembleDebug

Output: app/build/outputs/apk/debug/app-debug.apk

Release Build

./gradlew assembleRelease

Output: app/build/outputs/apk/release/app-release-unsigned.apk

Build Go Core Module

cd core
go build -v ./...

Clean Build Artifacts

./gradlew clean

Testing

Run Go Tests

cd core
go test -v ./...

Run Android Unit Tests

./gradlew testDebugUnitTest

Run Android Instrumentation Tests

./gradlew connectedDebugAndroidTest

Note: Requires a connected Android device or emulator.

Code Quality

Pre-commit Hooks

Pre-commit hooks are automatically installed when you enter the Nix development environment. They run:

  • gofmt on Go code
  • govet on Go code

To manually run all pre-commit hooks:

git commit --dry-run

Manual Linting

Go Code

cd core
gofmt -l .      # List files that need formatting
go vet ./...    # Run static analysis

Kotlin Code

ktlint 'app/src/**/*.kt'

Android Lint

./gradlew lint

Reports: app/build/reports/lint-results.html

Project Status

Current Phase: Foundation (Phase 1)

✅ Completed:

  • Nix development environment with Android SDK
  • Project structure (Android + Go)
  • Basic Android app with Jetpack Compose
  • Gradle build configuration
  • GitHub Actions CI workflow
  • Pre-commit hooks

🚧 In Progress:

  • Go-Android bridge integration (gomobile)
  • Core Syncthing protocol implementation

📋 Planned:

  • File browser UI
  • On-demand download functionality
  • Selective sync (pinning)
  • Background service

See todo.org for detailed development roadmap.

Documentation

Contributing

This project follows a structured development approach:

  1. Read the spec: docs/spec.org contains the full technical specification
  2. Check the TODO: todo.org tracks current and planned work
  3. Development workflow:
    • Use nix develop for a consistent environment
    • Pre-commit hooks ensure code quality
    • CI runs on all pull requests
    • Sign your commits (git commit --signoff)

License

[License information to be added]

Acknowledgments

Contributors

vdemeester

Issues