Expert guidance for working with the TTAnalysis table tennis match analysis web application built with React, TypeScript, Supabase, and Vite. Provides context on architecture, database schema, development workflow, and key features.
Provides comprehensive guidance for working with the TTAnalysis codebase - a table tennis match analysis web application that enables point-by-point tracking, shot type classification, and performance statistics.
This skill equips AI agents with deep contextual knowledge of the TTAnalysis project structure, development workflow, database schema, and architectural patterns. Use this when working on features, debugging issues, or maintaining the TTAnalysis table tennis analysis application.
TTAnalysis is a full-stack web application with the following technology stack:
**Frontend:**
**Backend:**
- PostgreSQL database
- Authentication system
- Storage capabilities
- Row-level security policies
**Mobile-First Design:**
1. **Recommended: Full stack with Supabase**
```bash
./start-dev.sh
```
This script handles:
- Starting local Supabase services (PostgreSQL, Auth, etc.)
- Creating a test user if one doesn't exist
- Starting the Vite development server
2. **Frontend only (without Supabase)**
```bash
npm run dev
```
```bash
npm install
supabase db push
npm run build
npm run lint
npm run preview
npm run promote-admin [email protected]
```
Required environment variables for Supabase integration:
The PostgreSQL database contains the following core tables:
```
/src
├── components/ # Reusable UI components
│ ├── Layout # App layout wrapper
│ ├── PlayerPanel # Player score display
│ └── ShotSelector # Shot type selection UI
├── pages/ # Main application screens
├── lib/ # Utilities and external clients
│ └── supabase # Supabase client configuration
├── types/ # TypeScript type definitions
└── styles/ # Global CSS and stylesheets
/supabase
└── migrations/ # Database migration files
/docs # Project documentation
```
1. Select winning player (user or opponent)
2. Select winning shot type from categorized list
3. Select other shot type (shot that didn't win the point)
4. Record point and automatically update scores
5. Track server changes (every 2 points per table tennis rules)
1. **Never use `supabase db reset`** - Always use `supabase db push` to apply migrations
2. **Row-level security** - All database queries respect Supabase RLS policies
3. **Shot IDs from database** - Point recording uses shot IDs fetched from the shots table, not hardcoded values
4. **Server rotation** - Server changes every 2 points following table tennis rules
5. **Mobile-first** - UI must remain usable on small screens for courtside usage
1. **Type Safety**: Leverage TypeScript definitions in `/src/types` for all database entities
2. **Component Reusability**: Extract common UI patterns into `/src/components`
3. **Database Migrations**: Store all schema changes in `/supabase/migrations` with descriptive names
4. **Environment Configuration**: Never commit `.env` files; use `.env.example` as template
5. **Testing**: Use the test user created by `start-dev.sh` for development testing
1. Create migration in `/supabase/migrations`
2. Add to appropriate shot category
3. Set display_order for UI positioning
4. Run `supabase db push`
5. Test in ShotSelector component
1. Create component in `/src/pages`
2. Add route in React Router configuration
3. Query match/point data via Supabase client
4. Render statistics using existing styling patterns
5. Test with various match data scenarios
1. Use `promote-admin` script to grant admin role
2. Check user role in RLS policies
3. Add admin-only UI elements
4. Secure admin API endpoints
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/ttanalysis-table-tennis-app-guide/raw