Skip to content

Commit 81e9a0e

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main' into pooja/welcome
2 parents c6620cd + 3319629 commit 81e9a0e

10 files changed

+303
-0
lines changed

docs/integrations/_category_.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Integrations",
3+
"position": 1
4+
}

docs/integrations/firebase.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
slug: /integrations/firebase
3+
title: Firebase
4+
description: Learn how to connect your Dreamflow app with Firebase to enable powerful backend features such as authentication, real-time databases, analytics, and more.
5+
tags: [Firebase, Integration, Dreamflow, Backend]
6+
sidebar_position: 1
7+
toc_max_heading_level: 4
8+
keywords: [Firebase, Integration, Dreamflow, Backend]
9+
---
10+
11+
# Firebase
12+
13+
Dreamflow makes it easy to integrate [Firebase](https://firebase.google.com/) into your app with a guided, step-by-step setup. This process connects your project to Firebase, generates all necessary configuration, and even creates ready-to-use client code and database rules with AI.
14+
15+
By integrating Firebase, you gain access to services such as Authentication, Firestore Database, Cloud Storage, Hosting and more, giving your app a secure backend for managing users, data, and serverless logic.
16+
17+
## 1. Connection
18+
19+
The first step is to connect Dreamflow with your Google account so it can create new Firebase projects or link to existing ones.
20+
21+
To connect Dreamflow with Firebase, open the **Firebase** tab in Dreamflow, then click **Connect to Firebase**. When the OAuth window appears, sign in with your Google account, review, and approve the requested permissions. These permissions allow Dreamflow to create Firebase projects, manage configurations, and deploy security rules.
22+
23+
Once complete, Dreamflow will confirm the connection with a **Connected** status.
24+
25+
<div style={{
26+
position: 'relative',
27+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
28+
height: 0,
29+
width: '100%'}}>
30+
<iframe
31+
src="https://demo.arcade.software/Iu2hoVYZN1EV5IscOzNy?embed&show_copy_link=true"
32+
title=""
33+
style={{
34+
position: 'absolute',
35+
top: 0,
36+
left: 0,
37+
width: '100%',
38+
height: '100%',
39+
colorScheme: 'light'
40+
}}
41+
frameborder="0"
42+
loading="lazy"
43+
webkitAllowFullScreen
44+
mozAllowFullScreen
45+
allowFullScreen
46+
allow="clipboard-write">
47+
</iframe>
48+
</div>
49+
<p></p>
50+
51+
52+
## 2. Project Setup
53+
54+
After connecting your Google account, the next step is to set up a Firebase project, which will serve as the backend for your app. You can do this in two ways:
55+
56+
- **Select an existing Firebase project:** Choose from the list of your existing Firebase projects.
57+
58+
![select-from-existing-project](imgs/select-from-existing-project.avif)
59+
- **Create a new Firebase project:** Let Dreamflow automatically create and configure a new Firebase project for you.
60+
61+
![create-new-project](imgs/create-new-project.avif)
62+
63+
Once the project is linked, you need to specify the following:
64+
65+
- **Target Platforms:** Choose the platforms you want to support (Web, iOS, Android, macOS, Linux, Windows). Web is always enabled by default, so your app can be previewed inside Dreamflow. Selecting the right platforms ensures Firebase generates configs for each build target.
66+
- **Bundle ID:** Enter a unique **Bundle ID** (e.g., `com.yourcompany.appname`). This must match the app identifier in your platform-specific builds (iOS bundle ID, Android package name). If you skip this, Firebase cannot configure services for mobile apps.
67+
68+
When these details are set, click **Configure Firebase** to complete the setup.
69+
70+
<div style={{
71+
position: 'relative',
72+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
73+
height: 0,
74+
width: '100%'}}>
75+
<iframe
76+
src="https://demo.arcade.software/Ux3hDEIPtZ1qaVHtIKnf?embed&show_copy_link=true"
77+
title=""
78+
style={{
79+
position: 'absolute',
80+
top: 0,
81+
left: 0,
82+
width: '100%',
83+
height: '100%',
84+
colorScheme: 'light'
85+
}}
86+
frameborder="0"
87+
loading="lazy"
88+
webkitAllowFullScreen
89+
mozAllowFullScreen
90+
allowFullScreen
91+
allow="clipboard-write">
92+
</iframe>
93+
</div>
94+
<p></p>
95+
96+
97+
:::info
98+
99+
Behind the scenes, Dreamflow uses the **FlutterFire CLI** to handle the configuration. This process generates a `firebase_options.dart` file containing project-specific credentials such as API keys, app ID, and messaging sender ID. These credentials ensure your app is properly connected to Firebase services.
100+
101+
:::
102+
103+
:::warning
104+
105+
Once configured, changing the **Bundle ID** later will require reconfiguring Firebase and may break existing builds. Choose carefully before proceeding.
106+
107+
:::
108+
109+
## 3. Generate Client Code
110+
111+
Once your Firebase project is linked and configured, click **Generate with Agent** to automatically add the code needed to access Firebase services. This step automates a complete Firebase integration tailored to your app, wiring up authentication, Firestore, state management, and updating the existing app logic with little to no manual effort.
112+
113+
:::info
114+
115+
- This step is optional, but we strongly recommend doing it. It saves significant development time by scaffolding schemas, services, and security rules automatically to ensure your Firebase integration is both secure and production-ready from the start.
116+
- The generated code is fully editable and serves as a starting point for customization.
117+
118+
:::
119+
120+
![generate-client-code.avif](imgs/generate-client-code.avif)
121+
122+
### Code Generation Breakdown
123+
124+
When you click **Generate with Agent**, Dreamflow performs several background steps, including (but not limited to):
125+
126+
- **Firebase Configuration Files**
127+
- Creates and updates core Firebase files such as `firebase.json`, `firestore.rules`, `firestore.indexes.json`, and `firebase_options.dart`.
128+
- These files define how your app connects to Firebase, which services are enabled, and enforce security rules and query indexes.
129+
- **Firestore Schema & Services**
130+
- Generates a `firestore_data_schema.dart` file to define collections and documents.
131+
- Implements a `firebase_service.dart` repository class to handle Firestore operations (CRUD, queries, synchronization).
132+
- Adds indexes and security rules to enforce per-user access control.
133+
- **Authentication System**
134+
- Creates an `auth_service.dart` for sign-in/sign-out logic.
135+
- Adds an `auth_wrapper.dart` to manage authentication state across the app.
136+
- Updates `main.dart` to initialize Firebase and route users based on authentication state.
137+
- **App Screens**
138+
- Updates app pages to fetch and display live data from Firestore instead of hardcoded values.
139+
- Adds authentication screens to handle user sign-in and sign-up flows.
140+
- **Dependencies & Compilation**
141+
- Updates `pubspec.yaml` with required Firebase dependencies.
142+
- Resolves version conflicts and ensures successful compilation.
143+
144+
145+
:::info[Enable Services in Firebase Console]
146+
147+
After Dreamflow generates code for Firebase services, you must enable those services in the Firebase Console for them to function correctly. For example:
148+
149+
- **Authentication:** Enable required sign-in methods such as Email/Password or Social Sign-in.
150+
- **Firestore Database:** Activate Firestore in the console to store and retrieve data.
151+
- **Firebase Storage:** Enable Storage to handle file uploads and downloads.
152+
153+
:::
154+
155+
## 4. Deploy to Firebase
156+
157+
The final step is to deploy the generated schemas, indexes, and rules to Firebase so they become active in your project. For example, in a habit tracker app, Dreamflow deploys rules that allow only the authenticated user to modify their habits collection.
158+
159+
To deploy to Firebase:
160+
161+
1. In the **Actions** panel, go to **Deploy to Firebase**. Under **Deployment Target**, select the Firebase service you want to deploy to (default is *Firestore*).
162+
2. Click **Deploy Changes**.
163+
164+
:::info
165+
166+
- Until you deploy, rules and schemas only exist in Dreamflow and are not sent to Firebase.
167+
- Dreamflow uses the Firebase CLI to push security rules, indexes, and any additional configurations (e.g., Auth, Storage) to Firebase.
168+
169+
:::
170+
171+
:::warning
172+
173+
This step is critical for security, as without rules, your Firestore may be open to anyone.
174+
175+
::::
176+
177+
![deploy-to-firebase.avif](imgs/deploy-to-firebase.avif)
178+
60.1 KB
Binary file not shown.
124 KB
Binary file not shown.
112 KB
Binary file not shown.
114 KB
Binary file not shown.
110 KB
Binary file not shown.
96.2 KB
Binary file not shown.

docs/integrations/supabase.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
slug: /integrations/supabase
3+
title: Supabase
4+
description: Learn how to connect your Dreamflow app with Supabase to enable powerful backend features such as authentication, databases, storage, and more.
5+
tags: [Supabase, Integration, Dreamflow, Backend]
6+
sidebar_position: 2
7+
toc_max_heading_level: 4
8+
keywords: [Supabase, Integration, Dreamflow, Backend]
9+
---
10+
11+
# Supabase
12+
13+
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.
14+
15+
## 1. Connection and Project Setup
16+
17+
The first step is to connect Dreamflow with your Supabase account and set up a project.
18+
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+
:::
34+
35+
36+
<div style={{
37+
position: 'relative',
38+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
39+
height: 0,
40+
width: '100%'}}>
41+
<iframe
42+
src="https://demo.arcade.software/QvHPsdxLUubTQDPXrxfL?embed&show_copy_link=true"
43+
title=""
44+
style={{
45+
position: 'absolute',
46+
top: 0,
47+
left: 0,
48+
width: '100%',
49+
height: '100%',
50+
colorScheme: 'light'
51+
}}
52+
frameborder="0"
53+
loading="lazy"
54+
webkitAllowFullScreen
55+
mozAllowFullScreen
56+
allowFullScreen
57+
allow="clipboard-write">
58+
</iframe>
59+
</div>
60+
<p></p>
61+
62+
63+
## 2. Generate Client Code
64+
65+
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.
66+
67+
![generate-client-code-supabase.avif](imgs/generate-client-code-supabase.avif)
68+
69+
### Code Generation Breakdown
70+
71+
When you trigger code generation, Dreamflow performs several background steps, including (but not limited to):
72+
73+
- **Supabase Configuration**:
74+
- Add the `supabase_flutter` dependency and update `main.dart` for initialization.
75+
- Generate a `supabase_config.dart` file with project credentials (API URL, Anon Key) and helper functions for database access.
76+
- **Database Schema (`supabase_tables.sql`)**:
77+
- Define the necessary tables for your app (e.g., users, core data entities, relationships).
78+
- Add indexes and constraints for efficient queries.
79+
- **Security Policies (`supabase_policies.sql`)**:
80+
- Enable **Row Level Security (RLS)** across all tables.
81+
- Generate policies so users can only access their own data, and operations are protected by authentication checks.
82+
- **Service Layer**:
83+
- Create service classes (e.g., `_service.dart`) with CRUD operations, query helpers, and error handling.
84+
- Include support for real-time updates, history tracking, or analytics if applicable.
85+
- **Models & Data**:
86+
- Update models to support Supabase JSON serialization (`fromJson`, `toJson`).
87+
- Refresh sample data to match the generated schema.
88+
- Adjust widgets or UI components to bind live data instead of placeholders.
89+
- **App Integration**:
90+
- Replace hardcoded logic with Supabase-powered queries.
91+
- Wire authentication, database syncing, and state management into the app flow.
92+
93+
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.
94+
95+
## 3. Schema Deployment
96+
97+
The final step is to deploy your database schema changes to Supabase. To do so, just click **Deploy Schema Changes**. During this process:
98+
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.
101+
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.
103+
104+
:::warning
105+
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.
107+
108+
:::
109+
110+
![deploy-schema-changes.avif](imgs/deploy-schema-changes.avif)

sidebars.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ const sidebars: SidebarsConfig = {
4141
}
4242
],
4343
},
44+
{
45+
type: 'category',
46+
label: 'Integrations',
47+
collapsed: false,
48+
items: [
49+
{
50+
type: 'autogenerated',
51+
dirName: 'integrations',
52+
}
53+
],
54+
},
4455
]
4556

4657
};

0 commit comments

Comments
 (0)