---
title: Deploy PowerSync with AI on Blossom
url: "/deploy/powersync/"
canonical_url: https://blossom88.com/deploy/powersync/
markdown_url: https://blossom88.com/deploy/powersync.md
summary: Sync PostgreSQL records to SQLite, edit a note offline, and check that it
  reaches PostgreSQL on reconnect.
categories:
- deployment
- databases
stack:
- TypeScript
- PostgreSQL
- SQLite
---

# Deploy PowerSync with AI on Blossom

[PowerSync](https://github.com/powersync-ja/powersync-service) keeps
a local SQLite database in sync with a server database. Users can
keep reading and editing when their connection drops.

## Ask Your Agent

> **Ask your AI agent:** Deploy PowerSync on Blossom and help me edit a sample note offline and sync it when I reconnect.
>
> Follow this guide: https://blossom88.com/deploy/powersync/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## How It Runs

| Part | Role | Where |
|---|---|---|
| PowerSync | Replicate and serve changes | Private Service on App Capacity |
| PostgreSQL | Store notes and sync state in separate Databases | Private Persistent Service |
| Node.js client | Read and edit the note in SQLite | Blossom Job |

## Deploy a Private Sync Service

Use PowerSync Open Edition with a PostgreSQL source that supports
logical replication. Give PowerSync a separate PostgreSQL database
for sync state. Use a signed JWT for each client and scope the Sync
Stream to the user's notes.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Use the official PowerSync image with the unified API and replication
runner. For the workshop, use one PostgreSQL 18 Persistent Service
with a [Volume](/docs/apps/persistent-services/) at `/var/lib/postgresql`.
Enable `wal_level=logical`, publish just the notes table, and use
separate database roles for reading the stream and applying edits.

    blossom environment:deploy --id environment-100 --follow

</details>

## Edit a Note Offline

Connect a [PowerSync client](https://docs.powersync.com/client-sdks/reference/node/)
and sync a sample note to SQLite. Disconnect, edit it, then reconnect.
The client sends queued edits through an application backend that checks
which records the user may change. For the demo, the Job applies one
edit through a restricted PostgreSQL role.

> **Ask your AI agent:** Help me edit a note while the client is offline and check that it reaches PostgreSQL after reconnecting.

> Follow this guide: https://blossom88.com/deploy/powersync/



![Edit a note offline and confirm the PostgreSQL write after reconnecting.](/deploy/assets/images/powersync/edit-a-note-offline.webp)

## Sync After an Update

Keep the original database and replace the PowerSync Container. Start
a fresh client and check that it receives the edited note.

> **Ask your AI agent:** Replace the PowerSync Container and sync the edited note to a fresh client.

> Follow this guide: https://blossom88.com/deploy/powersync/



![Sync the saved edit to a fresh SQLite client after replacement.](/deploy/assets/images/powersync/sync-note-after-replacement.webp)

## What You Get

A private sync Service, a scoped client, and a tested path from an
offline SQLite edit back to PostgreSQL.

## What You Get

- A private PowerSync Service
- A SQLite client that only reads the signed-in user's note
- An offline edit that reaches PostgreSQL after reconnecting

Tested on Blossom: An offline SQLite edit reached PostgreSQL and a fresh client recovered it after replacing PowerSync.
