Skip to content

Authentication

The authentication pages handle user registration, login, password recovery, email verification, and the post-signup onboarding flow. These routes live in two separate route groups: (auth) for login/registration and (onboarding) for the onboarding wizard.

RouteFileProtection
/sign-in(auth)/sign-in/+page.svelteUnauthenticated only
/sign-up(auth)/sign-up/+page.svelteUnauthenticated only
/forgot-password(auth)/forgot-password/+page.svelteUnauthenticated only
/reset-password(auth)/reset-password/+page.svelteUnauthenticated only
/verify-email(auth)/verify-email/+page.svelteFully public
/auth/callback(auth)/auth/callback/Fully public
/auth/confirm(auth)/auth/confirm/Fully public
/auth/error(auth)/auth/error/+page.svelteFully public
/auth/forgot-password(auth)/auth/forgot-password/Fully public
/auth/reset-password(auth)/auth/reset-password/Fully public
/auth/resend-verification(auth)/auth/resend-verification/Fully public
RouteFileProtection
/onboarding(onboarding)/onboarding/+page.svelteAuthenticated (exempt from onboarding check)
RouteFileProtection
/(marketing)/+page.sveltePublic (authenticated users redirect to /feed)

The (auth) group has its own +layout.svelte that renders a centered card layout without the app sidebar or navigation. This gives auth pages a clean, focused appearance.

The (onboarding) group has a separate +layout.svelte and +layout.server.ts that provide a wizard-style layout with progress steps.

The route guard in hooks.server.ts enforces the following rules for auth-related routes:

  • Can access /sign-in, /sign-up, /forgot-password, /reset-password, and all /auth/* routes.
  • Attempting to access any protected route redirects to /sign-in.
  • Accessing /sign-in, /sign-up, /forgot-password, or /reset-password redirects to /feed.
  • Accessing the landing page (/) redirects to /feed.
  • All protected routes check the onboards table. If no onboard record exists, the user is redirected to /onboarding.

The sign-in page provides:

  • Email/password login form
  • OAuth social login buttons (via Supabase Auth)
  • Link to sign-up and forgot-password pages

The +page.server.ts handles the form submission by calling supabase.auth.signInWithPassword().

The registration page collects:

  • Email address
  • Password (with confirmation)
  • Agreement to terms

The +page.server.ts calls supabase.auth.signUp() and sends a confirmation email.

Allows users to request a password reset link. Submits the email to supabase.auth.resetPasswordForEmail().

The password reset form where users set a new password using the token from their email link.

Displays a confirmation message after signup prompting the user to check their email. The +page.server.ts may handle resend logic.

The /auth/* routes handle server-side callbacks and actions:

RoutePurpose
/auth/callbackOAuth redirect handler — exchanges the auth code for a session
/auth/confirmEmail confirmation link handler
/auth/errorDisplays authentication error messages
/auth/forgot-passwordServer action for password reset request
/auth/reset-passwordServer action for password update
/auth/resend-verificationResend the verification email

After a new user verifies their email and signs in for the first time, they land on the onboarding page. This wizard collects:

  • Profile information (name, avatar)
  • Interests and preferences
  • Initial follow suggestions

The +page.server.ts reads the current onboarding state and processes step submissions. Once all steps are complete, it creates a record in the onboards table, allowing the user to proceed to /feed.

The marketing landing page at the root URL is served from (marketing)/+page.svelte. Authenticated users are immediately redirected to /feed by the route guard.