Skip to main content
Version: 0.1.0

Sync and Watch

The raisindb sync --watch command enables a live development workflow where local package changes are automatically synchronized to your RaisinDB server. Edit node types, content, or configuration locally, and see changes reflected instantly.

Basic Sync

Push local package content to a running server:

raisindb sync --repo myapp --branch main

This compares your local package files against the server state and uploads any changes.

Watch Mode

For development, use --watch to continuously sync on file changes:

raisindb sync --watch --repo myapp --branch main

Watch mode:

  1. Performs an initial sync of all local changes
  2. Monitors the package directory for file modifications
  3. Automatically syncs changed files to the server
  4. Reports sync status in the terminal

This is ideal for iterative development — edit a node.yaml or index.js file, save, and the changes appear in your running RaisinDB instance within seconds.

Sync Configuration

Configure sync behavior in your package's manifest.yaml:

sync:
remote:
url: "http://localhost:8080"
repo_id: "myapp"
branch: "main"
tenant_id: "default"
defaults:
mode: replace # replace | merge | update
on_conflict: prefer_local # ask | prefer_local | prefer_server | prefer_newer
sync_deletions: true # propagate local deletes to server
property_merge: shallow # shallow | deep

Sync Modes

ModeBehavior
replaceFull replacement of server content with local (default)
mergeCombine local and server, keeping content from both
updateOnly push changes, preserve unmodified server content

Conflict Strategies

StrategyBehavior
askPrompt in terminal for each conflict (default)
prefer_localAlways keep your local version
prefer_serverAlways keep the server version
prefer_newerUse whichever version has a newer timestamp
merge_propertiesAttempt property-level merge

Path Filters

Control which paths are synced using filters:

sync:
filters:
# Only sync YAML files in /content/pages
- root: /content/pages
mode: merge
include:
- "**/*.yaml"
exclude:
- "drafts/**"

# Local-only development content, never pushed
- root: /content/dev
direction: local_only

# System content pulled from server, never pushed
- root: /system
direction: server_only
on_conflict: prefer_server

Sync Directions

DirectionPushPullUse Case
bidirectionalYesYesDefault two-way sync
local_onlyNoNoLocal dev content, not synced
server_onlyNoYesPull from server, never push
push_onlyYesNoPush to server, never pull

Sync Status

Check what has changed between local and server:

raisindb sync --status --repo myapp

Each file gets a status:

StatusMeaning
syncedIdentical locally and on server
local_onlyExists only locally (new file)
server_onlyExists only on server (deleted locally)
modifiedChanged locally since last sync
conflictBoth local and server versions changed

Development Workflow

A typical development workflow with sync:

# 1. Initialize a package
raisindb init --pack my-feature

# 2. Start the server
RUST_LOG=info ./target/release/raisin-server --config node.toml

# 3. Start watch mode in another terminal
raisindb sync --watch --repo myapp --branch main

# 4. Edit files — changes sync automatically
# Edit nodetypes/blog_Article.yaml → NodeType updated on server
# Edit content/blog/posts/welcome/node.yaml → Content updated
# Add content/blog/posts/new-post/node.yaml → New node created

# 5. When ready, build the final package
raisindb package create ./my-feature

Conflict Resolution

When both local and server have changes to the same file, sync detects a conflict.

In interactive mode (on_conflict: ask), you'll be prompted:

Conflict: content/blog/posts/welcome/node.yaml
Local: modified 2026-03-31T10:00:00Z
Server: modified 2026-03-31T09:30:00Z

[l] Keep local [s] Keep server [n] Keep newer [d] Show diff [a] Abort

For automated workflows, set a default strategy:

sync:
defaults:
on_conflict: prefer_local
conflicts:
"/content/pages/home":
strategy: prefer_server
backup: true

Path-specific overrides in conflicts take precedence over defaults.

Next Steps