This guide will help you set up your own Supabase backend for TaskHub.
- A Supabase account (free tier works)
- Flutter SDK installed
- The TaskHub Flutter project cloned
- Go to Supabase Dashboard
- Click New Project
- Enter a project name (e.g., "TaskHub")
- Set a secure database password (save this!)
- Select your preferred region
- Click Create new project and wait for it to initialize
- In your Supabase dashboard, go to SQL Editor (left sidebar)
- Click New query
- Open the file
supabase/setup.sqlfrom this repository - Copy the entire contents and paste it into the SQL Editor
- Click Run (or press Cmd/Ctrl + Enter)
- You should see "Success. No rows returned" - this is expected
The script creates:
- 5 tables:
profiles,projects,project_members,tasks,notifications - 4 custom enums:
task_status,task_priority,project_role,notification_type - 12 helper functions and triggers for automation
- Row Level Security (RLS) policies for all tables
- Realtime enabled for all tables
No additional setup needed.
-
Go to Google Cloud Console
-
Create a new project or select an existing one
-
Go to APIs & Services > Credentials
-
Click Create Credentials > OAuth client ID
-
For Web application:
- Add
https://YOUR_PROJECT_ID.supabase.co/auth/v1/callbackto Authorized redirect URIs
- Add
-
For iOS:
- Select "iOS" as application type
- Enter your bundle ID
-
Copy the Client IDs
-
In Supabase dashboard:
- Go to Authentication > Providers
- Enable Google
- Paste your Client ID and Client Secret
- Save
- In Supabase dashboard, go to Project Settings > API
- Copy:
- Project URL (e.g.,
https://xxxx.supabase.co) - anon public key (under Project API keys)
- Project URL (e.g.,
- Create a
.envfile in the project root:
SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.co
SUPABASE_ANON_KEY=your-anon-key-here
GOOGLE_WEB_CLIENT_ID=your-google-web-client-id
GOOGLE_IOS_CLIENT_ID=your-google-ios-client-id- Generate the environment config:
dart run build_runner build- Run the app:
flutter runThe app is configured to handle io.taskhub://auth-callback. Ensure this matches your Supabase redirect URL settings.
Add the following inside the <activity> tag:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="io.taskhub" android:host="auth-callback" />
</intent-filter>- Check that RLS policies are correctly applied
- Ensure the user is authenticated
- Verify the anon key is correct
-
Verify the tables are added to the
supabase_realtimepublication -
Run this in SQL Editor to check:
SELECT * FROM pg_publication_tables WHERE pubname = 'supabase_realtime';
-
All 5 tables should be listed
- Verify redirect URIs in Google Cloud Console match Supabase
- Check that deep link configuration is correct in your app
┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
│ profiles │────<│ project_members │>────│ projects │
│ (users) │ │ (junction) │ │ │
└─────────────┘ └──────────────────┘ └──────┬──────┘
│ │
│ │
│ ┌─────────────────┐ │
└───────────>│ tasks │<────────────┘
│ │
└─────────────────┘
│
┌────────────────────┘
│
v
┌─────────────────┐
│ notifications │
└─────────────────┘
If you encounter issues:
- Check the Supabase logs in your dashboard under Database > Logs
- Verify your
.envconfiguration - Ensure all dependencies are installed with
flutter pub get