How dudusotero/octane-supabase-todo works
Purpose and Runtime
This is a Vite-served Octane client application for authenticated, per-user todo management with Supabase-backed realtime synchronization and avatar storage. It runs against a local Supabase Docker stack; browser code calls @supabase/supabase-js directly.
Entry points:
• index.html
• src/main.ts
• src/App.tsrx
Application Shell and Session Gate
src/main.ts mounts the Octane application and imports global styling. src/App.tsrx is the top-level control boundary: it consumes auth state and selects either the authentication UI or authenticated todo/avatar functionality.
Auth state is modeled as an external store rather than isolated component state:
• src/App.tsrx
• src/lib/session.ts
• src/lib/supabase.ts
This allows session changes from Supabase auth events to propagate consistently across the UI.
Supabase Client Boundary
The repository centralizes Supabase client construction in:
• src/lib/supabase.ts
• .env
• src/lib/database.types.ts
supabase.ts is the sole createClient location. Generated database types constrain client queries and mutations. Environment values target the local Supabase stack, while .env.local can override them.
Authentication Flow
src/Auth.tsrx implements email/password sign-up, sign-in, and sign-out through the shared Supabase client. Successful auth transitions update the session store, which causes App to replace the auth screen with the authenticated application.
Core paths:
• src/Auth.tsrx
• src/lib/session.ts
• src/lib/supabase.ts
Todo Data Access and Realtime Flow
All todo reads and writes are centralized in src/lib/queries.ts; UI components do not define independent database access patterns. src/TodoList.tsrx loads the current user’s todos, invokes query-layer mutations, and subscribes to Supabase Realtime INSERT, UPDATE, and DELETE events.
Core paths:
• src/TodoList.tsrx
• src/lib/queries.ts
• src/lib/supabase.ts
The important boundary is server-enforced ownership: client filtering is not the security mechanism. Realtime updates also cover writes originating outside the current browser.
Avatar Storage Flow
src/AvatarUpload.tsrx uploads a user avatar through Supabase Storage and renders its resulting public URL. Storage policy is enforced server-side, including image-type acceptance and a 2 MB cap.
Core paths:
• src/AvatarUpload.tsrx
• src/lib/supabase.ts
• supabase/migrations/20260811000000_todos_and_avatars.sql
Database, Authorization, and Local Infrastructure
The Supabase migration is the backend contract. It defines the todos schema, row-level security and grants, Realtime publication setup, storage bucket configuration, and storage policies/limits:
• supabase/migrations/20260811000000_todos_and_avatars.sql
• supabase/config.toml
• src/lib/database.types.ts
Operationally, npx supabase start launches the local Docker-backed services; Vite serves the frontend. Resetting the database reapplies the migration, keeping schema, policies, and local behavior reproducible.
Main entry points: supabase.ts Supabase client · App.tsrx Session gate · TodoList.tsrx Todo list · config.toml Supabase services
Components 13
Octane client
- Vite host
index.html - Application mount
src/main.ts - Session gate · Selects unauthenticated or authenticated UI.
src/App.tsrx - Authentication UI
src/Auth.tsrx - Session store · Propagates Supabase auth events across the UI.
src/lib/session.ts - Todo list · Loads user todos and subscribes to change events.
src/TodoList.tsrx - Avatar upload
src/AvatarUpload.tsrx - Todo query layer · Centralizes todo reads and mutations.
src/lib/queries.ts - Supabase client · Sole createClient location.
src/lib/supabase.ts - Database types
src/lib/database.types.ts - Environment settings
.env
Local Supabase stack
- Supabase services · Provides Auth, Postgres, Realtime, and Storage.
supabase/config.toml - Schema and policy contract · Defines todos, RLS, Realtime publication, avatar bucket, and storage policies.
supabase/migrations/20260811000000_todos_and_avatars.sql
Connections 17
- Vite host → Application mount: serves
- Application mount → Session gate: mounts
- Session gate → Session store: consumes
- Session gate → Authentication UI: shows when signed out
- Session gate → Todo list: shows when signed in
- Session gate → Avatar upload: shows when signed in
- Authentication UI → Supabase client: signs in, signs up, signs out
- Supabase client → Session store: auth events update
- Todo list → Todo query layer: loads and mutates
- Todo list → Supabase client: subscribes to Realtime
- Todo query layer → Supabase client: queries todos
- Avatar upload → Supabase client: uploads avatar
- Supabase client → Database types: typed by
- Environment settings → Supabase client: configures local endpoint
- Supabase client → Supabase services: browser API calls
- Schema and policy contract → Supabase services: provisions schema and policies
- Supabase services → Todo list: realtime changes · Includes writes from other clients.