powersync-local-first-sync

Set up bidirectional SQLite-to-PostgreSQL sync with PowerSync and JWT auth.

Updated Oct 8, 2025
One-click install
npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill powersync-local-first-sync
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: powersync-local-first-sync
Source: https://github.com/ichabodcole/project-docs-scaffold-template/tree/main/plugins/recipes/skills/powersync-local-first-sync
Command: npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill powersync-local-first-sync

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables seamless, bidirectional offline-first synchronization between local SQLite caches on Electron desktop apps and PostgreSQL backends, bridging the gap between local work and server-side data.

Core Features & Use Cases

  • Offline-first synchronization: Local writes are immediately available offline and synced when online.
  • Cross-platform parity: Works for Electron (Desktop) and Expo React Native (Mobile) with a unified PowerSync flow.
  • Per-user data isolation: Enforces owner-based filtering across devices, ensuring data privacy and correct scope.
  • Use Case: A developer adds notes on a desktop app, then sees them synchronized on mobile once online.

Quick Start

Initialize the PowerSync local-first sync workflow for your Electron and Expo apps.

Frequently Asked Questions about powersync-local-first-sync

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up bidirectional offline sync between SQLite and PostgreSQL?

Bidirectional offline sync between SQLite and PostgreSQL is set up using PowerSync to replicate local writes to the backend and download remote changes. It handles offline-first data access and cross-device replication.

Can I use PowerSync for offline-first synchronization on both desktop and mobile?

Yes, PowerSync offline-first synchronization supports both Electron desktop apps and Expo React Native mobile apps through a unified workflow. It ensures cross-platform parity for local data and backend replication.

How does JWT authentication handle per-user data isolation in offline sync?

JWT authentication handles per-user data isolation in offline sync by enforcing owner-based filtering across devices. BetterAuth JWT tokens ensure data privacy and correct scope during backend uploads.

What's the best way to handle local and remote schema alignment for offline-first apps?

The best way to handle local and remote schema alignment for offline-first apps is using Drizzle ORM alongside PowerSync. This ensures local SQLite caches and PostgreSQL backends maintain matching schemas for upsert semantics.

Do I need a backend upload endpoint with upsert semantics for local-first sync?

Yes, you need a backend upload endpoint with upsert semantics for local-first sync. This endpoint processes local SQLite writes against the PostgreSQL backend when devices regain connectivity.

Why does per-user ownership filtering matter for cross-device SQLite replication?

Per-user ownership filtering matters for cross-device SQLite replication because it enforces data privacy and correct scope. It ensures users only sync their own data between local caches and the PostgreSQL backend.