Stack
Server-side logic uses TanStack server functions, not Supabase Edge Functions.
Request flow
chatJSON() → Teagentic AI Gateway → model provider.
Auth wiring
src/integrations/supabase/auth-attacher.tsattaches the user’s bearer token to every server function call (registered asfunctionMiddlewareinsrc/start.ts).src/integrations/supabase/auth-middleware.tsvalidates the token on the server and yields{ supabase, userId, claims }incontext.
Layout routes
src/routes/_authenticated.tsx is a pathless layout with beforeLoad that redirects unauthenticated users to /login. All gated pages live under src/routes/_authenticated/.