Welcome to the ISA SportHub repo! A Next.js application for sports management and athlete profiles.
- Framework: Next.js 15.3 with App Router
- Runtime: React 19 with TypeScript 5
- Styling: Tailwind CSS 4.0
- Package Manager: pnpm
- Database: AWS DynamoDB (local development support)
- Authentication: NextAuth v5
- Build Tool: Turbopack
- Hosting: AWS Amplify
-
Install dependencies:
pnpm install
-
Start development server:
pnpm dev
-
Open the application: http://localhost:3000
SportHub uses a hierarchical sort key pattern with DynamoDB for efficient querying and minimal data duplication.
Primary Key: userId (partition) + sortKey (sort)
GSI: userSubType-index, discipline-rankings-index
Record Types (distinguished by sortKey):
Profile- User profile with aggregated stats (role, points, contestCount)Ranking:{type}:{year}:{discipline}:{gender}:{ageCategory}- Individual rankingsParticipation:{contestId}- Contest participation records
Primary Key: eventId (partition) + sortKey (sort)
GSI: contestId-index, date-discipline-index
Record Types:
Metadata- Event-level information (name, location, dates)Contest:{discipline}:{contestId}- Contest with embedded participants
Purpose: Centralized user identity storage (name, email, phone, country)
Region: eu-central-1
Access: Via reference-db-service.ts
Benefits:
- Single source of truth for user identity
- Reduces data duplication across tables
- Enables cross-region user management
- Separates identity from application data
All queries use composite keys or GSI lookups - NO TABLE SCANS:
- Direct key lookup (GetItem): ~10ms
- GSI query with limit 100: ~50ms
- Hierarchical query with pagination: ~20-30ms
- BatchGetItem (100 items): ~80ms vs. ~800ms sequential
π Comprehensive Guides in the docs/ folder:
- Database Schema - Complete table definitions and examples
- Query Patterns - Query examples and best practices
- Reference DB Pattern - Identity separation architecture
- Authentication Flow - Cognito + NextAuth integration
- RBAC System - Role-based access control
- Static Pages Guide - ISR, revalidation, and static page management
- Database Sync Guide - Syncing local to remote DynamoDB
- Authentication Setup - Setting up Cognito authentication
- Claude Code Guide - Working with Claude Code AI assistant
- Data Services - Data service layer API
- User Query Service - User query functions
- Reference DB Service - Reference DB operations
- Developer Reference - SportHub app developer guide
# Start local DynamoDB
pnpm db:local
# Setup and seed data
pnpm db:setup
pnpm db:seed
# Visit the setup interface
http://localhost:3000/test_LOCAL- π Athlete Profile Management - Comprehensive athlete profiles with stats
- π Rankings & Leaderboards - Multi-dimensional rankings (discipline, gender, age)
- π Event Management - Competition and event tracking
- π World Records - Track and display world records
- π€ Partner Management - Sponsor and partner listings
- π Data Visualization - Interactive charts and graphs
- β‘ Static + ISR Pages - Fast loading with automatic updates
- π Authentication - AWS Cognito integration via NextAuth
- π― RBAC System - Role-based access control (admin, athlete, judge, organizer)
- π Optimized Queries - Hierarchical schema eliminates table scans (~10-50ms queries)
- πΎ Reference DB Pattern - Separation of user identity from application data
pnpm dev- Start development server with Turbopackpnpm build- Build production applicationpnpm start- Start production serverpnpm lint- Run ESLintpnpm test:local- Dev server with local DynamoDB
pnpm db:local- Start local DynamoDB containerpnpm db:setup- Create required tablespnpm db:seed- Seed with mock datapnpm db:reset- Clear and reseed datapnpm db:clear- Clear all datapnpm db:count- Show record counts in all tablespnpm db:gui- Launch DynamoDB Admin GUI on port 8001pnpm db:stop- Stop DynamoDB containerpnpm db:clean- Remove DynamoDB container and data
pnpm sync:compare- Compare local vs remote schemaspnpm sync:export- Export local data to filespnpm sync:import- Import local data to remotepnpm sync:recreate- Recreate remote table with local data
pnpm revalidate:all- Revalidate all static pagespnpm revalidate:rankings- Revalidate rankings pagepnpm revalidate:events- Revalidate events page
docs/ # Documentation
βββ STATIC-PAGES.md
βββ SYNC-DATABASE.md
βββ SYNC-TOOL.md
βββ CLAUDE.md
βββ etc...
sport-hub/
βββ src/
β βββ app/ # Next.js App Router pages & API routes
β βββ ui/ # Reusable UI components
β βββ lib/ # Library code and utilities
β βββ utils/ # Utility functions
β βββ types/ # TypeScript type definitions
β βββ mocks/ # Mock data for development
βββ scripts/ # Utility scripts (sync, revalidation)
βββ public/ # Static assets
@ui/*βsrc/ui/*@utils/*βsrc/utils/*@types/*βsrc/types/*@mocks/*βsrc/mocks/*@lib/*βsrc/lib/*
# 1. Start local database
pnpm db:local
# 2. Setup and seed
pnpm db:setup
pnpm db:seed
# 3. Start dev server
pnpm dev# 1. Update local data
pnpm db:seed
# 2. Sync to production
pnpm sync:import
# 3. Revalidate static pages
pnpm revalidate:all# 1. Setup local data
pnpm db:local
pnpm db:setup
pnpm db:seed
# 2. Sync to remote DynamoDB
pnpm sync:recreate
# 3. Deploy
git push- Static Pages Guide - ISR and revalidation
- Database Sync Guide - Syncing to production
- Next.js Documentation - Next.js features and API
- AWS Amplify Docs - Deployment platform