Skip to content

techsavvyash/vync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Vync

License: MIT

Vync - Obsidian to Google Drive Sync

A local-first Obsidian plugin for seamless vault synchronization with Google Drive. Direct integration, no server required, complete privacy and control.

✨ Features

  • πŸ”„ Bi-directional Sync - Upload and download files between Obsidian and Google Drive
  • πŸ“ Folder Preservation - Maintains complete directory hierarchy in Google Drive
  • ⚑ Real-time Updates - Files sync immediately on creation or modification
  • πŸ” OAuth 2.0 Auth - Secure Google Drive authentication directly from plugin
  • πŸ’» Local-First - No external server required, runs entirely in Obsidian
  • πŸ” Smart Sync - Intelligent change detection and conflict resolution
  • πŸ—‘οΈ Tombstone Management - Proper deletion tracking with grace periods
  • πŸ”„ File Rename Detection - Handles file and folder renames efficiently

πŸš€ Quick Start

1. Install Plugin

Option A: From Obsidian Community Plugins

  1. Open Obsidian Settings β†’ Community Plugins
  2. Search for "Vync"
  3. Click Install
  4. Enable the plugin

Option B: Quick Install from Latest Release (Recommended)

Use the installer script to automatically download and install from the latest GitHub release:

# Using npx (Node.js)
npx @techsavvyash/vync-installer /path/to/your/vault

# Using bunx (Bun)
bunx @techsavvyash/vync-installer /path/to/your/vault

Examples:

# Linux/macOS
npx @techsavvyash/vync-installer ~/Documents/MyVault

# Windows
npx @techsavvyash/vync-installer "C:\Users\YourName\Documents\MyVault"

The installer will:

  • Fetch the latest release from GitHub
  • Download main.js, manifest.json, and styles.css
  • Install them to .obsidian/plugins/vync/ in your vault

Option C: Manual Installation

# Clone and build
git clone <repository-url>
cd vync
bun install

# Build the plugin
cd packages/plugin
bun run build

