Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,36 @@
"group": "Usage",
"pages": [
{
"group": "Sync Rules",
"group": "Sync Streams",
"pages": [
"usage/sync-streams/quick-start",
{
"group": "Reference",
"pages": [
"usage/sync-streams/reference/query-syntax",
"usage/sync-streams/reference/operators-and-functions",
"usage/sync-streams/reference/types",
"usage/sync-streams/reference/case-sensitivity",
"usage/sync-streams/reference/client-primary-key",
"usage/sync-streams/reference/joins"
]
},
{
"group": "Advanced",
"pages": [
"usage/sync-streams/advanced/compatibility",
"usage/sync-streams/advanced/multiple-client-versions",
"usage/sync-streams/advanced/schemas-and-connections",
"usage/sync-streams/advanced/partitioned-tables",
"usage/sync-streams/advanced/shared-databases"
]
},
"usage/sync-streams/under-the-hood",
"usage/sync-streams/glossary"
]
},
{
"group": "Sync Rules (Legacy)",
"pages": [
"usage/sync-rules",
"usage/sync-rules/example-global-data",
Expand All @@ -134,7 +163,6 @@
{
"group": "Advanced Topics",
"pages": [
"usage/sync-streams",
"usage/sync-rules/advanced-topics",
"usage/sync-rules/advanced-topics/multiple-client-versions",
"usage/sync-rules/advanced-topics/client-parameters",
Expand Down
27 changes: 14 additions & 13 deletions usage/sync-rules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@ title: "Sync Rules"
sidebarTitle: Overview
---

PowerSync Sync Rules allow developers to control which data gets synchronized to which devices (i.e. they enable _dynamic partial replication_).
<Warning>
**Sync Rules are now legacy - Sync Streams (Beta) are recommended**

## Introduction
Sync Streams are now in Beta and will replace Sync Rules. They provide:
- Simpler syntax with unified queries and subqueries
- On-demand syncing with subscription-based parameters
- Better support for web apps and multi-tab scenarios
- TTL-based caching behavior

We recommend starting with our [Sync Rules from First Principles](https://www.powersync.com/blog/sync-rules-from-first-principles-partial-replication-to-sqlite) blog post, which explains on a high-level what Sync Rules are, why they exist and how to implement them.
**New projects should use [Sync Streams](/usage/sync-streams/quick-start).**

The remainder of these docs dive further into the details.
Existing projects can continue using Sync Rules - they will be supported for the foreseeable future. We recommend migrating to Sync Streams when ready.
</Warning>

<Note>
**Sync Streams available in Early Alpha**
PowerSync Sync Rules allow developers to control which data gets synchronized to which devices (i.e. they enable _dynamic partial replication_).

[Sync Streams](/usage/sync-streams) are now available in early alpha! Sync Streams will eventually replace Sync Rules and are designed to allow for more dynamic syncing, while not compromising on existing offline-first capabilities.
## Introduction

Key improvements in Sync Streams over Sync Rules include:
- **On-demand syncing**: You define Sync Streams on the PowerSync Service, and a client can then subscribe to them one or more times with different parameters.
- **Temporary caching-like behavior**: Each subscription includes a configurable TTL that keeps data active after your app unsubscribes, acting as a warm cache for recently accessed data.
- **Simpler developer experience**: Simplified syntax and mental model, and capabilities such as your UI components automatically managing subscriptions (for example, React hooks).
We recommend starting with our [Sync Rules from First Principles](https://www.powersync.com/blog/sync-rules-from-first-principles-partial-replication-to-sqlite) blog post, which explains on a high-level what Sync Rules are, why they exist and how to implement them.

We encourage you to explore Sync Streams for new projects, and migrating to Sync Streams once they are in Beta.
</Note>
The remainder of these docs dive further into the details.

## Defining Sync Rules

Expand Down
Loading