Skip to content

iMrFu/cloudflare-sync

Repository files navigation

Cloudflare KV Sync

An Obsidian plugin that syncs notes via Cloudflare Workers KV storage. Designed for a mobile-to-PC workflow: capture notes on your phone, download and organize them on your computer.

⚠️ Important: Vault Name Must Match

Your Obsidian vault name must be the same on both mobile and PC. The plugin generates a vault ID from the vault name (SHA-256 hash, first 8 characters). If the names don't match, mobile uploads to one vault ID and PC downloads from a different one — sync will appear broken.

To check your vault name: look at the bottom-left corner of Obsidian, or check the folder name where your notes are stored.

Features

  • Mobile Upload: Automatically uploads new and modified notes from your phone to Cloudflare KV
  • PC Download: Downloads cloud content to your PC vault with automatic image localization
  • Incremental Sync: Only syncs changes, not the entire vault
  • AES-256-GCM Encryption: All data encrypted with a key derived from your API token
  • Auto Sync: Configurable automatic sync interval (5/10/15/30/60 minutes)
  • Silent Mode: Auto-sync runs silently without notifications; manual sync provides feedback
  • Image Localization: Network images in notes are automatically downloaded and referenced locally
  • Failed File Reporting: Shows which specific files failed to upload/download

Architecture

Mobile (Obsidian) --upload--> Cloudflare KV --download--> PC (Obsidian)
  • Cloudflare Worker: Backend API handling file upload, download, listing, and deletion
  • Obsidian Plugin: Client-side sync logic with device detection (mobile vs PC)

Setup

1. Deploy Cloudflare Worker

cd cloudflare-worker
npm install
# Edit wrangler.toml with your KV namespace
wrangler deploy

Set an API token in the Worker environment variable API_TOKEN, or pass it in the Authorization header.

2. Install Obsidian Plugin

Copy main.js, manifest.json, and styles.css to your vault's .obsidian/plugins/cloudflare-sync/ directory, or install via BRAT using the repository URL.

3. Configure

In Obsidian Settings → Cloudflare KV Sync:

  • Worker URL: Your deployed Cloudflare Worker URL
  • API Token: The API token you configured on the Worker
  • Vault Name: Make sure the same vault name is used on both mobile and PC!

Usage

  • Manual Sync: Use the ribbon icon or command palette → "Cloudflare Sync: Sync now"
  • Auto Sync: Enable in settings with your preferred interval
  • Force Upload/Download: Use the settings panel to force a full sync (ignores cache)

Tech Stack

  • Worker: Cloudflare Workers + KV, TypeScript
  • Plugin: Obsidian API, TypeScript, esbuild

Changelog

v1.0.1

  • Fixed: Upload/download failure now shows which specific files failed
  • Fixed: Error notifications now include file paths
  • Changed: Author updated to MrFu

v1.0.0

  • Initial release

License

MIT

About

Obsidian plugin to sync notes via Cloudflare KV - upload from mobile, download on PC with image localization

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors