Skip to main content

Stack

Server-side logic uses TanStack server functions, not Supabase Edge Functions.

Request flow

For AI calls, the server function calls chatJSON() → Teagentic AI Gateway → model provider.

Auth wiring

  • src/integrations/supabase/auth-attacher.ts attaches the user’s bearer token to every server function call (registered as functionMiddleware in src/start.ts).
  • src/integrations/supabase/auth-middleware.ts validates the token on the server and yields { supabase, userId, claims } in context.

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/.