Skip to content

Commit 584c3ea

Browse files
committed
Merge branch 'main' of https://github.com/FlutterFlow/dreamflow-documentation into update/firebase-docs-cloud-fn-faq-2
2 parents 714daef + 3050c6c commit 584c3ea

6 files changed

+119
-25
lines changed
32.6 KB
Binary file not shown.
59.1 KB
Binary file not shown.
134 KB
Binary file not shown.
55.9 KB
Binary file not shown.
91.9 KB
Binary file not shown.

docs/integrations/supabase.md

Lines changed: 119 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,13 @@ keywords: [Supabase, Integration, Dreamflow, Backend]
1212

1313
Dreamflow makes it easy to integrate [Supabase](https://supabase.com/) into your app with a guided, step-by-step setup. This process connects your project to Supabase, sets up a database, generates client code, and deploys schemas, all without manual setup.
1414

15-
## 1. Connection and Project Setup
15+
## 1. Connection
1616

17-
The first step is to connect Dreamflow with your Supabase account and set up a project.
17+
The first step is to connect Dreamflow with your Supabase account so it can create new Supabase projects or link to existing ones.
1818

19-
To begin, open the **Supabase** tab in Dreamflow and click **Connect to Supabase**. A Supabase authentication window will appear where you can sign in and review the requested permissions. Next, select an organization and click **Authorize Dreamflow**. These permissions allow Dreamflow to create and manage projects, configure database schemas, and generate API keys on your behalf.
20-
21-
After connecting, Dreamflow automatically creates a new Supabase project and links it to your app. This sets up the backend infrastructure and database for your project. Specifically:
22-
23-
- A new project is provisioned in Supabase with a **Project Name**, **Project ID**, **API URL**, and **Anon Key**.
24-
- Dreamflow initializes the database, ensuring you have a ready-to-use backend.
25-
- These details are securely linked back to your Dreamflow project so you can start building right away.
26-
27-
This setup may take a few minutes while Dreamflow provisions the resources and configures your database.
28-
29-
:::info
30-
31-
You can quickly jump into your Supabase dashboard using the **Open in Supabase** button.
32-
33-
:::
19+
To begin, open the **Supabase** module in Dreamflow and click **Connect to Supabase**. A Supabase authentication window will appear where you can sign in and review the requested permissions. Next, select an organization and click **Authorize Dreamflow**. These permissions allow Dreamflow to create and manage projects, configure database schemas, and generate API keys on your behalf.
3420

21+
Once complete, Dreamflow will confirm the connection with a **Connected** status.
3522

3623
<div style={{
3724
position: 'relative',
@@ -59,8 +46,33 @@ You can quickly jump into your Supabase dashboard using the **Open in Supabase**
5946
</div>
6047
<p></p>
6148

49+
## 2. Project Setup
6250

63-
## 2. Generate Client Code
51+
After connecting your Supabase account, the next step is to set up a Supabase project, which will serve as the backend for your app. You can do this in two ways:
52+
53+
- **Select an existing Supabase project:** Choose from the list of your existing Supabase projects.
54+
55+
![select-from-existing-supabase-project.avif](imgs/select-from-existing-supabase-project.avif)
56+
57+
- **Create a new Supabase project:** Let Dreamflow automatically create and configure a new Supabase project for you.
58+
59+
![create-new-supabase-project.avif](imgs/create-new-supabase-project.avif)
60+
61+
**During new project creation:**
62+
63+
- Dreamflow provisions a new project in Supabase, generating a **Project Name**, **Project ID**, **API URL**, and **Anon Key**.
64+
- The database is automatically initialized, giving you a fully configured backend environment.
65+
- All credentials are securely linked to your Dreamflow project, allowing you to start building immediately.
66+
67+
This setup may take a few minutes while Dreamflow provisions the resources and configures your database.
68+
69+
:::info
70+
71+
You can quickly jump into your Supabase dashboard using the **Open in Supabase** button.
72+
73+
:::
74+
75+
## 3. Generate Client Code
6476

6577
Once the project setup is complete, click **Generate Client Code** to let Dreamflow automatically create ready-to-use Supabase integration code tailored to your app. This step eliminates most of the manual setup by wiring your app directly to Supabase with authentication, data models, and database operations.
6678

@@ -92,19 +104,101 @@ When you trigger code generation, Dreamflow performs several background steps, i
92104

93105
By the end of this step, your app will be fully integrated with Supabase, ready to authenticate users, persist data securely, and sync changes in real time with proper RLS policies in place.
94106

95-
## 3. Schema Deployment
107+
## 4. Schema Deployment
108+
109+
The final step is to deploy your database schema changes to Supabase. You’ll see a list of generated **Migration Files** under the **Schema Deployment** menu (in the left side panel). Follow these steps to apply them in the correct order:
110+
111+
1. **Deploy Tables:** Select the table migration file (i.e., `lib/supabase/supabase_tables.sql`) and click **Deploy Schema Changes**. This will create all the required database tables, along with their defined columns, relationships, and constraints, as specified in your generated schema.
112+
2. **Deploy Policies:** Once the tables are successfully created, select the policy migration file (i.e., `lib/supabase/supabase_policies.sql`) and click **Deploy Schema Changes**. This will enable **Row Level Security (RLS)** on your tables and apply access control policies that restrict data operations to authenticated users. For example, users will only be able to view, insert, update, or delete their own records in the `users` and other tables, ensuring that each user can access only their personal data within the app.
113+
114+
:::info
96115

97-
The final step is to deploy your database schema changes to Supabase. To do so, just click **Deploy Schema Changes**. During this process:
116+
After the initial setup, any new updates or modifications you make will be added to the `pending_migrations.sql` file. You only need to deploy these new migrations; previously deployed tables and policies do not need to be redeployed.
98117

99-
- Dreamflow applies your generated schema, including tables, relationships, constraints, and security policies, directly to your Supabase project.
100-
- As part of deployment, Dreamflow can run migrations and update your live database structure. You can review `pending_migrations.sql` beforehand to see exactly what changes will be applied.
118+
:::
101119

102-
Once deployed, your Supabase backend is live. Users can sign up, authenticate, and their data will automatically sync to the cloud with Row Level Security (RLS) and policies enforced to protect privacy.
120+
121+
<div style={{
122+
position: 'relative',
123+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
124+
height: 0,
125+
width: '100%'}}>
126+
<iframe
127+
src="https://demo.arcade.software/99SOvWJi7ICY3REWYU3d?embed&show_copy_link=true"
128+
title=""
129+
style={{
130+
position: 'absolute',
131+
top: 0,
132+
left: 0,
133+
width: '100%',
134+
height: '100%',
135+
colorScheme: 'light'
136+
}}
137+
frameborder="0"
138+
loading="lazy"
139+
webkitAllowFullScreen
140+
mozAllowFullScreen
141+
allowFullScreen
142+
allow="clipboard-write">
143+
</iframe>
144+
</div>
145+
<p></p>
146+
147+
## Add Sample Data to Supabase
148+
149+
Dreamflow lets you add sample data to your Supabase project for easier development and testing. The generated data follows your app’s schema, allowing you to quickly verify how your app behaves with populated tables.
150+
151+
152+
To add sample data from Dreamflow, go to the **Supabase > Sample Data**, and follow the instructions below:
153+
154+
- **For Apps with Login Functionality:** First, sign up in your app using an email and password. After logging in, enter the same email address in the **User Email** field and click **Create Sample Data**. This will generate sample records linked to that user account.
155+
156+
![add-sample-data-supabase-with-login.avif](imgs/add-sample-data-supabase-with-login.avif)
157+
158+
- **For Apps without Login Functionality:** You can skip the email step, as it’s optional. Simply click **Create Sample Data** to generate test records directly in your Supabase database.
159+
160+
![add-sample-data-supabase-wihtout-login.avif](imgs/add-sample-data-supabase-wihtout-login.avif)
103161

104162
:::warning
105163

106-
Schema deployment is an ongoing process. Any time you modify tables, relationships, or security rules in Dreamflow, you’ll need to redeploy to keep your Supabase project up to date.
164+
You can only generate sample data **once** per project. If you need to modify or remove the sample data later, you can do so directly from the **Supabase** **Table Editor**.
107165

108166
:::
109167

110-
![deploy-schema-changes.avif](imgs/deploy-schema-changes.avif)
168+
## FAQs
169+
170+
<details>
171+
<summary>
172+
Why can’t I sign up with Supabase Authentication?
173+
</summary>
174+
175+
<p>
176+
If you are unable to sign up in the generated Supabase authentication code, it’s likely due to **Supabase authentication settings**. By default, Supabase requires **email confirmation** for new accounts. This means that sign-ups using invalid or dummy email addresses will fail.
177+
178+
To fix this, use a valid email address during sign-up so you can receive and confirm the verification email.
179+
</p>
180+
</details>
181+
182+
183+
184+
<details>
185+
<summary>
186+
Are Supabase Edge Functions supported in Dreamflow?
187+
</summary>
188+
189+
<p>
190+
Currently, **Edge Functions are not supported in Dreamflow**. If you need to create or manage Edge Functions, you’ll have to do so directly from the **Supabase Console**.
191+
</p>
192+
</details>
193+
194+
<details>
195+
<summary>
196+
Why can’t I log in with the email I used to generate sample data?
197+
</summary>
198+
199+
<p>
200+
If you generated sample data before adding authentication to your app, logging in with that same email will fail — and this is expected behavior.
201+
202+
When sample data is created, it inserts records directly into the Supabase database, including user details, but it doesn’t go through the actual authentication process. As a result, those users exist in the database but don’t have valid authentication credentials in Supabase Auth.
203+
</p>
204+
</details>

0 commit comments

Comments
 (0)