Self-Hosted Sync Guide

Daylogue runs fully offline by default. When you want incremental sync across phone and desktop, deploy open-source Daylogue-Sync on your own Cloudflare account so every note and media file stays under your control.


How it works

Daylogue-Sync runs entirely on Cloudflare primitives with no dedicated server to maintain and no third-party relay.

  • Cloudflare Workers Runs the Daylogue-Sync API and admin dashboard. The free tier comfortably covers daily personal incremental sync.
  • Cloudflare D1 Serverless SQLite database storing incremental changes for chats, journal pages, tasks, and bills.
  • Cloudflare R2 Object storage deduplicated by SHA-256 hash for photos and voice recordings, with zero egress fees.

Deploy to Cloudflare

Make sure Node.js 20+ is installed and you have a Cloudflare account ready. Setup takes about five minutes.

  1. 1. Clone the repository and install dependencies

    Fetch the Daylogue-Sync source and install build and Wrangler tooling.

    git clone https://github.com/gusibi/Daylogue-Sync.git
    cd Daylogue-Sync
    npm install
  2. 2. Log in and create D1 database and R2 bucket

    Authorize Wrangler and provision your database and media bucket. Creating D1 prints a database_id.

    npx wrangler login
    npx wrangler d1 create daylogue-sync
    npx wrangler r2 bucket create daylogue-blobs

    Open wrangler.toml at the project root and replace database_id with the value printed above:

    [[d1_databases]]
    binding = "DB"
    database_name = "daylogue-sync"
    database_id = "<paste database_id from previous step>"
    migrations_dir = "migrations"
  3. 3. Apply migrations, set secrets, and deploy

    ADMIN_KEY protects the web admin dashboard; SESSION_SECRET signs login cookies (use a 32+ character random string).

    npx wrangler d1 migrations apply daylogue-sync --remote
    npx wrangler secret put ADMIN_KEY
    npx wrangler secret put SESSION_SECRET
    npm run deploy

    After deployment, Cloudflare outputs your URL such as https://daylogue-sync.<your-subdomain>.workers.dev. You can also attach a custom domain in the Cloudflare dashboard.

  4. 4. Issue a Sync Token in the admin dashboard

    Open your deployed URL in a browser and sign in with your ADMIN_KEY. Create a new Sync Token starting with sync_ and copy it. You can inspect synced media, export JSON backups, or revoke any token at any time.

Want to test locally first?

Run the entire sync server against local SQLite without a Cloudflare account. Open http://localhost:8787 (default admin key admin123, sample token sync_local_dev_token_1234567890):

npm run db:migrate:local
npm run db:seed:local
npm run local

Connect Daylogue on your devices

On each phone or desktop running Daylogue, open Settings → Data → Data Sync → Custom Sync, choose Set up sync, and enter these two fields:

Server URL
https://daylogue-sync.<your-subdomain>.workers.dev

Enter your deployed Workers URL or custom domain without a trailing slash.

Sync Token
sync_xxxxxxxxxxxxxxxx

Paste a Sync Token created in your admin dashboard. You can issue one per device and revoke anytime.

  1. 1. Test connection and save

    Tap Test connection to verify your URL and token, then save to enable background incremental sync.

  2. 2. Initial sync and adding a second device

    Tap Sync now on your first device to upload existing records. On a new device, use Pull and merge remote data to fetch without pushing, or Full resync to merge history both ways by latest timestamp without deleting local records.

  3. 3. Pending queue and sync logs

    Inspect the Pending queue and Sync logs right inside Settings. If a missing local attachment stalls a single item, choose Sync text only to keep the message text moving. Disabling sync always leaves local data intact.

Safety and backups

  • Protected remote wipe Clearing remote data is only allowed inside the web admin dashboard with explicit confirmation, preventing accidental wipes from mobile devices.
  • Portable backups anytime Export remote JSON backups from the dashboard, or export complete ZIP and Markdown archives directly from Daylogue.