# Copy to your vault's plugins folder
cp -r dist/* /path/to/your/vault/.obsidian/plugins/vync/

2. Configure Google Drive

  1. Open Vync settings in Obsidian
  2. Click "Authenticate with Google Drive"
  3. Complete OAuth flow
  4. Start syncing!

πŸ“– Detailed guide: See Quick Start Guide

πŸ“‹ Documentation

Getting Started

Features & Reference

Development

πŸ—οΈ Architecture

Vync is a local-first plugin that runs entirely within Obsidian:

vync/packages/plugin/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.ts                  # Plugin entry point
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ googleDriveAuth.ts   # OAuth authentication
β”‚   β”‚   β”œβ”€β”€ googleDriveService.ts# Google Drive API client
β”‚   β”‚   β”œβ”€β”€ syncService.ts       # Sync orchestration
β”‚   β”‚   β”œβ”€β”€ syncState.ts         # State management
β”‚   β”‚   β”œβ”€β”€ tombstoneManager.ts  # Deletion tracking
β”‚   β”‚   β”œβ”€β”€ vaultWatcher.ts      # File change detection
β”‚   β”‚   └── conflictUI.ts        # Conflict resolution UI
β”‚   └── types.ts                 # TypeScript definitions
β”œβ”€β”€ tests/                       # Unit tests
└── manifest.json                # Plugin manifest

How It Works

  1. Direct Integration - Plugin communicates directly with Google Drive API
  2. Local State - Sync state stored in .obsidian/plugins/vync/
  3. OAuth Tokens - Encrypted and stored locally
  4. No Server - Zero external dependencies, completely private

πŸ”§ Configuration

Google Drive API Setup

  1. Create Google Cloud Project

  2. Configure OAuth Credentials

    • Create OAuth 2.0 Client ID (Desktop app type)
    • Download credentials JSON
    • Add to plugin settings

Plugin Settings (in Obsidian)

Settings β†’ Vync:
β”œβ”€β”€ Google OAuth
β”‚   β”œβ”€β”€ Client ID: [from Google Cloud]
β”‚   β”œβ”€β”€ Client Secret: [from Google Cloud]
β”‚   └── Status: βœ“ Connected
β”œβ”€β”€ Sync Settings
β”‚   β”œβ”€β”€ Auto Sync: ON
β”‚   β”œβ”€β”€ Sync Interval: 5 minutes
β”‚   └── Conflict Resolution: Prompt
└── Advanced
    β”œβ”€β”€ Tombstone Grace Period: 30 days
    └── Debug Logging: OFF

πŸ“¦ Distribution

Publishing to Community Plugins

When ready to publish:

  1. Create Release Branch

    git checkout -b release/v1.0.0
    git push origin release/v1.0.0
  2. Automatic Release - GitHub Actions will:

    • Run tests
    • Build plugin
    • Create version tag
    • Create GitHub release
    • Attach main.js, manifest.json, styles.css
  3. Submit to Obsidian

Publishing the Installer to NPM

The installer package (@techsavvyash/vync-installer) can be published to NPM for easy installation via npx or bunx.

Prerequisites

  1. NPM Account - Create an account at npmjs.com

  2. NPM Token - Generate an automation token:

    • Go to npmjs.com β†’ Account Settings β†’ Access Tokens
    • Generate New Token β†’ Automation
    • Copy the token
  3. Add Token to GitHub Secrets

    • Go to GitHub Repository β†’ Settings β†’ Secrets and variables β†’ Actions
    • Add new secret: NPM_TOKEN with your token value

Publishing Steps

Option 1: Using GitHub Actions (Recommended)

  1. Go to Actions β†’ "Publish Installer to NPM"
  2. Click "Run workflow"
  3. Enter the version number (e.g., 0.0.2)
  4. Click "Run workflow"

The workflow will:

  • Update the version in package.json
  • Build the installer
  • Publish to NPM
  • Commit the version bump

Option 2: Manual Publishing

# Navigate to installer package
cd packages/installer

# Login to NPM (first time only)
npm login

# Update version
npm version 0.0.2

# Build
bun run build

# Publish
npm publish --access public

After Publishing

Users can install the plugin using:

npx @techsavvyash/vync-installer /path/to/vault

Note: It may take a few minutes for the package to be available on NPM after publishing.

πŸ“– Detailed Publishing Guide: See PUBLISHING.md for complete step-by-step instructions.

πŸ“Š How It Works

Sync Flow

  1. File Changed in Obsidian
  2. VaultWatcher Detects change event
  3. SyncService determines action (upload/download/conflict)
  4. Direct Upload/Download to/from Google Drive
  5. State Updated locally with revision IDs
  6. Folder Structure mirrored automatically

Smart Sync Features

Three-Way Comparison

  • Compares: Local file ↔ Last sync state ↔ Remote file
  • Uses revision IDs (not timestamps) for accuracy
  • Detects: unchanged, local-only, remote-only, conflicts

Tombstone Management

  • Tracks deletions with grace periods (default 30 days)
  • Syncs deletions across devices
  • Prevents accidental data loss

Conflict Resolution

  • Detects simultaneous changes on multiple devices
  • Presents user with resolution options
  • Preserves both versions if requested

πŸ” Security & Privacy

Local-First Design

  • βœ… No External Server - Direct vault-to-Google Drive sync
  • βœ… Local OAuth Tokens - Encrypted and stored in your vault
  • βœ… No Data Collection - Zero telemetry or analytics
  • βœ… Open Source - Fully auditable code
  • βœ… Standard APIs - Uses official Google Drive API only

Data Storage

.obsidian/plugins/vync/
β”œβ”€β”€ data.json           # Plugin settings (no secrets)
β”œβ”€β”€ sync-state.json     # Sync index (file hashes, IDs)
β”œβ”€β”€ tombstones.json     # Deletion tracking
└── .oauth-tokens.json  # Encrypted OAuth tokens (local only)

Note: OAuth tokens never leave your device and are encrypted at rest.

πŸ§ͺ Testing

Development

cd packages/plugin

# Run unit tests
bun test

# Run linter
bun run lint

# Build plugin
bun run build

# Watch mode
bun run dev

Plugin Commands (in Obsidian)

Cmd/Ctrl + P β†’ Search for:
β”œβ”€β”€ "Vync: Full Sync" - Sync entire vault
β”œβ”€β”€ "Vync: Sync Status" - View sync state
β”œβ”€β”€ "Vync: Resolve Conflicts" - Handle conflicts
└── "Vync: Clear Cache" - Reset sync state

Manual Testing

  1. File Sync - Create/edit files, verify in Drive
  2. Folder Sync - Create nested folders, check structure
  3. Renames - Rename files/folders, verify tracking
  4. Deletions - Delete files, check tombstones
  5. Conflicts - Edit same file on two devices simultaneously

πŸ› Troubleshooting

Common Issues

OAuth Authentication Failed

  • Verify Client ID and Secret are correct
  • Check OAuth consent screen is configured
  • Ensure "Desktop app" type is selected
  • Try removing and re-adding credentials

Files Not Syncing

  • Check sync status in plugin settings
  • Verify Google Drive has sufficient space
  • Look for conflicts in conflict resolution UI
  • Check Obsidian Developer Console (Cmd/Ctrl + Shift + I) for errors

Sync Conflicts

  • Use "Vync: Resolve Conflicts" command
  • Choose which version to keep
  • Or keep both versions with different names

Plugin Not Loading

  • Check .obsidian/plugins/vync/ exists
  • Verify manifest.json, main.js, styles.css are present
  • Enable plugin in Settings β†’ Community Plugins
  • Check Obsidian console for error messages

πŸ“– More help: Open an issue

πŸ“ˆ Roadmap

v1.1 (Next Release)

  • Delta sync for large files
  • Selective sync (exclude patterns)
  • Bandwidth optimization
  • Sync statistics dashboard

v1.2 (Future)

  • Mobile app support (iOS/Android)
  • Alternative backends (Dropbox, OneDrive)
  • End-to-end encryption option
  • Shared vault collaboration

v2.0 (Long Term)

  • Multi-device conflict resolution UI
  • Advanced sync rules engine
  • Plugin marketplace integration
  • Automated backups and versioning

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create feature branch
  3. Make changes
  4. Add tests
  5. Update documentation
  6. Submit PR

πŸ“ License

MIT License - see LICENSE file

πŸ™ Acknowledgments

Built with:

πŸ’¬ Support

⭐ Star History

If this project helps you, consider giving it a star!


Status: Beta Testing 🚧

Quick Start | Documentation | Architecture | Contributing

About

Sync your obsidian vaults using G-Drive

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors