Supabase
Setup
Go to the API Settings page in the Dashboard.
Find your Project URL and Anon keys
Set the values in
config.ts
supabase: { isSetup: true, // make this true url: "SUPABASE_URL", // replace your url here anonKey: "SUPABASE_ANON_KEY" // replace your anon key here },
Database Types
Run the following command in the root of your project. You can find your project id under supabase project settings.
npx supabase gen types typescript --project-id "YOUR_PROJECT_ID" --schema public > ./utils/supabaseTypes.ts
Import the type to utils/supabase.ts
import 'react-native-url-polyfill/auto';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { createClient } from '@supabase/supabase-js';
import { Database } from './supabaseTypes';
const supabaseUrl = "YOUR_REACT_NATIVE_SUPABASE_URL";
const supabaseAnonKey = "YOUR_REACT_NATIVE_SUPABASE_ANON_KEY";
export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey, {
auth: {
storage: AsyncStorage,
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false,
},
});
Note: you will need to re-run the command every time you change things in supabase
Last updated