Supabase Sync
Sync data using a free PostgreSQL cloud database.
What is Supabase?
Supabase is an open-source Firebase alternative that provides a free PostgreSQL database and object storage.
Advantages
- ✅ Generous free tier (500MB database + 1GB storage)
- ✅ Cross-platform (iOS/Android)
- ✅ Real-time sync
- ✅ Full data control
Configuration Steps
1. Register Supabase
Visit supabase.com to create an account.
2. Create Project
- Click "New Project"
- Enter project name
- Set database password
- Select region (Asia recommended for Asian users)
- Create project
3. Create Storage Bucket
- Click "Storage" in the left menu
- Click "New bucket"
- Enter bucket name:
beecount-backups - Do not check Public bucket (keep it Private)
- Create bucket
4. Configure RLS Policies
To allow the app to read and write data properly, you need to configure RLS (Row Level Security) policies to ensure users can only access their own data:
- Go to "Storage" → Select
beecount-backupsbucket - Click the "Policies" tab
- Create the following 4 policies:
| Policy Name | Operation |
|---|---|
| Allow user SELECT | SELECT |
| Allow user INSERT | INSERT |
| Allow user UPDATE | UPDATE |
| Allow user DELETE | DELETE |
Each policy should be configured the same way:
- Target roles: Select
authenticated - Policy definition: Enter the following expression
((bucket_id = 'beecount-backups'::text) AND ((storage.foldername(name))[1] = 'users'::text) AND ((storage.foldername(name))[2] = (auth.uid())::text))
This policy ensures users can only access files in the
beecount-backups/users/<their-user-id>/path.
5. Get Configuration Info
In "Project Settings" → "API", find:
- Project URL - Project address
- anon public key - Public API key
6. Configure BeeCount
- Go to "Me" → "Cloud Service"
- Select "Supabase"
- Enter Project URL
- Enter anon key
- Enter Storage Name:
beecount-backups - Save and test connection
Notes
- Free tier has some limitations, but sufficient for personal use
- Inactive projects may be paused (log in within 7 days to restore)
- Recommend regular data export backups