Supabase Setup
Supabase is an open-source Firebase alternative that provides authentication, database, and storage services. This guide shows you how to integrate Supabase authentication with your Dev Portal documentation site.
You can use email and password (Supabase signs users in with an email address and password), OAuth providers (GitHub, Google, and so on), or both. Follow the section that matches how you want users to sign in.
Prerequisites
You'll need a Supabase project. If you don't have one, create a free Supabase project to get started.
Setup Steps for Email and Password
Use this path when users should sign up and sign in with an email address and password managed by Supabase.
-
Enable email authentication in Supabase
In your Supabase Dashboard:
- Select the project you are going to use
- Go to Authentication → Configuration → Sign In / Providers
- Under Email, ensure Email sign-in is enabled
- Decide whether new users must confirm their email before signing in (see Confirm email in the same area). If confirmation is required, Supabase sends a link that returns users to your Dev Portal portal (see Authentication Routes)
-
Copy your Supabase URL and publishable key
From your Supabase project dashboard:
- Go to Project Settings → Integrations → Data API
- Copy your API URL (looks like
https://your-project-id.supabase.co) - Go to Configuration → API Keys
- Copy your publishable key (looks like
sb_publishable_...)
-
Configure Zudoku
Add the following to your Dev Portal configuration file. Omit
providersor set it to an empty array when you are only using email and password:zudoku.config.ts -
Install Supabase dependencies
Install the packages Dev Portal expects for the Supabase client and auth UI:
Code -
Configure redirect URLs in Supabase
Supabase only redirects to URLs you allow. This matters for email confirmation, password reset, and magic links (if you use them elsewhere).
From your Supabase project dashboard, go to Authentication → Configuration → URL Configuration and set:
- Site URL: Your primary deployed URL (for example
https://docs.example.com), orhttp://localhost:3000while developing locally. - Redirect URLs: Include every origin where your docs run, with a path wildcard so deep links
work, for example:
- Production:
https://docs.example.com/** - Local dev:
http://localhost:3000/**
- Production:
Use the same origins and base path you use in the browser.
- Site URL: Your primary deployed URL (for example
Setup Steps for Authentication Providers
Use this path when users should sign in with OAuth (for example GitHub or Google). Set
onlyThirdPartyProviders: true if you do not want email and password fields on the sign-in and
sign-up pages.
-
Configure Authentication Provider
In your Supabase Dashboard:
- Select the Supabase project you are going to use
- Navigate to Authentication → Configuration → Sign In / Providers
- Enable your preferred authentication provider (GitHub, Google, Azure, etc.)
- Follow the Supabase configuration documentation for that provider
-
Copy your Supabase URL and publishable key
From your Supabase project dashboard:
- Go to Project Settings → Integrations → Data API
- Copy your API URL (looks like
https://your-project-id.supabase.co) - Go to Configuration → API Keys
- Copy your publishable key (looks like
sb_publishable_...)
-
Configure Zudoku
Add the following to your Dev Portal configuration file, using the API URL and publishable key from the previous step. Include every OAuth provider you enabled in Supabase in the
providersarray (see Supported Providers):zudoku.config.ts -
Install Supabase dependencies
Install the Supabase client and auth UI packages your Dev Portal project expects:
Code -
Configure redirect URLs in Supabase
Supabase only redirects back to URLs you allow. Add every environment where users sign in:
From your Supabase project dashboard, go to Authentication → Configuration → URL Configuration and update:
- Site URL: Your primary deployed URL (for example
https://docs.example.com), orhttp://localhost:3000while developing locally. - Redirect URLs: Include your Dev Portal site origin(s), for example:
- Production:
https://docs.example.com/** - Local dev:
http://localhost:3000/** - Preview deployments: a pattern your host uses, such as
https://*.vercel.app/**, if applicable.
- Production:
Use the same paths you use in the browser (including any base path prefix). If OAuth redirects fail or send users to the wrong host, this section is usually the cause.
- Site URL: Your primary deployed URL (for example
Supported Providers
Supabase supports numerous authentication providers. Use any of these values in the providers
array:
apple- Sign in with Appleazure- Microsoft Azure ADbitbucket- Bitbucketdiscord- Discordfacebook- Facebookfigma- Figmagithub- GitHubgitlab- GitLabgoogle- Googlekakao- Kakaokeycloak- Keycloaklinkedin/linkedin_oidc- LinkedInnotion- Notionslack/slack_oidc- Slackspotify- Spotifytwitch- Twitchtwitter- Twitter/Xworkos- WorkOSzoom- Zoomfly- Fly.io
Email and Password with OAuth
To offer both email/password and OAuth buttons, leave onlyThirdPartyProviders unset (or set it
to false) and list your OAuth providers in providers. Complete
Enable email authentication in Supabase and
Configure Authentication Provider as needed, then use a config
similar to:
zudoku.config.ts
Configuring Multiple Providers
Complete Configure Authentication Provider in the Supabase
dashboard for each provider you need, then list them in the providers array:
zudoku.config.ts
Configuration Options
All available configuration options for Supabase authentication:
zudoku.config.ts
Authentication Routes
The Supabase authentication provider automatically creates the following routes:
/signin- Sign in (email and password when enabled, plus any configured OAuth providers)/signup- Sign up (same as sign-in)/signout- Sign out
If you configure a custom basePath, these routes will be prefixed with that path (e.g.,
/docs/signin).
Advanced Configuration
User Profile Data
Dev Portal automatically extracts the following user information from Supabase authentication:
sub- User ID from Supabaseemail- User's email addressname- User's full name (fromuser_metadata.full_nameoruser_metadata.name)emailVerified- Whether the email has been confirmedpictureUrl- User's avatar URL (fromuser_metadata.avatar_url)
Additional User Metadata
To store and access additional user information beyond what's provided by Supabase authentication:
- Create a
profilestable in your Supabase database - Set up a database trigger to create profile records on user signup
- Use the Supabase client to query this data in your application
Example profile table structure:
Code
Troubleshooting
Common Issues
-
OAuth sign-in shows no provider buttons: For OAuth-only setups, add at least one provider ID to the
providersarray that matches a provider you enabled in Supabase. For email and password only, you can useproviders: []— see Setup Steps for Email and Password. -
Email/password fields when you want OAuth only: Set
onlyThirdPartyProviders: trueso the sign-in and sign-up screens show only OAuth buttons. Leave this unset (orfalse) when you want email and password fields — see Setup Steps for Email and Password. -
Invalid API key: Use the publishable client key in
supabaseKey, not the secret (service role) key. -
Provider Not Working: Verify the provider is enabled in your Supabase dashboard and properly configured with the correct redirect URLs.
-
Redirect URLs: For local development, update your redirect URLs in both Supabase and the OAuth provider to include
http://localhost:3000. -
CORS Errors: Check that your site's domain is properly configured in Supabase's allowed URLs under Authentication → URL Configuration.
-
Authentication Not Working: Make sure you have installed
@supabase/supabase-jsin your project dependencies.
Next Steps
- Explore Supabase Auth documentation for advanced features
- Learn about protecting routes in your documentation