Skip to main content

PowerSync SDK for Web

PowerSync is a service and set of SDKs that keeps Postgres databases in sync with on-device SQLite databases.

This package (packages/web) is the PowerSync SDK for JavaScript Web clients. It is an extension of packages/common.

See a summary of features here.

Beta Release

The web SDK package is currently in a Beta release.

Installation

Install Package

npm install @powersync/web

Install Peer Dependency: WA-SQLite

This SDK currently requires @journeyapps/wa-sqlite as a peer dependency.

Install it in your app with:

npm install @journeyapps/wa-sqlite

Polyfills

WebSocket Connections: Buffer

Note: Beta Release - WebSockets are currently in a beta release. It should be safe to use in production if sufficient testing is done on the client side.

This SDK connects to a PowerSync instance via HTTP streams (enabled by default) or WebSockets. The WebSocket connection method requires Buffer to be available in the global scope. When multiple tabs are used the shared web worker will apply a polyfill in its own scope, but the Buffer class should be polyfills in the application for cases where multiple tabs are not supported.

Install a suitable Buffer implementation

npm install buffer

Apply it in your application if not yet provided

import { Buffer } from 'buffer';

if (typeof self.Buffer == 'undefined') {
self.Buffer = Buffer;
}

Getting Started

Our full SDK reference contains everything you need to know to get started implementing PowerSync in your project.

Changelog

A changelog for this SDK is available here.

API Reference

The full API reference for this SDK can be found here.

Examples

For example projects built with PowerSync on Web, see our Demo Apps / Example Projects gallery. Most of these projects can also be found in the demos/ directory.

Found a bug or need help?

  • Join our Discord server where you can browse topics from our community, ask questions, share feedback, or just say hello :)
  • Please open a GitHub issue when you come across a bug.
  • Have feedback or an idea? Submit an idea via our public roadmap or schedule a chat with someone from our product team.