[!IMPORTANT] Update, September 2026:
This codebase is not being actively maintained by Supabase or the community, but it's not the end of the road... We're busy building an official Supabase SDK for Go that will make this repository and the module it publishes obsolete. This thread has more information, as well as providing a venue for discussion in the meantime.
An isomorphic Go client for Supabase.
Reminder: supabase-go has some APIs that require the service_key rather than the public_key (for instance: the administration of users, bypassing database roles, etc.). If you are using the service_key be sure it is not exposed client side. Additionally, if you need to use both a service account and a public/user account, please do so using a separate client instance for each.
Install the library to your go project:
go get github.com/supabase-community/supabase-go
client, err := supabase.NewClient(API_URL, API_KEY, &supabase.ClientOptions{})
if err != nil {
fmt.Println("Failed to initalize the client: ", err)
}
client, err := supabase.NewClient(url, key, nil)
options := &supabase.ClientOptions{
Headers: map[string]string{
"X-Custom-Header": "custom-value",
},
Schema: "custom_schema", // defaults to "public"
}
client, err := supabase.NewClient(url, key, options)
// ...
data, count, err := client.From("countries").Select("*", "exact", false).Execute()
For more see postgrest-go Query Builder documentation
The client provides comprehensive authentication features through the integrated GoTrue client.
// Sign in with email and password
session, err := client.SignInWithEmailPassword("[email protected]", "password")
if err != nil {
log.Fatal("Sign in failed:", err)
}
fmt.Printf("User ID: %s\n", session.User.ID)
fmt.Printf("Access Token: %s\n", session.AccessToken)
// Sign in with phone and password
session, err := client.SignInWithPhonePassword("+1234567890", "password")
if err != nil {
log.Fatal("Sign in failed:", err)
}
// Refresh an expired token
newSession, err := client.RefreshToken(session.RefreshToken)
if err != nil {
log.Fatal("Token refresh failed:", err)
}
// Enable automatic token refresh in the background
client.EnableTokenAutoRefresh(session)
// The client will automatically:
// - Refresh tokens before they expire (at 75% of expiry time)
// - Retry failed refreshes with exponential backoff
// - Update all service clients with new tokens
Overall
Maintained
Code review
Latest release
Releases this year
167 followers · starred Feb 2026
101 followers · starred Oct 2025
56 followers · starred Jul 2024
[!IMPORTANT] Update, September 2026:
This codebase is not being actively maintained by Supabase or the community, but it's not the end of the road... We're busy building an official Supabase SDK for Go that will make this repository and the module it publishes obsolete. This thread has more information, as well as providing a venue for discussion in the meantime.
An isomorphic Go client for Supabase.
Reminder: supabase-go has some APIs that require the service_key rather than the public_key (for instance: the administration of users, bypassing database roles, etc.). If you are using the service_key be sure it is not exposed client side. Additionally, if you need to use both a service account and a public/user account, please do so using a separate client instance for each.
Install the library to your go project:
go get github.com/supabase-community/supabase-go
client, err := supabase.NewClient(API_URL, API_KEY, &supabase.ClientOptions{})
if err != nil {
fmt.Println("Failed to initalize the client: ", err)
}
client, err := supabase.NewClient(url, key, nil)
options := &supabase.ClientOptions{
Headers: map[string]string{
"X-Custom-Header": "custom-value",
},
Schema: "custom_schema", // defaults to "public"
}
client, err := supabase.NewClient(url, key, options)
// ...
data, count, err := client.From("countries").Select("*", "exact", false).Execute()
For more see postgrest-go Query Builder documentation
The client provides comprehensive authentication features through the integrated GoTrue client.
// Sign in with email and password
session, err := client.SignInWithEmailPassword("[email protected]", "password")
if err != nil {
log.Fatal("Sign in failed:", err)
}
fmt.Printf("User ID: %s\n", session.User.ID)
fmt.Printf("Access Token: %s\n", session.AccessToken)
// Sign in with phone and password
session, err := client.SignInWithPhonePassword("+1234567890", "password")
if err != nil {
log.Fatal("Sign in failed:", err)
}
// Refresh an expired token
newSession, err := client.RefreshToken(session.RefreshToken)
if err != nil {
log.Fatal("Token refresh failed:", err)
}
// Enable automatic token refresh in the background
client.EnableTokenAutoRefresh(session)
// The client will automatically:
// - Refresh tokens before they expire (at 75% of expiry time)
// - Retry failed refreshes with exponential backoff
// - Update all service clients with new tokens
Overall
Maintained
Code review
Latest release
Releases this year
167 followers · starred Feb 2026
101 followers · starred Oct 2025
56 followers · starred Jul 2024