Skip to main content
The dashboard includes four settings pages under /dashboard/settings/*. This guide shows how to customize them and wire fields to your Supabase schema.

Routes

  • /dashboard/settings/general - Profile, preferences, locale
  • /dashboard/settings/account - Password, email, delete account
  • /dashboard/settings/billing - Subscription, invoices
  • /dashboard/settings/notifications - Email/push toggles

Schema types

File: sabo/src/lib/types/database.ts The settings pages map to these Supabase tables:
  • UserProfile - Profile data (name, bio, website, notification prefs)
  • UserSubscription - Stripe subscription (plan, status, period)
  • PaymentHistory - Payment records (amount, invoice URL)

Common pattern

All settings pages follow this flow:
1

Load data

Fetch current values from Supabase (profile, subscription, etc.) in a Server Component or server action.
2

Render form

Use shadcn/ui form components (Input, Switch, Select). Validate with Zod schemas.
3

Persist changes

Submit via server action:
  • General/Notifications: Update UserProfile table
  • Account: Call supabase.auth.updateUser() for password/email
  • Billing: Query UserSubscription + PaymentHistory, link to Stripe Portal
// Example server action
export async function updateProfile(formData: FormData) {
  const supabase = await createClient();
  const { error } = await supabase
    .from("user_profiles")
    .update({ full_name: formData.get("name") })
    .eq("user_id", userId);
  if (error) return { error: error.message };
  revalidatePath("/dashboard/settings/general");
}
4

Confirm success

Show a toast and revalidate the page to reflect changes.

Key notes

  • Account password/email: Use supabase.auth.updateUser(), not database tables
  • Billing: Stripe webhooks populate UserSubscription and PaymentHistory tables
  • Notifications: Store toggles in UserProfile (e.g., email_notifications, push_notifications)

Redirect behavior

Signed‑in users hitting /sign-in//sign-up are redirected to /dashboard.
Signed‑out users visiting /dashboard/* are redirected to /sign-in.
For details on customizing protected routes and auth redirects, see Routing & Middleware.

Troubleshooting

  • Email change not taking effect
    • Verification step is pending. Check the mail provider or Supabase Auth logs.
  • Password updated but session acts stale
    • Revalidate layout/page after update; ensure your middleware refreshes cookies.
  • No subscription data shows
    • Stripe endpoints/webhooks not implemented. Complete Payments setup first.
  • Forms not persisting
    • Ensure server actions write to the correct row (user_id) and you revalidate the route/segment after success.