Skip to content

open-source solution for real-time file monitoring and synchronization. Centralize file changes and trigger custom actions with modular plugins. Efficient, lightweight, and highly customizable for developers and automation enthusiasts

License

Notifications You must be signed in to change notification settings

felipepimentel/FileSyncHub

Repository files navigation

FileSyncHub

A file synchronization hub with support for Google Drive and OneDrive, written in Rust.

Features

  • Real-time file synchronization
  • Support for multiple cloud storage providers
  • Terminal user interface (TUI) for monitoring sync progress
  • Background service mode
  • Configurable file patterns and sync rules
  • Efficient chunked file uploads
  • Secure OAuth2 authentication

Installation

  1. Clone the repository:
git clone https://github.com/felipepimentel/FileSyncHub.git
cd FileSyncHub
  1. Build the project:
cargo build --release

Configuration

  1. Copy the example configuration file:
cp examples/config/example_config.toml config.toml
  1. Edit config.toml to set your sync directories and preferences.

  2. Set up cloud provider credentials:

Google Drive

  1. Go to the Google Cloud Console
  2. Create a new project
  3. Enable the Google Drive API
  4. Create OAuth 2.0 credentials
  5. Copy the example credentials file:
cp examples/credentials/google_drive_example.json credentials/google_drive.json
  1. Update the file with your credentials

OneDrive

  1. Go to the Microsoft Azure Portal
  2. Register a new application
  3. Add Microsoft Graph API permissions for Files.ReadWrite.All
  4. Copy the example credentials file:
cp examples/credentials/onedrive_example.json credentials/onedrive.json
  1. Update the file with your credentials

Running Examples

The project includes several examples demonstrating different features:

1. Basic Synchronization

Test basic file operations with Google Drive:

cargo run --example sync_with_google_drive

Test basic file operations with OneDrive:

cargo run --example sync_with_onedrive

2. Document Synchronization

Sync document files between local storage and cloud providers:

cargo run --example sync_documents

3. TUI Mode

Run with the terminal user interface to monitor sync progress:

cargo run --example sync_with_tui

4. Service Mode

Run as a background service:

cargo run --example run_as_service

Usage

Running as a Service

Start FileSyncHub as a background service:

filesynchub service start

Stop the service:

filesynchub service stop

Running with TUI

Start FileSyncHub with the terminal user interface:

filesynchub tui

Command Line Options

filesynchub [OPTIONS] [COMMAND]

Commands:
  service    Run as a background service
  tui        Run with terminal user interface
  help       Print help information

Options:
  -c, --config <FILE>    Configuration file path
  -v, --verbose          Enable verbose logging
  -h, --help            Print help information
  -V, --version         Print version information

Development

Running Tests

Run the test suite:

cargo test

Run tests with logging:

RUST_LOG=debug cargo test -- --nocapture

Building Documentation

Generate and view the documentation:

cargo doc --no-deps --open

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

open-source solution for real-time file monitoring and synchronization. Centralize file changes and trigger custom actions with modular plugins. Efficient, lightweight, and highly customizable for developers and automation enthusiasts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages