diff --git a/demos/supabase-anonymous-auth/lib/app_config_template.dart b/demos/supabase-anonymous-auth/lib/app_config_template.dart index bce37c5a..41f9a7c8 100644 --- a/demos/supabase-anonymous-auth/lib/app_config_template.dart +++ b/demos/supabase-anonymous-auth/lib/app_config_template.dart @@ -1,5 +1,6 @@ +// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart` +// Edit lib/app_config.dart and enter your Supabase and PowerSync project details. class AppConfig { - static const String supabaseUrl = 'https://jrimaqxlgrpjipgssldo.supabase.co'; - static const String supabaseAnonKey = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpyaW1hcXhsZ3JwamlwZ3NzbGRvIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE1ODY5MTAsImV4cCI6MjAwNzE2MjkxMH0.K-Qb-YFz0oVpLshUEezGU-Do-sX08zKqBzVccDoZp_Y'; + static const String supabaseUrl = 'https://foo.supabase.co'; + static const String supabaseAnonKey = 'foo'; } diff --git a/demos/supabase-edge-function-auth/lib/app_config_template.dart b/demos/supabase-edge-function-auth/lib/app_config_template.dart index bce37c5a..41f9a7c8 100644 --- a/demos/supabase-edge-function-auth/lib/app_config_template.dart +++ b/demos/supabase-edge-function-auth/lib/app_config_template.dart @@ -1,5 +1,6 @@ +// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart` +// Edit lib/app_config.dart and enter your Supabase and PowerSync project details. class AppConfig { - static const String supabaseUrl = 'https://jrimaqxlgrpjipgssldo.supabase.co'; - static const String supabaseAnonKey = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpyaW1hcXhsZ3JwamlwZ3NzbGRvIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE1ODY5MTAsImV4cCI6MjAwNzE2MjkxMH0.K-Qb-YFz0oVpLshUEezGU-Do-sX08zKqBzVccDoZp_Y'; + static const String supabaseUrl = 'https://foo.supabase.co'; + static const String supabaseAnonKey = 'foo'; } diff --git a/demos/supabase-simple-chat/lib/app_config_template.dart b/demos/supabase-simple-chat/lib/app_config_template.dart index 10dac15d..d7ead31d 100644 --- a/demos/supabase-simple-chat/lib/app_config_template.dart +++ b/demos/supabase-simple-chat/lib/app_config_template.dart @@ -1,6 +1,7 @@ +// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart` +// Edit lib/app_config.dart and enter your Supabase and PowerSync project details. class AppConfig { - static const String supabaseUrl = 'https://aaaaaaaaaaaa.supabase.co'; - static const String supabaseAnonKey = 'eyeyeyeyeyeye'; - static const String powersyncUrl = - 'https://65130c9db6679a3682ba380a.powersync.journeyapps.com'; + static const String supabaseUrl = 'https://foo.supabase.co'; + static const String supabaseAnonKey = 'foo'; + static const String powersyncUrl = 'https://foo.powersync.journeyapps.com'; } diff --git a/demos/supabase-todolist/lib/app_config_template.dart b/demos/supabase-todolist/lib/app_config_template.dart index e38a6053..ccfdfa21 100644 --- a/demos/supabase-todolist/lib/app_config_template.dart +++ b/demos/supabase-todolist/lib/app_config_template.dart @@ -1,9 +1,9 @@ +// Copy this template: `cp lib/app_config_template.dart lib/app_config.dart` +// Edit lib/app_config.dart and enter your Supabase and PowerSync project details. class AppConfig { - static const String supabaseUrl = 'https://jrimaqxlgrpjipgssldo.supabase.co'; - static const String supabaseAnonKey = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpyaW1hcXhsZ3JwamlwZ3NzbGRvIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE1ODY5MTAsImV4cCI6MjAwNzE2MjkxMH0.K-Qb-YFz0oVpLshUEezGU-Do-sX08zKqBzVccDoZp_Y'; - static const String powersyncUrl = - 'https://64d392172a3c226cddbd5070.powersync.journeyapps.com'; + static const String supabaseUrl = 'https://foo.supabase.co'; + static const String supabaseAnonKey = 'foo'; + static const String powersyncUrl = 'https://foo.powersync.journeyapps.com'; static const String supabaseStorageBucket = - ''; // Optional if you want to test out attachments + ''; // Optional. Only required when syncing attachments and using Supabase Storage. See packages/powersync_attachments_helper. } diff --git a/packages/powersync/README.md b/packages/powersync/README.md index 611a54a8..04ac65ac 100644 --- a/packages/powersync/README.md +++ b/packages/powersync/README.md @@ -1,151 +1,39 @@ -# PowerSync SDK for Dart/Flutter - -[PowerSync](https://powersync.co) is a service and set of SDKs that keeps PostgreSQL databases in sync with on-device SQLite databases. - -## SDK Features - -* Real-time streaming of changes. -* Direct access to the SQLite database - use SQL on the client and server. -* Operations are asynchronous by default - does not block the UI. -* Supports one write and many reads concurrently. -* No need for client-side database migrations - these are handled automatically. -* Subscribe to queries for live updates. - -## Examples - -For complete app examples, see our [example app gallery](https://docs.powersync.com/resources/demo-apps-example-projects#flutter) - -For examples of some common patterns, see our [example snippets](./example/README.md) - -## Getting started +
-You'll need to create a PowerSync account and set up a PowerSync instance. You can do this at [https://www.powersync.com/](https://www.powersync.com/). - -### Install the package +# PowerSync SDK for Dart/Flutter -`flutter pub add powersync` +[PowerSync](https://powersync.com) is a service and set of SDKs that keeps Postgres databases in sync with on-device SQLite databases. -### Implement a backend connector and initialize the PowerSync database +This package (`powersync`) is the PowerSync SDK for Dart/Flutter clients. -```dart -import 'package:powersync/powersync.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:path/path.dart'; +See a summary of features [here](https://docs.powersync.com/client-sdk-references/flutter). -// Define the schema for the local SQLite database. -// You can automatically generate this schema based on your sync rules: -// In the PowerSync dashboard, right-click on your PowerSync instance and then click "Generate client-side schema" -const schema = Schema([ - Table('customers', [Column.text('name'), Column.text('email')]) -]); +# Installation -late PowerSyncDatabase db; +```bash +flutter pub add powersync +``` -// You must implement a backend connector to define how PowerSync communicates with your backend. -class MyBackendConnector extends PowerSyncBackendConnector { - PowerSyncDatabase db; +# Getting Started - MyBackendConnector(this.db); - @override - Future