Skip to content

Start the Application ​

1. Start Backend (Terminal 1) ​

bash
cd g:\projects\tendsocial\apps\api
npm run dev

✅ Backend should start on http://localhost:4000

2. Start Frontend (Terminal 2) ​

bash
cd g:\projects\tendsocial\apps\web
npm run dev

✅ Frontend should start on http://localhost:5173 (or http://localhost:3000)

Test OAuth Flow ​

  1. Open Browser

  2. Clear Previous Session

    javascript
    // Run in browser console
    localStorage.clear();
    location.reload();
  3. Login with Google

    • Click "Get Started" or "Login"
    • Click "Continue with Google"
    • Select your Google account (marc.montecalvo@gmail.com)
    • Grant permissions
  4. Complete Onboarding

    • Should see onboarding modal
    • Enter company name (e.g., "TendSocial Inc")
    • Enter your first/last name (optional)
    • Click "Complete Setup"
  5. Verify Success

    • Should see the main app interface
    • Top right should show your user info
    • Refresh page - should stay logged in

View Database ​

bash
cd g:\projects\tendsocial\apps\api

# Set environment variable
$env:DATABASE_URL="postgresql://neondb_owner:npg_Qbx8ezZRFlk1@ep-broad-bird-aed9yqxq-pooler.c-2.us-east-2.aws.neon.tech/neondb?sslmode=require&channel_binding=require"

# Open Prisma Studio
pnpm exec prisma studio -- config=./prisma/prisma.config.ts

Opens at http://localhost:5555

Check:

  • ✅ Company table has your company
  • ✅ User table has your user with correct supabaseId

Expected Backend Logs ​

When auth is working correctly, you should see:

[info] GET /api/auth/me 200
[info] User lookup: supabaseId=51959998-85de-4710-9a2d-05f130022b807

Or for new users:

[info] GET /api/auth/me 404
[info] POST /api/auth/onboarding 201
[info] Created company: TendSocial Inc
[info] Created user: marc.montecalvo@gmail.com

Troubleshooting ​

Backend Won't Start ​

  • Check that port 4000 is available
  • Verify .env file exists with DATABASE_URL
  • Run npm install if packages are missing

Frontend Won't Start ​

  • Check that port 5173 is available
  • Verify apps/frontend/.env has VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY
  • Run npm install if packages are missing

OAuth Redirects to URL with Tokens But Nothing Happens ​

  • Check browser console for errors
  • Verify frontend is calling /api/auth/me
  • Check backend logs for the API call
  • Ensure SUPABASE_ANON_KEY is set in backend .env

Onboarding Modal Doesn't Appear ​

  • Check that /api/auth/me is returning 404 for new users
  • Verify the needsOnboarding state is being set
  • Check browser console for React errors

"User already onboarded" Error (409) ​

This means the user already exists. To reset:

  1. Open Prisma Studio
  2. Delete the user from User table
  3. Delete the company from Company table
  4. Try OAuth flow again

Quick Commands Reference ​

bash
# Backend
cd apps/backend
npm run dev                    # Start dev server
npm run generate              # Regenerate Prisma Client
npm run lint                  # Type check

# Frontend  
cd apps/frontend
npm run dev                   # Start dev server
npm run build                 # Build for production
npm run lint                  # Run linter

# Database
cd apps/backend
pnpm exec prisma studio --config=./prisma/prisma.config.ts    # Open GUI
pnpm exec prisma db push --config=./prisma/prisma.config.ts   # Push schema changes

Success Criteria ​

  • ✅ User can click "Continue with Google"
  • ✅ Google OAuth completes successfully
  • ✅ Onboarding modal appears for new users
  • ✅ User can enter company name and complete setup
  • ✅ User is redirected to main app
  • ✅ Session persists on page refresh
  • ✅ Database has Company and User records
  • ✅ User can logout and login again

If all the above work, OAuth login is fully functional! 🎉

TendSocial Documentation