How akshay-gurav-31/expirytracker-pro works
Project Type and Purpose
• This is a single-page, client-heavy web application (“modern web app”) built with vanilla JavaScript and static HTML/CSS pages.
• It uses Supabase as its backend (authentication, PostgreSQL database, real-time synchronization, and object storage).
• Key user flows: signup/login, CRUD operations on items with expiry dates, real-time updates, profile management, notifications, image upload, import/export.
File Structure
• Top-level HTML entry points: login.html, signup.html, dashboard.html, profile.html
• JavaScript modules for feature areas:
• auth.js (authentication logic)
• dashboard.js (item list, add/edit/delete, filtering)
• profile.js (avatar upload, settings)
• notifications.js (trigger browser alerts)
• utils.js (shared helpers)
• config.js (Supabase URL and anon key)
• CSS organization: style.css + per-page files under styles/
• database-schema.sql defines tables and storage policies for avatars and item images.
README for Additional Insights
• Authentication: Supabase Auth with email confirmation and RLS policies
• Database: PostgreSQL
• Storage: Supabase Storage buckets (“avatars”, “items”)
• Real-time: uses Supabase Realtime to push DB changes to clients
• Browser Notifications: Notification API integration
• Import/Export: JSON file persisted locally (no backend storage)
Main Components and Their Relationships
a. Client (Browser)
• Static assets served by any web server (Live Server in dev, S3/Netlify in prod)
• HTML pages load JS modules that call Supabase client library
b. Supabase Platform
• Auth Service (signup, login, JWT issuance)
• Database (PostgreSQL + RLS policies)
• Realtime Layer (WebSocket push of table changes)
• Storage Service (public buckets for avatars & item images)
• Email Delivery (managed by Supabase for confirmations)
c. Browser Notifications API
• Subscribed by notifications.js after user opt-in
d. Local File System (Import/Export)
• JSON read/write via utils.js
Data Flow and Interactions
1. User loads login.html ⇒ auth.js calls Supabase Auth.signIn/signUp APIs
2. Supabase Auth returns JWT ⇒ stored in browser (localStorage or Supabase client)
3. User navigates to dashboard.html ⇒ dashboard.js subscribes to Realtime tables, fetches item data
4. CRUD operations on items ⇒ REST calls to Supabase Database
5. Image upload ⇒ HTTP PUT to Supabase Storage bucket “items” or “avatars”
6. Database triggers real-time broadcasts ⇒ dashboard.js updates UI immediately
7. notifications.js schedules browser notifications based on item expiry dates
8. Profile updates ⇒ profile.js modifies user metadata and avatar in Storage
9. Import/Export ⇒ utils.js serializes item data to JSON / restores it
Architectural Patterns and Design Principles
• Frontend-centric: thin static host, all business logic in client
• BaaS (Backend-as-a-Service): Supabase for all backend needs
• Event-driven UI: real-time DB subscriptions for instant sync
• Separation of concerns: distinct modules for auth, dashboard, profile, notifications, utils
• Security: RLS policies, email verification, secure public buckets