R2 Sync
pendingby ehmad
Sync your notes to Cloudflare R2 with bidirectional backup and automatic sync.
R2 Sync Plugin for Obsidian
A powerful Obsidian plugin that syncs your notes to Cloudflare R2 with bidirectional backup and automatic sync capabilities.
Features
- š Automatic Sync: Sync files automatically when you save them
- š Bidirectional Sync: Download changes from R2 and merge with local files
- āļø Manual Controls: Manual sync and connectivity testing
- š Status Bar: Real-time sync status and last sync time
- š Secure: Uses your own R2 credentials
- š Folder Support: Sync specific folders or entire vault
- š Notifications: Toast notifications for sync events
Installation
Development Setup
-
Clone this repository
-
Install dependencies:
npm install -
Build the plugin:
npm run build -
Copy the generated files to your Obsidian vault:
<Vault>/.obsidian/plugins/r2sync/ āāā main.js āāā manifest.json āāā styles.css -
Enable the plugin in Obsidian: Settings ā Community plugins ā R2 Sync
Configuration
R2 Setup
-
Create R2 Bucket:
- Go to Cloudflare Dashboard ā R2 Object Storage
- Create a new bucket
- Note your Account ID
-
Create API Token:
- Go to Cloudflare Dashboard ā My Profile ā API Tokens
- Create a custom token with R2 permissions
- Note your Access Key ID and Secret Access Key
-
Configure Plugin:
- Open Obsidian Settings ā Community plugins ā R2 Sync
- Enter your R2 credentials:
- Account ID
- Access Key ID
- Secret Access Key
- Bucket Name
- Region (usually "auto")
Sync Settings
- Base Folder: Specify a folder to sync (leave empty for entire vault)
- Auto Sync on Save: Automatically sync when files are saved
- Bidirectional Sync: Download and merge remote changes
Usage
Commands
The plugin provides several commands accessible via the Command Palette (Ctrl/Cmd + P):
- Sync to R2: Manually sync all files to R2
- Download from R2: Download and merge remote changes
- Test R2 Connection: Test your R2 configuration
- Sync Current File to R2: Sync only the currently open file
Status Bar
The status bar shows:
- š "R2 Sync in progress..." when syncing
- ā "R2 Last sync: X minutes ago" with last sync time
- š "R2 Sync ready" when ready
Settings Tab
Access all configuration options in: Settings ā Community plugins ā R2 Sync
Security & Privacy
- All data is stored in your own R2 bucket
- No data is sent to third parties
- Credentials are stored locally in Obsidian
- The plugin only accesses files within your vault
Troubleshooting
Connection Issues
- Test Connection: Use the "Test R2 Connection" button in settings
- Check Credentials: Verify your R2 credentials are correct
- Check Bucket: Ensure the bucket exists and is accessible
- Check Permissions: Ensure your API token has R2 read/write permissions
Sync Issues
- Check Status Bar: Look for error messages in the status bar
- Check Notifications: Look for toast notifications with error details
- Manual Sync: Try manual sync to see specific error messages
- Check Logs: Open Developer Console (Ctrl/Cmd + Shift + I) for detailed logs
Performance
- Large vaults may take time to sync initially
- The plugin syncs files incrementally after the first sync
- Consider using a specific folder instead of the entire vault for better performance
Development
Project Structure
src/
āāā settings.ts # Settings interface and defaults
āāā r2Service.ts # R2 API service
āāā syncManager.ts # Sync logic and file management
āāā statusBar.ts # Status bar component
āāā commands.ts # Command definitions
āāā settingsTab.ts # Settings UI
Building
# Development (watch mode)
npm run dev
# Production build
npm run build
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Support
For issues and feature requests, please create an issue on the GitHub repository.
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.