How bhuvi-ship-it/smart-sport-strategy works
Project Type and Purpose
• Full-stack single-page application (SPA) for athlete management.
• Frontend: React + Vite, deployed on Vercel.
• Backend: Supabase (Auth, Database, Storage, Realtime).
• External AI service via OpenRouter (for chat/analytics).
File Structure Highlights
• src/pages & src/components → UI layer, role-based screens (Athlete, Coach, Medical, Scout).
• src/context → React Contexts (AuthContext, AIContext) managing global state.
• src/integrations/supabase → Supabase client setup and types.
• src/services/databaseService.ts → CRUD abstraction over Supabase.
• src/services/openRouterService.ts → Proxy to OpenAI models.
• tailwind.config.ts, postcss.config.js, vite.config.ts → Build & styling config.
• public/ → Static assets (robots.txt, index.html).
README Insights
• Confirms architecture: Frontend (Vite+React) → Supabase backend → Vercel hosting.
• Highlights role-based features and real-time data.
Main Components
a. Users & Roles
– Athlete, Coach, Medical Staff, Scout (external actors).
b. Frontend Layer (React SPA on Vercel)
– UI Components (Pages, Layout, Dashboard widgets).
– Context Layer (AuthContext, AIContext).
– Service Layer (databaseService, openRouterService).
c. Backend Services
– Supabase Auth (JWT, role-based access).
– Supabase Database (PostgreSQL) – data tables for athletes, performance, health logs, etc.
– Supabase Storage (media uploads).
– Realtime/Subscriptions (for live chat & updates).
d. External AI Service
– OpenRouter/OpenAI API endpoint for chat/analytics.
e. Hosting/CDN
– Vercel serving the SPA.
Relationships and Data Flows
• User → Browser → Vercel (SPA)
• SPA ↔ Supabase Auth (login/signup, JWT exchange)
• SPA ↔ Supabase Database (CRUD for athletes, performance, health, scouting)
• SPA ↔ Supabase Storage (image/video uploads)
• SPA ↔ Supabase Realtime (live chat & dashboards)
• SPA ↔ OpenRouterService → OpenAI (chatbot, AI summaries)
Architectural Patterns & Principles
• Component-based UI (atomic & feature folders)
• Context API for cross-cutting concerns (auth, AI state)
• Service abstraction for external calls (databaseService, openRouterService)
• Role-based access control enforced by Supabase policies
• Real-time updates via Supabase subscriptions
Technologies & Frameworks
• React + TypeScript + Vite
• Supabase (Auth, Postgres, Storage, Realtime)
• Tailwind CSS (styling)
• OpenRouter / OpenAI (AI service)
• Vercel (hosting)
Final Checklist
[ ] All main components and actors are present
[ ] Data flows and dependencies are directional and unambiguous
[ ] Labels are clear and match codebase terminology
[ ] Architectural patterns (Context API, service layer, real-time) are called out