mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 19:05:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Docs update. Getting Started page is the most visited page in the docs at the moment: https://supabase.com/docs/guides/getting-started. Looking at all 19 guides, they appear to have drifted apart because there was never a written standard for what a quickstart must contain. Additionally, we are missing some frameworks, languages, and ORMs quickstarts. Phase 1 (this PR) fixes broken numbering, duplicated steps, and dead-end pages. Later phases bring all 19 guides into line with a single "definition of done" contract (error handling in samples, env vars everywhere, consistent Connect-panel pattern). The end goal is that every quickstart, regardless of framework, gives the same complete, trustworthy path from zero to a working app. ## What is the new behavior? 1. SvelteKit and Hono cards added to the [homepage grid](https://docs-git-docs-fix-quickstart-catalog-gaps-supabase.vercel.app/docs) (FrameworkQuickstarts.tsx). Only added the most popular missing frameworks to the grid. 2. [Rails](https://docs-git-docs-fix-quickstart-catalog-gaps-supabase.vercel.app/docs/guides/getting-started/quickstarts/ruby-on-rails#2-install-agent-skills-optional): Add missing second step (Agent Skills), add next steps at the end (point 6) 3. [Laravel](https://docs-git-docs-fix-quickstart-catalog-gaps-supabase.vercel.app/docs/guides/getting-started/quickstarts/laravel#6-set-up-the-postgres-connection-details): Remove duplicated instruction to create project from step 6. 4. [Refine](https://docs-git-docs-fix-quickstart-catalog-gaps-supabase.vercel.app/docs/guides/getting-started/quickstarts/refine#5-update-supabaseclient-with-environment-variables): In step 5, create .env file (VITE_SUPABASE_URL, VITE_SUPABASE_PUBLISHABLE_KEY), and the client reads them via import.meta.env, matching the Vite-based refine-supabase preset. 5. [Hono](https://docs-git-docs-fix-quickstart-catalog-gaps-supabase.vercel.app/docs/guides/getting-started/quickstarts/hono#6-set-up-the-required-environment-variables) TODO resolved: In step 6, add the "Open Connect panel" Button with the generic api_settings.mdx partial call, identical to the Flask and Expo pattern. 6. Next steps added to the 9 guides missing it at the end of the guide, linking to the framework tutorial or Auth, UI components, data import, and Storage (Flutter, Kotlin, Laravel, Nuxt, RedwoodJS, Refine, Ruby on Rails, SolidJS, and Vue). 7. Remove 4 stale screenshots from RedwoodJS and Refine, along with their now-orphaned image assets under apps/docs/public/img/. The surrounding text already covers what they showed; they weren't Connect-panel screens, so the Button pattern didn't apply as a replacement. 8. Add [Supabase Agent Skills](https://docs-git-docs-fix-quickstart-catalog-gaps-supabase.vercel.app/docs/guides/getting-started/quickstarts/nextjs#4-install-agent-skills-optional) purpose and benefits for the user 9. Start all guides from creating Supabase project ## Additional context Add any other context or screenshots. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Documentation - Added SvelteKit and Hono quickstarts with icons and documentation links. - Expanded Agent Skills guidance across framework quickstarts, including current authentication, SSR, and migration patterns. - Improved project creation, Connect panel, API configuration, and credential setup instructions. - Added framework-specific “Next steps” resources for Auth, database imports, Storage, UI components, and libraries. - Clarified PostgreSQL SSL, password encoding, connection, and environment-variable requirements. - Replaced outdated screenshots with clearer setup guidance and relevant examples. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
160 lines
5.2 KiB
Plaintext
160 lines
5.2 KiB
Plaintext
---
|
|
title: 'Use Supabase with Flutter'
|
|
subtitle: 'Learn how to create a Supabase project, add some sample data to your database, and query the data from a Flutter app.'
|
|
breadcrumb: 'Framework Quickstarts'
|
|
---
|
|
|
|
<AiPrompt id="flutter" />
|
|
|
|
<$Partial path="quickstart_db_setup.mdx" />
|
|
|
|
## 3. Create a Flutter app
|
|
|
|
Create a Flutter app using the `flutter create` command.
|
|
|
|
```bash
|
|
flutter create my_app
|
|
```
|
|
|
|
## 4. Install Supabase's Agent Skills (optional)
|
|
|
|
Supabase's [Agent Skills](/docs/guides/ai-tools/ai-skills) is a curated set of instructions that give your AI agent procedural knowledge about working with Supabase.
|
|
|
|
Install them so your AI coding agent can produce more accurate, reliable code using current Supabase patterns, such as authentication, server-side rendering, and database migrations, rather than relying solely on training data.
|
|
|
|
To install, run the following command in the root of your project:
|
|
|
|
```bash
|
|
npx skills add supabase/agent-skills
|
|
```
|
|
|
|
## 5. Install the Supabase client library
|
|
|
|
The fastest way to get started is to use the [`supabase_flutter`](https://pub.dev/packages/supabase_flutter) client library which provides a convenient interface for working with Supabase from a Flutter app.
|
|
|
|
Open the `pubspec.yaml` file inside your Flutter app and add `supabase_flutter` as a dependency.
|
|
|
|
```yaml name=pubspec.yaml
|
|
supabase_flutter: ^2.0.0
|
|
```
|
|
|
|
## 6. Initialize the Supabase client
|
|
|
|
Open `lib/main.dart` and edit the main function to initialize Supabase using your project URL and publishable key, which you can get from the helper below, or [from the project **Connect** panel](/dashboard/project/_?showConnect=true&framework=flutter&connectTab=mobiles):
|
|
|
|
<Button variant="primary" asChild>
|
|
<a href="/dashboard/project/_?showConnect=true&connectTab=mobiles&framework=flutter">
|
|
Open Connect panel
|
|
</a>
|
|
</Button>
|
|
|
|
```dart name=lib/main.dart
|
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
await Supabase.initialize(
|
|
url: 'YOUR_SUPABASE_URL',
|
|
publishableKey: 'YOUR_SUPABASE_PUBLISHABLE_KEY',
|
|
);
|
|
runApp(MyApp());
|
|
}
|
|
```
|
|
|
|
<$Partial path="api_settings.mdx" variables={{ "framework": "flutter", "tab": "mobiles" }} />
|
|
|
|
## 7. Query data from the app
|
|
|
|
Use a `FutureBuilder` to fetch the data when the home page loads and display the query result in a `ListView`.
|
|
|
|
Replace the default `MyApp` and `MyHomePage` classes with the following code.
|
|
|
|
```dart name=lib/main.dart
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const MaterialApp(
|
|
title: 'Instruments',
|
|
home: HomePage(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HomePage extends StatefulWidget {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
State<HomePage> createState() => _HomePageState();
|
|
}
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
final _future = Supabase.instance.client
|
|
.from('instruments')
|
|
.select();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: FutureBuilder(
|
|
future: _future,
|
|
builder: (context, snapshot) {
|
|
if (!snapshot.hasData) {
|
|
return const Center(child: CircularProgressIndicator());
|
|
}
|
|
final instruments = snapshot.data!;
|
|
return ListView.builder(
|
|
itemCount: instruments.length,
|
|
itemBuilder: ((context, index) {
|
|
final instrument = instruments[index];
|
|
return ListTile(
|
|
title: Text(instrument['name']),
|
|
);
|
|
}),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
```
|
|
|
|
## 8. Start the app
|
|
|
|
Run your app on a platform of your choosing! By default an app should launch in your web browser.
|
|
|
|
Note that `supabase_flutter` is compatible with web, iOS, Android, macOS, and Windows apps.
|
|
Running the app on macOS requires additional configuration to [set the entitlements](https://docs.flutter.dev/development/platform-integration/macos/building#setting-up-entitlements).
|
|
|
|
```bash
|
|
flutter run
|
|
```
|
|
|
|
## 9. Setup deep links (optional)
|
|
|
|
Many sign in methods require deep links to redirect the user back to your app after authentication. Read more about setting deep links up for all platforms (including web) in the [Flutter Mobile Guide](/docs/guides/getting-started/tutorials/with-flutter#setup-deep-links).
|
|
|
|
## Going to production
|
|
|
|
### Android
|
|
|
|
In production, your Android app needs explicit permission to use the internet connection on the user's device which is required to communicate with Supabase APIs.
|
|
To do this, add the following line to the `android/app/src/main/AndroidManifest.xml` file.
|
|
|
|
```xml
|
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
<!-- Required to fetch data from the internet. -->
|
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
<!-- ... -->
|
|
</manifest>
|
|
```
|
|
|
|
## Next steps
|
|
|
|
- Learn how to build a complete user management app with authentication in the [Flutter tutorial](/docs/guides/getting-started/tutorials/with-flutter)
|
|
- Explore the [supabase-flutter](https://github.com/supabase/supabase-flutter) library on GitHub
|
|
- [Insert more data](/docs/guides/database/import-data) into your database
|
|
- Upload and serve static files using [Storage](/docs/guides/storage)
|