A collection of web-based tools for table tennis teams and players.
Calculate handicap scores for players based on their handicap points. Perfect for friendly matches and league play with skill differences.
Features:
- Real-time score calculation
- Dark mode support
Track player availability and manage team selections for Edinburgh and Lothians Table Tennis League (ELTTL) teams.
Features:
- Import team data directly from ELTTL
- Track player availability for each fixture
- Select final 3 players per match
- Player statistics and selection rates
- Responsive design (mobile, tablet, desktop)
- Dark mode support
- Automatic past/future fixture handling
- Availability Tracker Guide - Complete feature documentation
- API Documentation - REST API reference
- User Guide - Step-by-step usage instructions
- Deployment Guide - Production deployment instructions
- TODO List - Implementation progress
tt/
├── frontend/ # SvelteKit frontend application
│ ├── src/
│ │ ├── routes/ # Page routes
│ │ │ ├── availability/ # Availability tracker pages
│ │ │ └── handicap/ # Handicap calculator page
│ │ └── lib/ # Shared components and utilities
│ └── e2e/ # Playwright E2E tests
├── worker/ # Cloudflare Worker API
│ └── src/
│ ├── index.ts # API routes and handlers
│ ├── database.ts # D1 database service
│ ├── scraper.ts # ELTTL scraper
│ └── *.test.ts # Unit and integration tests
├── docs/ # Documentation
└── design/ # Design documents and planning
Frontend:
- SvelteKit (TypeScript)
- TailwindCSS
- Playwright (E2E testing)
- Vitest (Unit testing)
Backend:
- Cloudflare Workers
- Hono (web framework)
- Cloudflare D1 (SQLite database)
- Vitest (Testing)
- Node.js 18+
- npm
- wrangler CLI:
npm install -g wrangler
cd frontend
npm install
# Set up environment variables (first time only)
cp .env.example .env
npm run dev -- --hostFrontend will be available at http://localhost:5173
cd worker
npm install
# Set up local database
npm run db:migrate:local
# Optional: Seed with test data
npm run seed
# Start development server
npx wrangler dev --ip 0.0.0.0Worker API will be available at http://localhost:8787
cd worker
# Run all tests
npm test
# Watch mode
npm run test:watch
# With coverage
npm run test:coverageCoverage Target: >80% (currently achieving 65 tests across 4 test files)
cd frontend
# Run unit tests
npm run test:unitcd frontend
# Install Playwright browsers (first time only)
npx playwright install
# Run E2E tests
npm run test:e2e
# Run with UI mode (interactive)
npm run test:e2e:ui
# Run specific test file
npx playwright test e2e/availability-validation.test.ts# In project root
cd worker && npm test && cd ../frontend && npm run test:unit && npm run test:e2eSee Deployment Guide for comprehensive deployment instructions.
Production Worker:
cd worker
npm run deploy:productionProduction Frontend:
- Deploy via Cloudflare Pages dashboard
- Or use:
npx wrangler pages deploy .svelte-kit/cloudflare
Database Setup:
# Create production database
cd worker
npm run db:create:production
# Run migrations
npm run db:migrate:productionFrontend (.env or Cloudflare Pages):
VITE_API_URL- Worker API URL (e.g.,https://tabletennis-prod.workers.dev/api)- Important: Must include
/apisuffix - For local development:
http://localhost:8787/api - Copy
.env.exampleto.envand update the URL
- Important: Must include
Worker (wrangler.toml):
database_id- Cloudflare D1 database ID
- Create feature branch:
git checkout -b feature/my-feature - Implement changes with tests
- Run all tests:
npm test - Update documentation if needed
- Submit pull request
- Update
worker/schema.sql - Test locally:
npm run db:migrate:local - Test in staging:
npm run db:migrate:staging - Deploy to production:
npm run db:migrate:production
- TypeScript for type safety
- ESLint for linting
- Prettier for formatting (integrated with ESLint)
- Comprehensive test coverage
- Structured logging for debugging
- Caching: HTTP cache headers on API responses
- Compression: Gzip/Brotli on all responses
- Database: Indexed queries for fast lookups
- Frontend: Code splitting and lazy loading
- Optimistic UI: Instant feedback on user actions
- Structured JSON logging in Worker
- Cloudflare Analytics dashboard
- Error tracking and alerting
- Performance metrics (response times, error rates)
- Code Style: Follow existing patterns
- Tests: All features must have tests
- Documentation: Update docs for user-facing changes
- Commits: Use conventional commits (e.g.,
feat:,fix:,docs:) - Reviews: All changes require code review
# Type checking
cd frontend && npx svelte-check
cd worker && npx tsc --noEmit
# Linting
cd frontend && npm run lint
cd worker && npm run lint # if configured
# Tests
cd worker && npm test
cd frontend && npm run test:unit && npm run test:e2eImport fails:
- Verify ELTTL URL format is correct
- Check ELTTL website is accessible
- Review worker logs:
wrangler tail
Database errors:
- Ensure migrations are applied
- Check database binding in wrangler.toml
- Verify database ID is correct
CORS errors:
- Check VITE_API_URL in frontend
- Verify CORS is enabled in worker
- Clear browser cache
Build failures:
# Clean install
rm -rf node_modules package-lock.json
npm installSee Deployment Guide for more solutions.
- Handicap Score Calculator
- ELTTL Availability Tracker MVP
- Comprehensive test suite
- Documentation and user guides
- Production deployment setup
- Authentication for team management
- Email notifications for selections
- PDF/Excel export
- Historical data analysis
- Real-time updates (WebSockets)
- Mobile PWA
- WhatsApp/SMS integration
See LICENSE file for details.
- Documentation: Check docs/ folder
- Issues: Open a GitHub issue
- Questions: Use GitHub Discussions
- Built for Edinburgh and Lothians Table Tennis League (ELTTL)
- Powered by Cloudflare Workers and Pages
- Built with SvelteKit and Hono
Version: 1.0.0
Last Updated: December 2025
Status: Production Ready ✅