Sports Analytics Platform
Comprehensive Sports Data & Content Management System
A full-stack ecosystem that synchronizes real-time sports data, automates editorial content, and powers rich analytics. Built with modern web technologies and AI-driven automation to keep fans and analysts informed.
Challenge
Build a comprehensive sports platform that aggregates real-time data from multiple APIs, automates editorial content, and delivers deep analytics while maintaining first-class performance and SEO.
Solution
Delivered a monorepo with a Next.js 15 frontend and Python-based AI backend that synchronizes live sports data, generates original content, and orchestrates complex editorial workflows powered by OpenAI Agents SDK.
System Architecture
Coordinated monorepo with clear separation between user experience and AI automation layers.
Frontend (apps/web)
- Next.js 15 App Router with server-side rendering
- Auth.js authentication with magic links
- Slug-based routing and URL canonicalization
- Comprehensive SEO helpers and metadata API usage
- Unified search experience across content types
- Deployed to Vercel with preview deployments
Backend (apps/agents)
- Python services leveraging OpenAI Agents SDK
- Automated editorial workflow orchestration
- Daily content generation with image sourcing
- Railway deployment with scheduled tasks
- PostgreSQL persistence managed via Drizzle ORM
- Supabase Edge Functions for specialized automation
Core Features
Intelligent automation keeps data, content, and discovery experiences in sync for every sport.
AI Editorial Workflow System
Specialized AI agents collaborate to produce daily content, complete with legal imagery and metadata.
- Editor-in-Chief agent delegates tasks to specialized teammates
- Content Writer crafts long-form articles and summaries
- Image Editor and Photo Researcher secure compliant visuals
- Research Analyst agent plans coverage and keyword strategy
- Content Coordinator oversees complex multi-agent workflows
Editorial Pipeline
Natural language prompts -> Editor-in-Chief -> Specialized agents -> Content creation -> Image sourcing -> Database storage with attribution.
Real-time Sports Data Synchronization
Consistent ingestion and normalization of global sports data keeps stats, fixtures, and standings current.
- API-Football integration supplies live scores and fixtures
- Player, team, league, and tournament data refreshed on schedule
- Career statistics and season metrics tracked historically
- RSS feed aggregation layers in breaking news coverage
- Supabase Edge Functions handle downstream processing
Data Pipeline
Scheduled synchronization jobs fetch and normalize external APIs before triggering edge functions for enrichment and notifications.
Unified Search & Discovery
Cross-entity search provides a fast discovery layer across players, teams, articles, and matches.
- Multi-entity search with categorized result tabs
- Debounced inputs deliver responsive filtering
- Shareable queries via persisted URL parameters
- Case-insensitive matching with Supabase ilike queries
- Paginated responses maintain frontend performance
Search Implementation
Dedicated `/api/supabase/search` endpoint returns typed collections for each entity, enabling instant filtering in the UI.
Technical Implementation
Production-grade engineering practices stitch together data, AI, and UX layers.
Frontend Architecture
- Next.js 15 App Router with async params handling
- SEO-friendly slug routing with fallbacks
- Auth.js magic link authentication via Resend
- Centralized metadata helpers for dynamic SEO
- Rich JSON-LD structured data for search engines
Backend Systems
- PostgreSQL on Railway as the source of truth
- Drizzle ORM for type-safe queries and migrations
- Supabase Edge Functions for serverless extensions
- Cron-driven synchronization for external data
- Next.js API routes orchestrating import jobs
AI & Automation
- OpenAI Agents SDK coordinating editorial roles
- Automated image sourcing through Wikimedia API
- RSS aggregation keeps news feeds populated
- Scheduled tasks trigger daily content generation
- Attribution tracking guarantees legal compliance
Database & Content Architecture
Structured storage keeps sports statistics and editorial content aligned.
Core Sports Data
- Comprehensive player profiles with career histories
- Team records including standings and performance metrics
- League metadata capturing competition structure
- Fixture timelines with event-level granularity
- Season-level statistics for both teams and players
Content Management
- AI-generated articles, recaps, and summaries
- Supplemental imagery for content and profiles
- External RSS feeds for curated news
- User authentication and personalization data
- Attribution records for every media asset
AI Agent Workflows
Purpose-built automations ensure consistency across daily coverage and evergreen content.
Daily Content Generation
Workflow
Scheduled run at 10:00 AM UTC sends prompts to the Editor-in-Chief who dispatches tasks to content and image agents, culminating in database persistence with attribution.
Features
Every summary ships with a unique Wikimedia Commons image, tracked licensing, and structured metadata for frontend rendering.
Player Profile Creation
Workflow
Content Coordinator cues the workflow -> Content Writer drafts the profile -> Photo Researcher and Image Editor source compliant visuals -> Final profile stored with multi-image support.
Features
Profiles include curated photography, content-rich bios, and automated attribution for each asset.
Key Achievements
A platform that blends data integrity, editorial excellence, and operational efficiency.
Platform Features
- Monorepo spanning Next.js web and Python AI services
- Automated editorial production with unique imagery
- Real-time synchronization of sports data and statistics
- Unified search across players, teams, articles, and fixtures
- SEO-focused slug system with canonical management
- Attribution system satisfying legal requirements
Technical Implementation
- OpenAI Agents SDK orchestrating specialized workflows
- Server-side authentication with Auth.js and magic links
- Dynamic metadata and JSON-LD for high-impact SEO
- Scheduled tasks powered by Railway infrastructure
- Playwright automated end-to-end testing suite
- RSS feed aggregation and normalization pipeline
Technical Challenges & Solutions
Engineering resilience and compliance were core priorities throughout delivery.
Content Attribution & Legal Compliance
Challenge
Automated image sourcing required guaranteed attribution and licensing compliance across thousands of assets.
Solution
Implemented dedicated attribution tables capturing license, source URL, and HTML snippets, ensuring every image retains legally-required metadata.
Next.js 15 Async Params Migration
Challenge
Next.js 15.3 required awaiting params Promises in dynamic routes, breaking existing synchronous assumptions.
Solution
Refactored dynamic pages to await params before usage, restoring compatibility with Turbopack while preserving type safety.
AI Agent Orchestration
Challenge
Coordinating multiple agents without duplicating imagery or compromising editorial consistency demanded robust orchestration.
Solution
Adopted OpenAI Agents SDK handoff patterns with unique image tracking, guaranteeing consistent quality across generated content.
Deployment & Infrastructure
Managed environments keep the platform reliable from commit to production.
Frontend Deployment
- Next.js hosted on Vercel with automatic previews
- Managed environment variables and secrets
- Edge-aware optimizations for rapid responses
- Continuous deployment from version control
Backend Infrastructure
- Python services on Railway with always-on workers
- Managed PostgreSQL for persistent storage
- Scheduled tasks for nightly and hourly jobs
- Centralized environment configuration
Monitoring & Quality
- Playwright tests covering key user journeys
- Status reporting and health monitoring
- Structured error handling with logging
- Performance instrumentation across services