Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

update

Joshen Limadac616e8676
diff --git a/apps/temp-docs/docs/reference/dart/initializing.mdx b/apps/temp-docs/docs/reference/dart/initializing.mdx
new file mode 100644
index 00000000000..3a76f300c65
--- /dev/null
+++ b/apps/temp-docs/docs/reference/dart/initializing.mdx
@@ -0,0 +1,42 @@
+---
+id: initializing
+title: 'Initializing'
+slug: initializing
+---
+
+import Tabs from '@theme/Tabs'
+import TabItem from '@theme/TabItem'
+
+## Flutter
+
+For `supabase-flutter`, you will be using the static `initialize()` method on `Supabase` class.
+
+### Flutter `initialize()`
+
+```dart title="main.dart"
+Future<void> main() async {
+ await Supabase.initialize(url: 'https://xyzcompany.supabase.co', anonKey: 'public-anon-key');
+ runApp(MyApp());
+}
+```
+
+### Access `SupabaseClient` instance
+
+Once you initialize Supabase in your `main()` method, you can access the `SupabaseClient` instance from anywhere in your app.
+
+```dart
+final supabase = Supabase.instance.client;
+```
+
+## Other Dart Projects
+
+You can initialize a new Supabase client using the `SupabaseClient()` method.
+
+The Supabase client is your entrypoint to the rest of the Supabase functionality
+and is the easiest way to interact with everything we offer within the Supabase ecosystem.
+
+### Dart `SupabaseClient()`
+
+```dart
+final supabase = SupabaseClient('https://xyzcompany.supabase.co', 'public-anon-key');
+```
diff --git a/apps/temp-docs/docs/reference/dart/installing.mdx b/apps/temp-docs/docs/reference/dart/installing.mdx
new file mode 100644
index 00000000000..49822681a67
--- /dev/null
+++ b/apps/temp-docs/docs/reference/dart/installing.mdx
@@ -0,0 +1,24 @@
+---
+id: installing
+title: 'Installing'
+slug: installing
+---
+
+import Tabs from '@theme/Tabs'
+import TabItem from '@theme/TabItem'
+
+## Flutter
+
+For Flutter project, you can use [supabase_flutter](https://pub.dev/packages/supabase_flutter) package.
+
+```bash
+flutter pub add supabase_flutter
+```
+
+## Other Dart projects
+
+For non-Flutter projects using Dart, such as server-side Dart or Angular-Dart, you can use the [supabase](https://pub.dev/packages/supabase) package.
+
+```bash
+dart pub add supabase
+```
diff --git a/apps/temp-docs/docs/reference/dart/upgrade-guide.mdx b/apps/temp-docs/docs/reference/dart/upgrade-guide.mdx
new file mode 100644
index 00000000000..5ceb6784e50
--- /dev/null
+++ b/apps/temp-docs/docs/reference/dart/upgrade-guide.mdx
@@ -0,0 +1,581 @@
+---
+id: upgrade-guide
+title: Upgrade to supabase-flutter v1
+description: 'Learn how to upgrade to supabase-flutter v1.'
+---
+
+import Tabs from '@theme/Tabs'
+import TabItem from '@theme/TabItem'
+
+supabase-flutter focuses on improving the developer experience and making it easier to use. This guide will help you upgrade from supabase-flutter v0 to v1.
+
+## Upgrade the client library
+
+Update the package in your pubspec.yaml file.
+
+```yaml
+supabase_flutter: ^1.0.0
+```
+
+## Error handling
+
+The way supabase-flutter throws error has changed in v1. In v0, errors were returned as a response. In v1, errors are thrown as exceptions. This makes it more intuitive as a Flutter developer to handle errors.
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+final res = await supabase.from('my_table').select().execute();
+final error = res.error;
+if(error != null) {
+ // handle error
+}
+final data = res.data;
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+try {
+ final data = supabase.from('my_table').select();
+} catch (error) {
+ // handle error
+}
+```
+
+</TabItem>
+</Tabs>
+
+## Auth classes / methods
+
+### Usage of `SupabaseAuthState` and `SupabaseAuthRequiredState` classes
+
+In v0, `SupabaseAuthState` and `SupabaseAuthRequiredState` were required to handle automatic token refresh and to listen to auth state change. In v1, `SupabaseAuthState` and `SupabaseAuthRequiredState` are deprecated, and token refresh will happen automatically just by initializing Supabase. [`onAuthStateChange`](/docs/reference/dart/upgrade-guide#listening-to-auth-state-change) can be used to action on auth state change.
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await Supabase.initialize(
+ url: 'SUPABASE_URL',
+ anonKey: 'SUPABASE_ANON_KEY',
+);
+...
+
+class AuthState<T extends StatefulWidget> extends SupabaseAuthState<T> {
+ ...
+}
+
+...
+
+class AuthRequiredState<T extends StatefulWidget> extends SupabaseAuthState<T> {
+ ...
+}
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await Supabase.initialize(
+ url: 'SUPABASE_URL',
+ anonKey: 'SUPABASE_ANON_KEY',
+);
+```
+
+</TabItem>
+</Tabs>
+
+### Listening to auth state change
+
+`onAuthStateChange` now returns a `Stream`.
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+final authSubscription = supabase.auth.onAuthStateChange((event, session) {
+ // handle auth state change
+});
+
+// Unsubscribe when no longer needed
+authSubscription.data?.unsubscribe();
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+final authSubscription = supabase.auth.onAuthStateChange.listen((data) {
+ final AuthChangeEvent event = data.event;
+ final Session? session = data.session;
+ // handle auth state change
+ });
+
+// Unsubscribe when no longer needed
+authSubscription.cancel();
+```
+
+</TabItem>
+</Tabs>
+
+### Sign in with email and password
+
+The signIn() method has been deprecated in favor of more explicit method signatures to help with type hinting. Previously it was difficult for developers to know what they were missing (e.g., a lot of developers didn't realize they could use passwordless magic links).
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await supabase.auth.signIn(email: email, password: password);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.auth.signInWithPassword(email: email, password: password);
+```
+
+</TabItem>
+</Tabs>
+
+### Sign in with magic link
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await supabase.auth.signIn(email: email);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.auth.signInWithOtp(email: email);
+```
+
+</TabItem>
+</Tabs>
+
+### Sign in with a third-party OAuth provider
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await supabase.auth.signInWithProvider(
+ Provider.github,
+ options: AuthOptions(
+ redirectTo: kIsWeb
+ ? null
+ : 'io.supabase.flutter://reset-callback/'),
+);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.auth.signInWithOAuth(
+ Provider.github,
+ redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
+);
+```
+
+</TabItem>
+</Tabs>
+
+### Sign in with phone
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await supabase.auth.signIn(
+ phone: '+13334445555',
+ password: 'example-password',
+);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.auth.signInWithPassword(
+ phone: '+13334445555',
+ password: 'example-password',
+);
+```
+
+</TabItem>
+</Tabs>
+
+### Sign in with phone using OTP
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+final res = await supabase.auth.signIn(phone: phone);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.auth.signInWithOtp(
+ phone: phone,
+);
+
+// After receiving a SMS with a OTP.
+await supabase.auth.verifyOTP(
+ type: OtpType.sms,
+ token: token,
+ phone: phone,
+);
+```
+
+</TabItem>
+</Tabs>
+
+### Reset password for email
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await supabase.auth.api.resetPasswordForEmail(
+ email,
+ options:
+ AuthOptions(redirectTo: 'io.supabase.flutter://reset-callback/'),
+);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.auth.resetPasswordForEmail(
+ email,
+ redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
+);
+```
+
+</TabItem>
+</Tabs>
+
+### Get the user's current session
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+ final session = supabase.auth.session();
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+final Session? session = supabase.auth.currentSession;
+```
+
+</TabItem>
+</Tabs>
+
+### Get the logged-in user
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+final user = supabase.auth.user();
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+final User? user = supabase.auth.currentUser;
+```
+
+</TabItem>
+</Tabs>
+
+### Update user data for a logged-in user
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await supabase.auth.update(
+ UserAttributes(data: {'hello': 'world'})
+);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.updateUser(
+ UserAttributes(
+ data: { 'hello': 'world' },
+ ),
+);
+```
+
+</TabItem>
+</Tabs>
+
+## Data methods
+
+`.insert()` / `.upsert()` / `.update()` / `.delete()` don't return rows by default.
+
+Previously, these methods return inserted/updated/deleted rows by default (which caused [some confusion](https://github.com/supabase/supabase/discussions/1548)), and you can opt to not return it by specifying `returning: 'minimal'`. Now the default behavior is to not return rows. To return inserted/updated/deleted rows, add a `.select()` call at the end.
+
+Also, calling `.execute()` at the end of the query was a requirement in v0, but in v1 `.execute` is deperecated.
+
+### Insert without returning inserted data
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+await supabase
+ .from('my_table')
+ .insert(data, returning: ReturningOption.minimal)
+ .execute();
+
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.from('my_table').insert(data);
+```
+
+</TabItem>
+</Tabs>
+
+### Insert with returning inserted data
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+final res = await supabase
+ .from('my_table')
+ .insert(data)
+ .execute();
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+final insertedData = await supabase.from('my_table').insert(data).select();
+```
+
+</TabItem>
+</Tabs>
+
+## Realtime methods
+
+### Stream
+
+`.stream()` no longer needs the `.execute()` at the end. Also, filtering by `eq` is a lot easier now. `primaryKey` is now a named parameter to make it more obvious what to pass.
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+supabase.from('my_table:id=eq.120')
+ .stream(['id'])
+ .listen();
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+supabase.from('my_table')
+ .stream(primaryKey: ['id'])
+ .eq('id', '120')
+ .listen();
+```
+
+</TabItem>
+</Tabs>
+
+### Subscribe
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+final subscription = supabase
+ .from('countries')
+ .on(SupabaseEventTypes.all, (payload) {
+ // Handle realtime payload
+ })
+ .subscribe();
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+final channel = supabase.channel('*');
+channel.on(
+ RealtimeListenTypes.postgresChanges,
+ ChannelFilter(event: '*', schema: '*'),
+ (payload, [ref]) {
+ // Handle realtime payload
+ },
+).subscribe();
+```
+
+</TabItem>
+</Tabs>
+
+### Unsubscribe
+
+<Tabs
+ groupId="version"
+ values={[
+ {label: 'Before', value: '0.x'},
+ {label: 'After', value: '1.x'},
+ ]}>
+
+<TabItem value="0.x">
+
+```dart
+supabase.removeSubscription(subscription);
+```
+
+</TabItem>
+
+<TabItem value="1.x">
+
+```dart
+await supabase.removeChannel(channel);
+```
+
+</TabItem>
+</Tabs>
diff --git a/apps/temp-docs/docs/reference/javascript/release-notes.md b/apps/temp-docs/docs/reference/javascript/release-notes.mdx
similarity index 100%
rename from apps/temp-docs/docs/reference/javascript/release-notes.md
rename to apps/temp-docs/docs/reference/javascript/release-notes.mdx
diff --git a/apps/temp-docs/docs/reference/javascript/typescript-support.md b/apps/temp-docs/docs/reference/javascript/typescript-support.mdx
similarity index 100%
rename from apps/temp-docs/docs/reference/javascript/typescript-support.md
rename to apps/temp-docs/docs/reference/javascript/typescript-support.mdx
diff --git a/apps/temp-docs/package.json b/apps/temp-docs/package.json
index 27cc92fd1e8..a538b9f53b6 100644
--- a/apps/temp-docs/package.json
+++ b/apps/temp-docs/package.json
@@ -4,32 +4,25 @@
"private": true,
"scripts": {
"dev": "next dev --port 3001",
- "build": "npm run generate:all && next build",
+ "build": "next build",
"start": "next start",
"lint": "next lint",
-
"generate:all": "npm-run-all --parallel gen:api gen:cli gen:gotrue gen:storage gen:supabase-dart:v0 gen:supabase-dart:v1 gen:supabase-js:v1 gen:supabase-js:v2",
-
"gen:api": "npm-run-all gen:api:usage",
"gen:api:usage": "ts-node ./generator/index.ts gen --type api --url https://api.supabase.com --input ../../spec/transforms/api_v0_openapi_deparsed.json --output ./docs/reference/api/generated/usage.mdx",
-
"gen:cli": "npm-run-all gen:cli:commands gen:cli:config",
"gen:cli:commands": "ts-node ./generator/index.ts gen --type cli --input ../../spec/cli_v1_commands.yaml --output ./docs/reference/cli/generated/usage.mdx ",
"gen:cli:config": "ts-node ./generator/index.ts gen --type config --input ../../spec/cli_v1_config.yaml --output ./docs/reference/cli/generated/config.mdx",
-
"gen:gotrue": "npm-run-all gen:gotrue:config gen:gotrue:usage",
"gen:gotrue:config": "ts-node ./generator/index.ts gen --type config --input ../../spec/gotrue_v1_config.yaml --output ./docs/reference/auth/generated/config.mdx",
"gen:gotrue:usage": "ts-node ./generator/index.ts gen --type api --input ../../spec/transforms/auth_v1_openapi_deparsed.json --output ./docs/reference/auth/generated/usage.mdx",
-
"gen:storage": "npm-run-all gen:storage:api gen:storage:config",
"gen:storage:api": "ts-node ./generator/index.ts gen --type api --input ../../spec/transforms/storage_v0_openapi_deparsed.json --output ./docs/reference/storage/generated/usage.mdx",
"gen:storage:config": "ts-node ./generator/index.ts gen --type config --input ../../spec/storage_v0_config.yaml --output ./docs/reference/storage/generated/config.mdx",
-
"gen:supabase-dart:v0": "npm-run-all gen:supabase-dart:v0:ref",
"gen:supabase-dart:v0:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_dart_v0.yml --output ./docs/reference/dart/v0/generated",
"gen:supabase-dart:v1": "npm-run-all gen:supabase-dart:v1:ref",
"gen:supabase-dart:v1:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_dart_v1.yml --output ./docs/reference/dart/generated",
-
"gen:supabase-js:v1": "npm-run-all gen:supabase-js:v1:ref",
"gen:supabase-js:v1:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v1.yml --output ./docs/reference/javascript/v1/generated",
"gen:supabase-js:v2": "npm-run-all gen:supabase-js:v2:ref",