Client Libraries
The Supabase Client makes it simple for developers to build secure and scalable products.
Auth
Create new users using signUp()
.
- JavaScript
- Python
const { error, data } = await supabase.auth.signUp({
email: 'example@email.com',
password: 'example-password',
})
Existing users can log in using signIn()
.
- JavaScript
- Python
const { error, data } = await supabase.auth.signIn({
email: 'example@email.com',
password: 'example-password',
})
If there is an email, but no password passed to signIn()
, the user will receive a magic link.
- JavaScript
- Python
const { error, data } = await supabase.auth.signIn({
email: 'example@email.com'
})
Third party logins are also handled through signIn()
.
- JavaScript
- Python
const { user, error } = await supabase.auth.signIn({
// provider can be 'github', 'google', 'gitlab', or 'bitbucket'
provider: 'github'
})
Managing data
Since Postgres is a Relational database, the client makes it simple to query tables and fetch related data in one round-trip, using select()
.
- JavaScript
- Python
const { data, error } = await supabase
.from('countries')
.select(`
name,
cities (
name
)
`)
You can do advanced filtering to extract only the data that you need.
- JavaScript
- Python
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.lt('country_id', 100)
.limit(10)
You can create data easiely using insert()
.
- JavaScript
- Python
const { data, error } = await supabase
.from('cities')
.insert([
{ name: 'The Shire', country_id: 554 },
{ name: 'Rohan', country_id: 555 },
])
Realtime Changes
The Supabase client makes it simple to listen to realtime database changes, using subscribe()
.
- JavaScript
- Python
const mySubscription = supabase
.from('countries')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
You can even listen to Row Level changes.
- JavaScript
- Python
const mySubscription = supabase
.from('countries:id.eq.200')
.on('UPDATE', handleRecordUpdated)
.subscribe()
Next steps
- View the Client Docs
- Sign in: app.supabase.io