How suryavamshikusam/photocopy-ledger works
Photocopy Ledger manages prepaid campus printing balances through an append-only transaction ledger. Admins search and filter student accounts, review history, and post single or batch deposits, deductions, and corrections; students see balances and statement history with live balance updates. Authentication and role-aware routing gate these experiences. The README documents parallel server-rendered data loading, RLS-protected direct history reads, and validated server-action writes. Some page and database implementation details were not sampled, so those links rely on README evidence.
Main entry points: AdminClient.tsx Admin Command Center · auth.ts Auth Actions · server.ts Server Supabase Client · schema.sql Postgres Ledger
Components 19
Access and Accounts
- Sign-in Screen
src/app/login/page.tsx - Auth Actions
src/app/actions/auth.ts - Session and Role Guards
src/middleware.ts - Password Change
src/components/ChangePasswordDialog.tsx - Sign-out Control
src/components/SignOutButton.tsx
Admin Operations
- Admin Server Page
src/app/admin/page.tsx - Admin Command Center
src/app/admin/AdminClient.tsx - Transaction Actions
src/app/actions/transaction.ts - Shared UI Components
src/components/ui
Student Passbook
- Student Server Page
src/app/dashboard/page.tsx - Live Passbook
src/app/dashboard/DashboardLiveClient.tsx
Ledger and Data
- Browser Supabase Client
src/lib/supabase/client.ts - Server Supabase Client
src/lib/supabase/server.ts - Supabase Configuration
src/lib/env.ts - Postgres Ledger
supabase/schema.sql - Supabase Realtime
- Supabase Auth
- Ledger Formatting
src/lib/format.ts
Other components
- Campus User
Connections 26
- Campus User → Sign-in Screen: signs in
README.md - Sign-in Screen → Auth Actions: submits credentials
src/app/login/page.tsx - Auth Actions → Server Supabase Client: creates client
src/app/actions/auth.ts - Server Supabase Client → Supabase Configuration: gets credentials
src/lib/supabase/server.ts - Auth Actions → Supabase Auth: authenticates
src/app/actions/auth.ts - Session and Role Guards → Supabase Auth: refreshes session
README.md - Session and Role Guards → Admin Server Page: guards routes
README.md - Session and Role Guards → Student Server Page: guards routes
README.md - Admin Server Page → Admin Command Center: renders
src/app/admin/page.tsx - Admin Command Center → Transaction Actions: posts transactions
src/app/admin/AdminClient.tsx - Transaction Actions → Server Supabase Client: creates client
src/app/actions/transaction.ts - Transaction Actions → Postgres Ledger: writes ledger entries
README.md - Admin Command Center → Browser Supabase Client: queries history
src/app/admin/AdminClient.tsx - Browser Supabase Client → Postgres Ledger: reads RLS history
- Admin Command Center → Postgres Ledger: prefetches history
README.md - Student Server Page → Live Passbook: renders
src/app/dashboard/page.tsx - Student Server Page → Server Supabase Client: loads initial data
src/app/dashboard/page.tsx - Server Supabase Client → Postgres Ledger: loads page data
README.md - Live Passbook → Browser Supabase Client: creates client
src/app/dashboard/DashboardLiveClient.tsx - Live Passbook → Supabase Realtime: subscribes to updates
src/app/dashboard/DashboardLiveClient.tsx - Postgres Ledger → Supabase Realtime: pushes changes
README.md - Password Change → Auth Actions: changes credentials
- Sign-out Control → Auth Actions: calls logout
src/components/SignOutButton.tsx - Admin Command Center → Shared UI Components: renders controls
src/app/admin/AdminClient.tsx - Live Passbook → Ledger Formatting: formats ledger dates
src/app/dashboard/DashboardLiveClient.tsx - Browser Supabase Client → Supabase Configuration: gets credentials
src/lib/supabase/client.ts