Admin dashboard for managing a Supabase-backed ticketing system.
- Dark mode UI
- Auth (email/password via Supabase)
- Dashboard with time-range scans (1h / 24h / 7d) and KPIs
- Realtime table refresh (tickets, devices, scan_logs)
- Tables: sorting, pagination, full CSV export
- React + TypeScript + Vite
- Tailwind CSS v4
- React Router, TanStack Query
- Supabase JS
- Recharts, Day.js
- Install deps
npm install
- Create
.env.localin project root:
VITE_SUPABASE_URL=your_project_url
VITE_SUPABASE_ANON_KEY=your_anon_key
- Enable Realtime (Supabase dashboard → Database → Replication → Realtime)
- Turn on for tables:
tickets,devices,scan_logs
- Dev server
npm run dev
- Production build
npm run build
npm run preview
Expected public tables:
tickets(id uuid primary key, scanned_at timestamptz, devalued bool)devices(id text primary key, platform text, last_seen_at timestamptz, app_version text)scan_logs(id bigint primary key, created_at timestamptz, device_id text, action text, ticket_code text, is_valid bool, was_devalued bool, success bool, message text, meta jsonb)
Optional audit (already supported in UI, can be created with migration):
admin_audit(id bigserial, created_at timestamptz default now(), actor_user_id uuid, actor_email text, action text, table_name text, record_id text, details jsonb)
Policies should allow authenticated users to select the above tables. Realtime should be enabled to see instant updates on the dashboard and lists.
dev: start local dev serverbuild: type-check + bundle for productionpreview: preview production build
- Deploy to Vercel/Netlify
- Set the same env vars:
VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY
- Filters (date range, validity) and deep links from KPIs
- Audit page for
admin_audit - Role-based admin actions