A small browser app for managing personal tasks. It uses email and password authentication and stores todos in Supabase (Postgres) with Row Level Security so each user only sees their own rows.
- Sign up, sign in, and sign out
- Create, read, update, and delete todos (add, complete via checkbox, inline edit, delete, clear all completed)
- Data persisted in your Supabase project; session handled in the browser by the Supabase client
- HTML, CSS, and JavaScript (ES modules)
- Supabase for Auth and database
@supabase/supabase-jsloaded from an ESM CDN (esm.sh)
- A Supabase account and a new or existing project
- Python 3 (or any static file server) to serve the files over HTTP locally
Node.js is not required to run the app.
-
Clone or download this repository and open the project folder (the one that contains
index.html). -
Configure Supabase credentials
- Copy
config.example.jstoconfig.js. - In the Supabase dashboard, open Project Settings → API.
- Set
SUPABASE_URLto your Project URL andSUPABASE_ANON_KEYto the anon public key (not theservice_rolekey).
- Copy
-
Create the database objects
- In Supabase, open SQL Editor, paste the contents of
supabase/schema.sql, and run it once. - This creates the
todostable, indexes, RLS policies, and anupdated_attrigger.
- In Supabase, open SQL Editor, paste the contents of
-
Auth
- Under Authentication → Providers, ensure Email is enabled (default on many projects).
- If email confirmation is required for your project, complete the confirmation link in your inbox before signing in.
From the project directory:
python3 -m http.server 8080Then open http://localhost:8080 in your browser.
Use http:// (or https:// if you use another server with TLS). Opening index.html via file:// may break ES module loading.
| Path | Purpose |
|---|---|
index.html |
Page structure and script entry |
styles.css |
Layout and styling |
app.js |
Supabase client, auth, and todo UI |
config.example.js |
Example exports for URL and anon key |
config.js |
Your real keys (create locally; listed in .gitignore) |
supabase/schema.sql |
Table, RLS, and trigger (run in Supabase SQL Editor) |
.gitignore |
Keeps local secrets out of version control |
LICENSE |
License terms (MIT) |
These diagrams explain how the app is structured and how data flows from the browser to Supabase.
flowchart LR
U[User in Browser] --> UI[index.html + styles.css + app.js]
UI --> C[Supabase JS Client]
C --> A[Supabase Auth]
C --> D[(Supabase Postgres: todos table)]
D --> RLS[Row Level Security Policies]
CFG[config.js<br/>URL + anon key] --> UI
SQL[supabase/schema.sql] --> D
- The app is frontend-only (no custom backend server).
- The browser uses the Supabase client directly for auth and database CRUD.
- RLS policies in Postgres enforce per-user data isolation.
sequenceDiagram
autonumber
participant User
participant Browser as Browser App (app.js)
participant Auth as Supabase Auth
participant DB as Postgres (todos + RLS)
User->>Browser: Open app
Browser->>Auth: getSession()
alt Session exists
Browser->>DB: SELECT todos ORDER BY created_at
DB-->>Browser: Only rows where auth.uid() = user_id
Browser-->>User: Show todo list
else No session
Browser-->>User: Show sign-in/sign-up form
end
User->>Browser: Sign in / Sign up
Browser->>Auth: signInWithPassword / signUp
Auth-->>Browser: Session / auth response
Browser->>DB: CRUD todos
DB-->>Browser: RLS-filtered result
Browser-->>User: Updated UI
- On load, the app checks for a session.
- If authenticated, it loads todos; otherwise, it shows auth UI.
- Every todo read and write still goes through RLS checks.
flowchart TD
IDX[index.html] --> APP[app.js]
IDX --> CSS[styles.css]
APP --> AUTHUI[Auth section UI]
APP --> TODOUI[Todo list UI]
APP --> CFG[config.js]
APP --> SB[Supabase client]
SB --> AUTH["auth.* APIs"]
SB --> TODOS["from('todos') CRUD"]
index.htmlprovides the DOM structure.app.jshandles auth state, UI events, and Supabase operations.config.jsinjects project URL and anon key into the app.
erDiagram
AUTH_USERS ||--o{ TODOS : owns
AUTH_USERS {
uuid id PK
string email
}
TODOS {
uuid id PK
uuid user_id FK
text text
boolean completed
timestamptz created_at
timestamptz updated_at
}
- Each todo row belongs to one authenticated user.
- Policy rule concept: allow access only when
auth.uid() = todos.user_id. - This is why the anon key can be used in frontend safely when RLS is correct.
flowchart TD
A[Clone repo] --> B[Create config.js from config.example.js]
B --> C[Set SUPABASE_URL + SUPABASE_ANON_KEY]
A --> D[Run supabase/schema.sql in Supabase SQL Editor]
C --> E[Run local static server]
D --> E
E --> F[App works: auth + todos]
- Both config and schema setup are required before local run.
- Missing either step leads to auth and database errors.
- Never commit the
service_rolekey, database password, or other secrets. Only the anon public key belongs in the frontend; RLS policies restrict data access per user. config.jsis ignored by git. Do not commit ad-hoc copies of keys in other files either; see.gitignore.- If a secret was ever pushed to a public repository, rotate that key in the Supabase dashboard and remove it from git history if needed.
- Blank page or module / import errors in the console — Serve the folder with a local HTTP server; do not rely on
file://. - Auth errors after sign up — Confirm your email if the project requires it, or try signing in with the correct password.
- Todos do not load or requests fail — Ensure you are signed in,
schema.sqlran successfully, andconfig.jsuses the correct project URL and anon key.
This project is licensed under the MIT License. See the LICENSE file in the repository root for the full text.