Common issues and their solutions for College Code Hub.
Problem: When trying to log in with the demo accounts shown on the login page, you get an "Invalid login credentials" error.
Cause: The demo users don't exist in your Supabase database yet. The accounts shown on the login page are for reference only and need to be created.
Solution:
-
Quick Fix - Follow the DEMO_USERS_SETUP.md guide to create demo users in your Supabase project.
-
Step-by-step:
- Go to your Supabase Dashboard → Authentication → Users
- Click "Add user" → "Create new user"
- Create a user with:
- Email:
student@example.com - Password:
password123 - Enable "Auto Confirm User" (important!)
- Email:
- After creating the auth user, copy their UUID
- Go to SQL Editor and run:
INSERT INTO public.users ( auth_user_id, name, email, username, role, verified, approval_status ) VALUES ( 'PASTE_UUID_HERE', 'Test Student', 'student@example.com', 'student', 'student', true, 'approved' );
Problem: Login succeeds but then fails with "User profile not found".
Cause: The Supabase Auth user exists, but there's no corresponding profile in the users table.
Solution:
-
Find the auth user's UUID:
SELECT id, email FROM auth.users WHERE email = 'YOUR_EMAIL';
-
Create the user profile:
INSERT INTO public.users ( auth_user_id, name, email, username, role, verified, approval_status ) VALUES ( 'USER_UUID_FROM_STEP_1', 'Your Name', 'YOUR_EMAIL', 'your_username', 'student', true, 'approved' );
Problem: User exists but login fails due to email not being confirmed.
Solution:
- Go to Supabase Dashboard → Authentication → Users
- Find the user in the list
- Click on the user
- Look for "Email Confirmed" status
- If not confirmed, click the "..." menu and select "Confirm Email"
Alternatively, when creating new users, always check the "Auto Confirm User" option.
Problem: Clicking the logout button doesn't log the user out or doesn't redirect to login page.
Cause: The logout function wasn't redirecting users after clearing the session.
Solution:
This has been fixed in the latest version. The logout function now:
- Clears the Supabase session
- Removes all authentication data from localStorage
- Shows a success toast notification
- Redirects to the login page after 500ms
If you're still experiencing issues:
- Hard refresh the page: Ctrl+Shift+R (Cmd+Shift+R on Mac)
- Clear browser cache: Settings → Privacy → Clear browsing data
- Check browser console: Look for any JavaScript errors (F12 → Console)
- Manually clear localStorage: F12 → Application → Local Storage → Clear All
Problem: The app shows "Supabase configuration missing" error.
Cause: Environment variables are not set correctly.
Solution:
- Create
frontend/.env.localfile (copy fromfrontend/env.local.example) - Add your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
- Get these values from: Supabase Dashboard → Settings → API
Problem: Database queries fail because tables don't exist.
Cause: Database schema hasn't been created yet.
Solution:
- Go to Supabase Dashboard → SQL Editor
- Open the file
supabase/schema.sqlfrom this repository - Copy and paste the entire contents into the SQL Editor
- Click "Run" to execute
Problem: Frontend shows a blank screen or won't load.
Solutions:
- Check browser console for errors (F12 → Console tab)
- Clear browser cache and localStorage:
- Open DevTools (F12)
- Application tab → Storage → Clear site data
- Restart the dev server:
cd frontend npm run dev
Problem: API calls fail with "Failed to fetch" or network errors.
Causes & Solutions:
-
Backend not running:
- Start the backend:
cd backend && npm run dev - Check that it's running on the correct port (default: 5000)
- Start the backend:
-
CORS issues:
- Make sure
NEXT_PUBLIC_API_URLin.env.localmatches your backend URL - Default should be:
http://localhost:5000
- Make sure
-
Supabase connection issues:
- Verify Supabase URL and anon key in
.env.local - Check Supabase project status in dashboard
- Verify Supabase URL and anon key in
Problem: Backend can't connect to Supabase.
Solution:
- Verify
backend/.envhas correct Supabase credentials - Check that your Supabase project is active
- Verify network connectivity to Supabase
Problem: Backend won't start - "Port 5000 already in use".
Solutions:
-
Kill the process using port 5000:
- Windows:
netstat -ano | findstr :5000thentaskkill /PID <PID> /F - Mac/Linux:
lsof -ti:5000 | xargs kill -9
- Windows:
-
Use a different port:
- Edit
backend/.env:PORT=5001 - Update
frontend/.env.local:NEXT_PUBLIC_API_URL=http://localhost:5001
- Edit
Problem: Code changes don't appear in the running app.
Solutions:
- Hard refresh browser: Ctrl+Shift+R (Cmd+Shift+R on Mac)
- Restart dev server: Stop (Ctrl+C) and start again
- Clear Next.js cache:
cd frontend rm -rf .next npm run dev - Check for TypeScript errors: These can prevent hot reload
Problem: Build fails or shows TypeScript errors.
Solutions:
-
Update dependencies:
npm install
-
Check TypeScript version:
npm ls typescript
-
Clear node_modules and reinstall:
rm -rf node_modules package-lock.json npm install
Checklist:
Frontend (frontend/.env.local):
NEXT_PUBLIC_SUPABASE_URL=https://xxxxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJxxxxx...
NEXT_PUBLIC_API_URL=http://localhost:5000Backend (backend/.env):
SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_ANON_KEY=eyJxxxxx...
SUPABASE_SERVICE_ROLE_KEY=eyJxxxxx...
PORT=5000
NODE_ENV=developmentIf you're still experiencing issues:
-
Check the logs:
- Frontend: Browser console (F12)
- Backend: Terminal where server is running
-
Review documentation:
- README.md - Main setup guide
- SUPABASE_SETUP.md - Supabase configuration
- DEMO_USERS_SETUP.md - Demo users setup
-
Common debugging steps:
- Restart both frontend and backend servers
- Clear browser cache and localStorage
- Verify all environment variables are set
- Check Supabase dashboard for project status
- Look for error messages in browser console and terminal
-
Report an issue:
- Include error messages
- Include steps to reproduce
- Include environment details (OS, Node version, etc.)