This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
cd ai-backend
python3.11 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt -r requirements-dev.txt
python main.py # Start FastAPI server on port 8000cd web
npm install
npm run dev # Start Next.js dev server on port 3000
npm run build # Production build
npm run lint # ESLint# Run all tests
./scripts/run-tests.sh
# Individual components
./scripts/run-tests.sh ai # AI backend tests (pytest)
./scripts/run-tests.sh web # Web platform tests
./scripts/run-tests.sh lint # Linting only# Comprehensive linting and quality checks
./scripts/lint-all.sh
# Auto-fix linting issues
./scripts/lint-fix.sh [ai|web|sql|all]
# Type checking
./scripts/type-check.sh [ai|web|all]# Start both services
docker-compose -f docker-compose.dev.yml up
# Individual services
docker-compose -f docker-compose.dev.yml up ai-backend
docker-compose -f docker-compose.dev.yml up webcd web
npm run db:setup # Reset and seed database
npm run generate:types # Generate TypeScript types from SupabaseThe AI backend uses a pipeline architecture with specialized agents:
- DataCollectorAgent (
scriber_agents/data_collector.py): Fetches sports data from APIs - ResearchAgent (
scriber_agents/researcher.py): Analyzes team/player backgrounds - WriterAgent (
scriber_agents/writer.py): Generates articles with specified tone/style - Editor (
scriber_agents/editor.py): Reviews and improves content quality - AgentPipeline (
scriber_agents/pipeline.py): Orchestrates the workflow
Pipeline flow: Data Collector → Researcher → Writer → Editor
main.py: FastAPI application entry point with article generation endpointsconfig/: Agent configurations and application settingstools/: Sports APIs (sports_apis.py), data validation, web search utilitiesutils/: Logging, security, helper functionstests/: Pytest test suite with agent and API tests
- Next.js 14 with App Router and TypeScript
- HeroUI (@heroui/react) component library, not standard Material-UI or Chakra
app/: App router pages including admin dashboard and article viewscomponents/: Reusable React components organized by featurelib/: Supabase client, utilities, AI integration, webhook handlershooks/: Custom React hooks for data fetching
shared/types/: TypeScript interfaces for articles, games, players, teamsshared/schemas/: Database SQL schemas and JSON validation schemasshared/constants/: API endpoints, leagues, sports data
ruff.toml: Python linting with strict rules, Google docstring conventionmypy.ini: Type checking configurationpytest.ini: Test configuration with async supportrequirements.txt: Production dependencies including security fixes for CVE vulnerabilities
next.config.js: Next.js configurationtailwind.config.js: Tailwind CSS setuptsconfig.json: TypeScript compiler options
Required environment variables:
OPENAI_API_KEY: OpenAI API accessRAPIDAPI_KEY: Sports data APIsNEXT_PUBLIC_SUPABASE_PROJECT_ID: Supabase projectSUPABASE_SERVICE_ROLE_KEY: Database access
See env.example files in root, ai-backend/, and web/ directories.
- The AI system is currently basic/foundational with room for expansion
- Always activate Python virtual environment before backend development
- Use HeroUI components, not other UI libraries
- Database uses Supabase (PostgreSQL) with real-time capabilities
- Security: Fixed CVE vulnerabilities in Python dependencies
- Code quality enforced via ruff (Python) and ESLint (TypeScript)