NFL Predictor - AI-Powered Game Predictions
Live Deployment
Project Overview
NFL Predictor is a sophisticated sports analytics platform that combines advanced machine learning models with gematria numerology to generate NFL game predictions. The application features an ensemble of ML models (Random Forest, XGBoost, Neural Networks) trained on historical NFL data, complemented by gematria analysis using multiple cipher systems.
The platform is built as a monorepo with three distinct services: a React Native mobile application, a Node.js backend API for orchestration and business logic, and a Python-based ML service for predictions and data science operations.
Key Features
Multi-Model Machine Learning System
- Ensemble Predictions: Combines Random Forest, XGBoost, and Neural Networks for robust predictions
- Feature Engineering: 15+ features including team stats, historical performance, head-to-head records, situational factors
- Confidence Scoring: Transparent confidence levels based on model agreement and historical accuracy
- Game Analysis: Detailed breakdowns with key factors influencing predictions
- Weekly Predictions: Complete coverage of all NFL games with spread and over/under predictions
- Parlay Optimizer: Advanced algorithm to optimize multi-game parlays (Pro tier)
Gematria Analysis Engine
- Multiple Cipher Systems: English Gematria, Pythagorean, and Chaldean numerology
- Team/Player Analysis: Numerological insights for team names and player names
- Pattern Recognition: Identifies numerical patterns and master numbers
- Game Correlations: Analyzes numerological relationships between teams and game dates
- Interactive Calculator: Real-time gematria calculations with detailed explanations
Subscription System
- Three-Tier Model: Free (3 predictions/day), Premium ($9.99 - 20 predictions/day), Pro ($29.99 - unlimited)
- Stripe Integration: Secure payment processing with subscription management
- Feature Gating: Tier-based access control enforced via middleware
- Customer Portal: Self-service subscription management through Stripe portal
- Payment History: Complete transaction tracking and invoice management
- Webhook Automation: Real-time subscription updates via Stripe webhooks
User Features
- Authentication System: JWT-based auth with age verification (21+)
- Prediction History: Track personal prediction accuracy over time
- Statistics Dashboard: Detailed performance metrics and model accuracy
- Favorite Teams: Personalized predictions for selected teams
- Profile Management: Customizable preferences and settings
Technical Implementation
Mobile Application (React Native + Expo)
- Cross-Platform: Single codebase for iOS, Android, and web deployment
- State Management: Redux Toolkit with organized slices for auth, predictions, gematria, and user data
- Navigation: React Navigation with separate auth and main app flows
- UI Components: React Native Paper for consistent Material Design
- API Integration: Axios-based service layer with interceptors for auth and error handling
- Theme System: Centralized theme configuration with colors, typography, and spacing
Backend API (Node.js + Express)
- RESTful Architecture: Organized routes for auth, predictions, gematria, subscriptions, and admin
- Authentication: JWT tokens with secure token storage and refresh mechanism
- Authorization: Middleware-based access control with role and subscription tier checks
- Service Orchestration: Coordinates between mobile app and ML service
- Caching Strategy: Redis caching for predictions with 15-30 minute TTL
- Rate Limiting: Tier-based rate limits to prevent abuse
- Webhook Handling: Stripe webhook processing for subscription events
- Job Scheduling: Cron jobs for data updates and model retraining
ML Service (Python + FastAPI)
- FastAPI Framework: High-performance async API with automatic OpenAPI documentation
- Model Ensemble: Combines predictions from multiple ML models with weighted averaging
- Random Forest: Trained on 15+ engineered features for robust predictions
- XGBoost: Gradient boosting for improved accuracy on complex patterns
- Neural Networks: Deep learning model for non-linear relationships (TensorFlow/Keras)
- Feature Engineering: Automated feature extraction pipeline including rolling averages, situational factors, and advanced metrics
- Data Pipeline: Extensible framework for ingesting data from ESPN, The Odds API, and OpenWeather
- Model Training: Automated retraining with performance tracking
- Gematria Engine: Efficient calculation of numerological values with multiple cipher systems
Database Architecture
- PostgreSQL: Primary database for structured data (games, teams, users, subscriptions, predictions)
- MongoDB: Document store for gematria calculations with flexible schema
- Redis: High-performance caching layer for predictions and session data
- Connection Pooling: Optimized database connections for high throughput
Complete Tech Stack
Frontend (Mobile)
Backend API
ML Service
External Services
Deployment
Development Tools
Machine Learning Pipeline
Feature Engineering
The prediction system leverages 15+ engineered features extracted from historical NFL data:
- Team Performance: Offensive and defensive ratings, points per game, yards per game
- Recent Form: Rolling averages over last 5 games
- Head-to-Head: Historical matchup records and trends
- Situational Factors: Week number, divisional games, primetime games, rest days
- Environmental: Weather conditions, temperature, wind speed
- Injury Impact: Key player availability and injury severity scores
- Home Field Advantage: Stadium-specific performance metrics
- Betting Markets: Vegas lines and public betting percentages
Model Training Process
- Data Collection: Historical game data from multiple seasons
- Feature Extraction: Automated pipeline for feature calculation
- Train/Test Split: Time-series aware splitting to prevent data leakage
- Hyperparameter Tuning: Grid search for optimal model parameters
- Cross-Validation: K-fold validation for robust performance estimates
- Ensemble Weighting: Dynamic weights based on recent performance
- Performance Tracking: Continuous monitoring of prediction accuracy
Challenges & Solutions
Challenge: Coordinating three distinct services (mobile, backend, ML) with different tech stacks and ensuring reliable communication.
Solution: Implemented a clear service boundary architecture with the Node.js backend acting as an orchestration layer. Used Redis for shared caching and implemented comprehensive error handling with retries for ML service calls.
Challenge: Managing subscription tiers and enforcing feature access across all endpoints.
Solution: Created reusable middleware functions that check subscription status and tier-specific limits. Implemented a centralized subscription service that handles all Stripe interactions and maintains consistent state across databases.
Challenge: Handling expensive ML predictions while maintaining responsive API performance.
Solution: Implemented multi-layer caching strategy using Redis with different TTLs for different prediction types. Pre-computed predictions for upcoming games and cached individual game predictions for 30 minutes.
Challenge: Training ML models with limited historical data while avoiding overfitting.
Solution: Used ensemble learning to combine multiple model types, implemented cross-validation, and engineered robust features based on domain knowledge. Weighted recent games more heavily to adapt to changing team dynamics.
Results & Impact
Successfully launched a production-ready NFL prediction platform with:
- Multi-service architecture demonstrating expertise in full-stack development
- Machine learning implementation with ensemble modeling and feature engineering
- Complete payment processing and subscription management system
- Advanced caching strategies for performance optimization
- Cross-platform mobile application with professional UI
- Unique combination of ML and gematria analysis for differentiation
The project showcases advanced skills in machine learning, backend architecture, mobile development, payment processing, and system design - demonstrating the ability to build complex, production-ready applications from concept to deployment.
Future Enhancements
- Player prop predictions using individual player statistics
- Live in-game predictions with real-time score updates
- Social features including leaderboards and prediction sharing
- Enhanced model training with transfer learning
- Integration with sports books for automatic bet placement
- Advanced visualizations for feature importance and model explanations
- Mobile push notifications for prediction updates