Get the FREE Ultimate OpenClaw Setup Guide →

powersync

Scanned
npx machina-cli add skill guillempuche/ai-standards/powersync --openclaw
Files (1)
SKILL.md
7.9 KB

PowerSync TypeScript Skill

Sync engine for local-first apps with real-time sync between client SQLite and backend databases.

When to Use

  • Offline-first/local-first applications
  • Real-time sync between client and server
  • Instant UI responsiveness with background sync

Installation

PlatformPackage
Web@powersync/web + @journeyapps/wa-sqlite
React Native@powersync/react-native + @powersync/op-sqlite
React hooks@powersync/react
Vue composables@powersync/vue
Node.js@powersync/node
Kysely ORM@powersync/kysely-driver
Drizzle ORM@powersync/drizzle-driver

Core Setup

  1. Schemadocs · example
  2. Databasedocs · example
  3. Connectordocs · example

API Quick Reference

OperationMethod
Get onedb.get(sql, params) / db.getOptional(sql, params)
Get alldb.getAll(sql, params)
Executedb.execute(sql, params)
Transactiondb.writeTransaction(async (tx) => { ... })
Watchdb.query({sql, parameters}).watch()
Diff watchdb.query({sql, parameters}).differentialWatch()

Full CRUD: docs

React Hooks

HookPurpose
useQueryQuery with loading/error states
useSuspenseQueryQuery with Suspense
useStatusConnection status
usePowerSyncDatabase instance

Docs: React · Vue

ORM Integration

ORMDocsExample
Kyselydocssource
Drizzledocssource
TanStack DBdocsdemo

Documentation

TopicURL
Overviewhttps://docs.powersync.com/intro/powersync-overview.md
Web SDKhttps://docs.powersync.com/client-sdk-references/javascript-web.md
React Native SDKhttps://docs.powersync.com/client-sdk-references/react-native-and-expo.md
Sync Ruleshttps://docs.powersync.com/usage/sync-rules.md
Watch Querieshttps://docs.powersync.com/usage/use-case-examples/watch-queries.md
API Referencehttps://powersync-ja.github.io/powersync-js/web-sdk

Local References

  • references/sync-rules.md - Sync Rules configuration
  • references/examples.md - All official example projects

GitHub Source

powersync-ja/powersync-js

PackageDescription
commonShared core (schema, sync, types)
webWeb SDK
react-nativeReact Native SDK
nodeNode.js SDK
capacitorCapacitor SDK
reactReact hooks
vueVue composables
tanstack-react-queryTanStack Query integration
kysely-driverKysely ORM driver
drizzle-driverDrizzle ORM driver
attachmentsFile attachments helper
powersync-op-sqliteOP-SQLite adapter
adapter-sql-jsSQL.js adapter (Expo Go)

Source

git clone https://github.com/guillempuche/ai-standards/blob/main/skills/powersync/SKILL.mdView on GitHub

Overview

PowerSync is a TypeScript-based sync engine for local-first apps that enables real-time synchronization between the client-side SQLite database and backend databases such as Postgres, MongoDB, MySQL, and SQL Server. It covers schema definition, database setup, CRUD operations, React/Vue hooks, and ORM integrations with Kysely and Drizzle, delivering instant UI responsiveness even when offline.

How This Skill Works

You define a schema and initialize a local PowerSync database, then use provided APIs and hooks to perform CRUD operations and observe changes. The engine connects the client-side SQLite with your backend via connectors, supporting watch queries and differentialWatch, and integrates smoothly with Kysely and Drizzle ORM drivers for seamless server sync.

When to Use It

  • Offline-first/local-first applications that need offline data access and syncing when online
  • Applications requiring real-time synchronization between client SQLite and backend databases (Postgres, MongoDB, MySQL, SQL Server)
  • User interfaces that must stay responsive with background sync and live updates
  • Mobile or React Native apps with intermittent connectivity and seamless data reconciliation
  • Projects leveraging Kysely or Drizzle ORM to manage cross-database data synchronization

Quick Start

  1. Step 1: Define your schema using the provided schema definitions and docs
  2. Step 2: Instantiate the local PowerSync database and connect to your backend
  3. Step 3: Use React/Vue hooks and the CRUD APIs to build your UI and start syncing

Best Practices

  • Define a strong, explicit schema early and align it with your backend models
  • Use watch() and differentialWatch() to drive reactive UI updates and minimize polling
  • Prefer transactional operations (db.writeTransaction) for atomic multi-step changes
  • Test offline scenarios and conflict resolution strategies across devices
  • Choose the appropriate ORM driver (Kysely/Drizzle) and follow their integration docs for best compatibility

Example Use Cases

  • Offline-first to-do app with real-time sync to Postgres
  • Field data collection app syncing locally to MongoDB in the backend
  • Inventory management system with live stock updates across devices
  • Customer support chat app with offline messaging and server sync
  • Mobile note-taking app syncing to SQL Server for centralized access

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers