Create a Supabase project, enable auth providers, and build sign-up/login/logout in a web app.
Supabase gives you: a PostgreSQL database, auth system, file storage, edge functions, and realtime subscriptions — from one dashboard. The free tier covers most projects.
npm install @supabase/supabase-jsimport { createClient } from '@supabase/supabase-js';
export const supabase = createClient(
import.meta.env.VITE_SUPABASE_URL,
import.meta.env.VITE_SUPABASE_ANON_KEY
);import { supabase } from './supabase';
// Email/password sign up
const { data, error } = await supabase.auth.signUp({
email: '[email protected]',
password: 'securepassword'
});
// Login
const { data: { session } } = await supabase.auth.signInWithPassword({
email: '[email protected]',
password: 'securepassword'
});
// OAuth (Google, GitHub)
await supabase.auth.signInWithOAuth({
provider: 'google',
options: { redirectTo: window.location.origin }
});
// Logout
await supabase.auth.signOut();
// Get current user
const { data: { user } } = await supabase.auth.getUser();
// Listen to auth changes
supabase.auth.onAuthStateChange((event, session) => {
console.log(event, session?.user);
});signUp creates a new user. signInWithPassword logs in. signOut logs out.onAuthStateChange fires whenever auth state changes — use it to update UI.