SupabaseS
Supabase4mo ago
Tom

Sveltekit protected routes question

as per the docs https://supabase.com/docs/guides/auth/server-side/sveltekit

In the hooks.server.ts:
if (!event.locals.session && event.url.pathname.startsWith('/private')) {
    redirect(303, '/auth')
  }


So any route I want to "protect" I need to add it to this if check? Or put protected routes into the /protected directory? Bit confused on what's the way its supposed to work.
Screenshot_2025-08-28_at_19.13.38.png
Was this page helpful?