Premium multi-room study collaboration platform for engineering exam prep. Users create custom study spaces, manage subject libraries, invite friends, and track group progress with isolated analytics.
- Next.js 16 (App Router)
- React 19 + TypeScript
- Tailwind CSS v4
- shadcn-style reusable UI (primitives, card, button, input, progress, badge, skeleton)
- Lucide React icons
- Supabase (Auth, PostgreSQL with RLS, Realtime Presence, Cloud Storage)
- pnpm package manager
pnpm installCopy .env.example to .env.local:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-keyTo enable Google sign-in/sign-up:
- In Supabase Dashboard, go to Authentication > Providers > Google and enable it.
- Add your Google OAuth client credentials there.
- In Supabase Authentication > URL Configuration, add your callback URL(s):
http://localhost:3000/auth/callback
https://your-production-domain.com/auth/callback- In Google Cloud Console, make sure the same callback URL(s) are listed under authorized redirect URIs.
- Create a Supabase project at https://supabase.com
- Go to SQL Editor and run
supabase/schema.sqlto create tables, indexes, RLS policies, and helper functions - Verify storage bucket
materialsexists in Storage settings
pnpm devOpen http://localhost:3000 in your browser.
- Users join multiple rooms
- Rooms have owner + admin + members
- Subjects are per-room (Maths, DSA, Aptitude, etc.)
- Study logs, materials, leaderboards are room-isolated
- Invite codes enable easy sharing and onboarding
| Route | Purpose |
|---|---|
/sign-in, /sign-up |
Auth pages |
/dashboard |
Redirect to primary room or creation |
/rooms/create |
Create new study room |
/rooms/join |
Join by invite code |
/rooms/[slug] |
Room dashboard (main workspace) |
/rooms/[slug]/subjects |
Manage room subjects |
/rooms/[slug]/invite |
Share room & invite friends |
/rooms/[slug]/settings |
Room info & settings hub |
- Countdown Timer: Room exam date or default 30-day target
- Subject Navigator: Room-defined subjects with live filtering
- Live Study Tracker: Start/pause/resume/stop sessions, log session goals/notes
- Vault: Drag-drop file uploads, subject-scoped downloads, pinning
- Analytics: Daily study chart, subject distribution pie chart, weekly target progress
- Leaderboard: Room-scoped weekly rankings by study minutes
- Room Switcher: Dropdown to switch between joined rooms in navbar
pnpm dev # Start development server (http://localhost:3000)
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Run ESLint on code
pnpm typecheck # Run TypeScript compiler for type validationSee UPGRADE_GUIDE.md for full schema reference including:
- Tables:
profiles,rooms,room_members,room_invites,subjects,study_logs,materials - Views:
room_leaderboard_weekly(room-scoped with RLS) - Functions:
is_room_member(),has_room_role(),join_room_by_code() - RLS Policies: Role-based access control per room
- Row-Level Security (RLS): All tables protected; membership enforced at Postgres layer
- Role-Based Permissions: Owner/admin/member roles with specific permissions
- API Guards: Endpoint-level role checks before mutations
- Storage Policies: Room ID in object paths enforces access control
- Auth: Supabase JWT-based sessions, no hardcoded secrets in client
- Max file size: 25 MB
- Supported types: PDF, DOCX, PPTX, XLSX, JPG, PNG
- Storage quota: 1.5 GB per workspace
- Path structure:
materials/{room_id}/{user_id}/{timestamp}-{filename} - Access: Room members only; storage policies enforce access
app/ # Next.js routes
├── api/ # API endpoints (rooms, joins, subjects, materials)
├── dashboard/ # Legacy redirect to rooms
├── rooms/ # Room pages (create, join, [slug], invite, subjects, settings)
├── sign-in/ # Auth pages
├── sign-up/
└── layout.tsx
components/
├── dashboard/ # UI components (navbar, tracker, vault, leaderboard, etc.)
├── rooms/ # Room-specific forms & panels
├── auth/ # Auth forms
├── ui/ # Primitives (button, card, input, etc.)
lib/ # Utilities & schemas
├── constants.ts # Upload limits
├── dashboard-data.ts # Room data fetcher
├── validation.ts # Zod schemas
├── utils.ts
types/ # TypeScript interfaces
├── app.ts # Core types (Room, Subject, RoomMember, etc.)
└── dashboard.ts # Dashboard data types
utils/supabase/ # Supabase clients
├── client.ts # Browser client
├── server.ts # Server-side client
└── middleware.ts # Auth middleware
proxy.ts # Next.js request proxy (replaces middleware.ts convention)
supabase/
└── schema.sql # Database schema, RLS, functions
public/ # Assets, manifest, service worker
hooks/ # React hooks (useCountdown, useStopwatch, usePresence, etc.)
If upgrading from the old global-scope app:
- Run
supabase/schema.sqlto create new multi-room schema - Your old profile data migrates automatically via auth trigger
- Create a new room to start using the app
- Follow UPGRADE_GUIDE.md for detailed walkthrough
- Indexes: On
room_id,user_id,created_at, compositeroom_memberskeys - Leaderboard View: Uses
security_invoker = truefor per-room RLS (Postgres 15+) - Instant Navigation: Next.js 16
unstable_instanton auth pages for optimized pre-fetch - No N+1 Queries: Dashboard uses parallel Promise.all() for study logs, materials, leaderboard
# Supabase (from Project Settings > API)
NEXT_PUBLIC_SUPABASE_URL=...
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=...- Push repo to GitHub
- Import project into Vercel
- Set environment variables from
.env.local - Deploy
- Node.js 18+
pnpm install && pnpm build && pnpm start- Set same env vars
- Use
pnpm devwith Next.js DevTools for instant reloads - ESLint runs on file save (configure in IDE)
- TypeScript:
pnpm typecheckbefore pushing - Hot module reloading works for components, but pages may need manual refresh
- Open http://localhost:3000/api/rooms when signed in to see your room list
- Create a feature branch
- Update types in
types/as needed - Add/modify tests
- Run
pnpm lint && pnpm typecheckbefore submitting PR - Follow existing code patterns (shadcn UI, Zod validation, RLS-first design)
MIT
- UPGRADE_GUIDE.md — Detailed migration & architecture docs
- Supabase Docs
- Next.js Docs
- Tailwind CSS Docs