Installation
Install the Supabase JavaScript client library:Initializing
Create a single supabase client for interacting with your database.string
required
The unique Supabase URL for your project.
string
required
The Supabase anon key or service role key for your project.
object
Optional configuration parameters.
Database Operations
Select Data
Query data from your tables.array
The returned rows from the query.
PostgrestError | null
Error object if the query failed, null otherwise.
Select with Filters
Select with Joins
Insert Data
Insert rows into your tables.object | array
required
The values to insert. Can be a single object or an array of objects.
array
The inserted rows (if
.select() is used).PostgrestError | null
Error object if the insert failed, null otherwise.
Update Data
Update existing rows in your tables.object
required
The values to update.
Upsert Data
Insert or update rows based on unique constraints.Delete Data
Delete rows from your tables.Authentication
Sign Up
Create a new user account.string
required
The user’s email address.
string
required
The user’s password.
object
Optional parameters.
object
AuthError | null
Error object if signup failed, null otherwise.
Sign In
Sign in an existing user.Sign Out
Sign out the current user.Get Session
Get the current session.Session | null
The current session object or null if no active session.
Get User
Get the current user.User | null
The current user object or null if not authenticated.
Storage
Upload File
Upload a file to a storage bucket.string
required
The file path including the file name.
File | Blob | ArrayBuffer
required
The file data to upload.
object
Upload options.
Download File
Download a file from storage.string
required
The file path to download.
Blob
The file data as a Blob.
List Files
List all files in a bucket.Delete Files
Delete files from storage.Get Public URL
Get the public URL for a file.Realtime
Subscribe to Changes
Listen to database changes in realtime.string
required
The database event to listen for:
INSERT, UPDATE, DELETE, or * for all.string
required
The database schema to listen to.
string
required
The table to listen to.
string
Optional filter for the change events (e.g.,
id=eq.1).Unsubscribe
Stop listening to changes.Edge Functions
Invoke Function
Invoke a Supabase Edge Function.string
required
The name of the Edge Function to invoke.
object
Function invocation options.
any
The response data from the function.
FunctionsError | null
Error object if invocation failed, null otherwise.
TypeScript Support
Generate TypeScript types from your database schema:Error Handling
All methods return an error object if something goes wrong:Additional Resources
GitHub Repository
View the source code and contribute
NPM Package
View package details and versions
