A comprehensive web application for squash players to book courts, find matches, rate opponents, and get AI-powered coaching tips.
Live Demo: https://squashpro.vercel.app
- Court Booking: Book squash courts with an interactive map
- Find Match: Discover and join open matches with other players
- Player Profiles: View player ratings and skill levels
- Google OAuth: Secure authentication via Google
- AI Coach: Get personalized coaching tips powered by Google Gemini
- Real-time Updates: Live match and booking updates via Supabase
- Frontend: React 19, TypeScript, Tailwind CSS
- Backend: Supabase (PostgreSQL, Auth, Realtime)
- Build Tool: Vite
- Maps: Leaflet
- AI: Google Gemini API
- Deployment: Vercel
- Node.js 18+
- npm or yarn
- A Supabase account
- A Google Cloud account (for OAuth)
- A Vercel account (for deployment)
git clone https://github.com/alfredang/SquashPro.git
cd SquashPro
npm install- Go to supabase.com and sign in
- Click New Project
- Configure:
- Name:
squashpro - Database Password: Generate and save securely
- Region: Choose closest to your users (e.g., Singapore)
- Name:
- Click Create new project and wait for provisioning
- In Supabase dashboard, go to SQL Editor
- Click New query and run these files in order:
Step 1: Schema - Copy contents of supabase/schema.sql and run
Step 2: RLS Policies - Copy contents of supabase/rls_policies.sql and run
Step 3: Seed Data - Copy contents of supabase/seed.sql and run
- Go to Settings → API
- Copy:
- Project URL (e.g.,
https://xxxxx.supabase.co) - anon public key (starts with
eyJ...orsb_publishable_...)
- Project URL (e.g.,
- Go to Google Cloud Console
- Create a new project or select existing
- Navigate to APIs & Services → Credentials
- Click Create Credentials → OAuth client ID
- Select Web application
- Add Authorized redirect URI:
(Get this URL from Supabase → Authentication → Providers → Google)
https://YOUR-PROJECT-REF.supabase.co/auth/v1/callback - Save your Client ID and Client Secret
- In Supabase, go to Authentication → Providers
- Find Google and enable it
- Paste your Google Client ID and Client Secret
- Click Save
Create a .env.local file in the project root:
# Supabase Configuration
VITE_SUPABASE_URL=https://your-project-ref.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-public-key
# Google Gemini API (optional, for AI coaching tips)
GEMINI_API_KEY=your-gemini-api-keynpm run devOpen http://localhost:3000 in your browser.
# Install Vercel CLI (if not installed)
npm i -g vercel
# Login to Vercel
vercel login
# Deploy to production
vercel --prod- Go to your Vercel Dashboard
- Select your project → Settings → Environment Variables
- Add:
VITE_SUPABASE_URL= your Supabase project URLVITE_SUPABASE_ANON_KEY= your Supabase anon keyGEMINI_API_KEY= your Gemini API key (optional)
- Redeploy for changes to take effect:
vercel --prod
- In Supabase, go to Authentication → URL Configuration
- Set Site URL to your Vercel URL (e.g.,
https://squashpro.vercel.app) - Add your Vercel URL to Redirect URLs
SquashPro/
├── App.tsx # Main application component
├── index.tsx # React entry point
├── index.html # HTML template
├── types.ts # TypeScript interfaces
├── components/
│ ├── MapContainer.tsx # Leaflet map component
│ └── Rating.tsx # Star rating component
├── contexts/
│ └── AuthContext.tsx # Supabase auth context
├── lib/
│ └── supabase.ts # Supabase client configuration
├── services/
│ └── geminiService.ts # Google Gemini API integration
└── supabase/
├── schema.sql # Database table definitions
├── rls_policies.sql # Row Level Security policies
└── seed.sql # Initial seed data
| Table | Description |
|---|---|
profiles |
User profiles (extends auth.users) |
courts |
Squash court locations |
bookings |
Match bookings |
booking_invitations |
Match invitation system |
player_reviews |
Player ratings and reviews |
- Check browser console for errors
- Verify
.env.localhas correct Supabase credentials - Ensure
index.htmlhas the script tag:<script type="module" src="/index.tsx"></script>
- Verify redirect URI matches exactly in Google Cloud Console and Supabase
- Check that Google provider is enabled in Supabase
- Ensure Site URL and Redirect URLs are configured in Supabase Auth settings
- Run migrations in order: schema → rls_policies → seed
- Check RLS policies are enabled on all tables
MIT
Pull requests are welcome. For major changes, please open an issue first.