Demo app demonstrating use of the PowerSync SDK for Flutter together with the demo Django backend.
Ensure you have melos installed.
cd demos/django-todolistmelos bootstrapcp lib/app_config_template.dart lib/app_config.dart- Insert your Django URL and PowerSync project credentials into
lib/app_config.dart(See instructions below) flutter run
A test user with the following credentials will be available:
username: testuser
password: testpassword
This demo can be used with cloud or local services.
The Self Hosting Demo repository contains a Docker Compose Django backend demo which can be used with this client. See instructions for starting the backend locally.
The backend demo should perform all the required setup automatically.
Note that Android requires port forwarding of local services. These can be configured with ADB as below:
adb reverse tcp:8080 tcp:8080 && adb reverse tcp:6061 tcp:6061Follow the instructions in the django backend project's README.
The instructions guide you through the following:
- Creates
listsandtodostables. - Creates a test user.
- Create a logical replication publication called
powersyncforlistsandtodos.
Create a new PowerSync instance by signing up for PowerSync Cloud at www.powersync.com, then connect to the database of your Django project.
Then deploy the following Sync Streams config (with auto_subscribe: true so the client syncs the user's data on connect):
config:
edition: 3
streams:
user_data:
auto_subscribe: true
queries:
- SELECT * FROM lists WHERE owner_id = auth.user_id()
- SELECT todos.* FROM todos INNER JOIN lists ON todos.list_id = lists.id WHERE lists.owner_id = auth.user_id()Insert the credentials of your new Django backend and PowerSync projects into lib/app_config.dart