How blockly-website/blockly-student-tracker works
Project type & purpose (what you’re diagramming)
This is a serverless, frontend-only web app (Next.js App Router) that implements a self-hosted student schedule + task tracker. The key architectural constraint is explicitly stated:
• No backend server
• No custom API layer
• Frontend talks directly to Supabase (Auth + Postgres + RLS)
Client application (Next.js / React / MUI)
• app/ (routing, layout, pages)
• app/layout.tsx: root layout, fonts/metadata, top-level providers
• app/page.tsx: AuthGate → Dashboard entrypoint
• app/signin/page.tsx: sign-in route
• components/: feature modules / UI shells
• AuthGate.tsx: session check + redirect logic
• Dashboard.tsx: tab shell; the “main surface” that hosts features
• Feature managers/views: DayView, WeekView, CalendarManager, TaskManager, ScheduleManager, SettingsPanel
• SupabaseSignIn.tsx: auth UI for sign in/up/reset
• DemoDataButton.tsx: seeds demo data (important data-write path)
• DevPanel.tsx: dev-only utilities (should be visually separated as “dev only”)
• lib/: cross-cutting concerns
• lib/supabase.ts: Supabase JS client init (the “data access layer”)
• lib/preferences.tsx: preferences context + time formatting (local state)
• lib/types.ts: shared types/interfaces
Supabase (managed backend)
• supabase/setup.sql: defines 4 tables + constraints + RLS + FORCE RLS
• schedule_types
• schedule_blocks
• schedule_overrides
• tasks
• Supabase services used:
• Auth (email/password + optional OAuth)
• PostgreSQL
• Row Level Security policies (authorization boundary)
Platform / delivery (optional but accurate)
• Hosting targets (Vercel/Netlify/Cloudflare/self-host) from README
• Environment configuration (.env.example, next.config.ts)
Because there’s no custom backend, the most important things to capture are:
Sign-in triggers Supabase Auth
• email/password OR OAuth redirect → provider → back to Supabase → session
With a session, feature components execute CRUD via Supabase JS client
• Read/write schedules, tasks, overrides in Postgres
• All queries are constrained by RLS (authorization boundary)
Data ownership / security flow (important to show explicitly)
• Client is untrusted → all enforcement is in Supabase RLS
• anon key is used client-side → never service role
Local-only state flow
• SettingsPanel ↔ PreferencesContext ↔ Browser storage (implied by “saved locally”)
• This should be a separate data store node like “Local Storage / IndexedDB” (even if implementation detail isn’t shown in tree, the behavior is explicitly described).
Important architectural patterns/design principles to annotate
• Backendless / BaaS architecture: Supabase is the backend.
• Client-side data access layer: lib/supabase.ts as the single initialization point.
• Authorization at the data layer: RLS + FORCE RLS as the core security mechanism.
• Feature-component modularization: each “Manager/View” maps to a domain (tasks, schedules, overrides).
Entities:
• Student (Browser)
• Hosting (Vercel/etc.)
• Supabase (Auth + DB + RLS)
• Optional OAuth providers
Containers:
• Next.js Web App (React/MUI, PWA)
• Supabase Auth
• Supabase Postgres (4 tables)
• Local Storage (preferences)
• OAuth provider(s) (optional)
Inside “Next.js Web App”:
• Routing (App Router)
• AuthGate / SupabaseSignIn
• Dashboard
• DayView / WeekView / CalendarManager / TaskManager / ScheduleManager / SettingsPanel
• lib: supabase client + preferences context + types
Make data model visible (because it drives the whole app)
A “Data” section on the Supabase side listing the 4 tables and the key relationships:
• schedule_types → schedule_blocks (blocks belong to a schedule type)
• schedule_overrides (date-based override of schedule)
• tasks (optionally linked to class/schedule block/type—reflect whatever is implemented in SQL)
• user_id on every table
• RLS policy: user_id = auth.uid()
PWA is a delivery/runtime concern, not a backend
PWA elements to include:
• Optional note: “Offline capability” only if actually implemented; otherwise just “Installable PWA”.
“Don’t overthink it” but be detailed: how to split into many components safely
Given the repo is small, it’s safe to separate aggressively by:
• Separate local preferences storage as its own store