PowerSync Service

repository·main·Indexed 18 days ago

https://github.com/powersync-ja/powersync-service

A source-available backend synchronization engine that enables local-first applications by syncing client-side SQLite databases with server-side databases such as Postgres, MongoDB, MySQL, or SQL Server. The service includes a replication protocol for moving data from source to bucket storage and a sync protocol for streaming updates to clients. It features specialized modules for Convex, MongoDB, and PostgreSQL.

Tokens
117.3K
Snippets
313
Records
509
Agent score
63%

What's inside powersync-service

  1. Overview of powersync-jsonbig and its purpose

    main

    The powersync-jsonbig package provides a custom JSON parser designed to handle JSON data used throughout the PowerSync ecosystem, including PostgreSQL json/jsonb types, sync query inputs, transformations, and data persistence.

    To avoid parsing/serializing overhead and prevent data mutation, JSON data is often kept as strings. The custom parser specifically addresses the following requirements:

    1. Preserving SQLite Type Distinctions: It maintains the distinction between INTEGER and REAL values as defined by the SQLite type system.
    2. Handling 64-bit Integers: It uses BigInt for all integer values to support the 64-bit integer range available in SQLite, preventing precision loss that occurs with standard JavaScript numbers.
  2. Overview of PowerSync Service

    main
    PowerSync Service is the backend component of the PowerSync sync engine. It facilitates synchronization between client-side SQLite databases and various server-side databases including Postgres, MongoDB, MySQL, or SQL Server. It is designed to enable local-first applications with responsive UI/UX by managing state transfer between the client and the server.
  3. Overview of jpgwire

    main

    jpgwire

    jpgwire is a low-level library designed to support PostgreSQL streaming replication. It serves as a customized wrapper around the original pgwire library to improve maturity and stability.

    Key features include:

    • Customizations to the core pgwire logic for better reliability.
    • Wrappers to enable connections using PowerSync configuration.
    • Inclusion of a standard set of CA certificates for secure connections.