This guide shows you how to use the RDS Supabase SDK in various programming languages.
Prerequisites
Supabase URL and Supabase Key
-
Go to the RDS console homepage. In the left-side navigation pane, click AI Application Development .
-
Select a region at the top. In the RDS Supabase list, find your target project and click View Details in the Actions column.
-
On the Basic Information page, in the White list information section, click Create Whitelist to add your client's IP address.
-
In the Network Information section, click the Outside the network connection address to open the RDS Supabase login page.
-
Enter the default username Supabase and the password to log in to your RDS Supabase project.
-
Click Connect. In the Connect to your project dialog box, click App Frameworks to get your Supabase URL and Supabase Key.
Set Framework to Next.js, Using to App Router, and With to supabase-js. On the .env.local tab, you can find the environment variables
NEXT_PUBLIC_SUPABASE_URLandNEXT_PUBLIC_SUPABASE_ANON_KEY.
SDKs by language
JavaScript
-
Install the
@supabase/supabase-jspackage.npm install @supabase/supabase-js -
Use the Supabase SDK in your code. The following is an example:
import { createClient } from "@supabase/supabase-js"; // Store your Supabase URL and Key in environment variables for security, // which prevents them from being exposed in client-side code. const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL; const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY; const supabase = createClient(supabaseUrl, supabaseKey);
Python
-
Install the
supabasepackage.pip install supabase -
Use the Supabase SDK in your code. The following is an example:
import os from supabase import create_client, Client # Load environment variables for security. url: str = os.environ.get("SUPABASE_URL") key: str = os.environ.get("SUPABASE_KEY") supabase: Client = create_client(url, key)
Flutter
-
Install the
supabase_flutterpackage.flutter pub add supabase_flutter -
Use the Supabase SDK in your code. The following is an example:
Future<void> main() async { await Supabase.initialize( // Load the URL and key from a secure configuration for security. url: 'YOUR_SUPABASE_URL', anonKey: 'YOUR_SUPABASE_ANON_KEY', ); runApp(MyApp()); } // Get a reference to your Supabase client final supabase = Supabase.instance.client;
Swift
-
Install the
supabase-swiftpackage by adding it as a dependency in your Package.swift file.let package = Package( ... dependencies: [ ... .package( url: "https://github.com/supabase/supabase-swift.git", from: "2.0.0" ), ], targets: [ .target( name: "YourTargetName", dependencies: [ .product( name: "Supabase", // Auth, Realtime, Postgrest, Functions, or Storage package: "supabase-swift" ), ] ) ] ) -
Use the Supabase SDK in your code. The following is an example:
import Supabase // Load the URL and key from a secure configuration for security. let client = SupabaseClient( supabaseURL: URL(string: "YOUR_SUPABASE_URL")!, supabaseKey: "YOUR_SUPABASE_ANON_KEY" )
C#
-
Install the
supabase-csharppackage.dotnet add package supabase-csharp -
Use the Supabase SDK in your code. The following is an example:
var url = Environment.GetEnvironmentVariable("SUPABASE_URL"); var key = Environment.GetEnvironmentVariable("SUPABASE_KEY"); var options = new Supabase.SupabaseOptions { AutoConnectRealtime = true }; var supabase = new Supabase.Client(url, key, options); await supabase.InitializeAsync();
Kotlin
Use the Supabase SDK in your code. The following is an example:
val supabase = createSupabaseClient(
// Load the URL and key from a secure configuration for security.
supabaseUrl = "YOUR_SUPABASE_URL",
supabaseKey = "YOUR_SUPABASE_ANON_KEY"
) {
install(Auth)
install(Postgrest)
//install other modules
}
For more information, see https://supabase.com/docs.