Leaderboard Fantasy: A Cloud-Native Fantasy Golf Platform built with AI

A fantasy golf platform that evolved from a simple Excel spreadsheet into a cloud-native SaaS application. Built using agentic AI development, leveraging Google Cloud Platform (App Engine, Cloud Run, Secret Manager), MongoDB Atlas, Terraform infrastructure-as-code, and Spring AI for intelligent player insights.

SaaSFantasy SportsCloud-NativeAI-Driven DevelopmentFull-Stack

Leaderboard Fantasy: The Spreadsheet That Became a Platform

Leaderboard Fantasy is a fantasy golf platform with an origin story that captures the essence of modern software development: it started as a color-coded Excel spreadsheet with nested VLOOKUPs, and evolved into a cloud-native SaaS platform serving hundreds of golf fans.

More importantly, it's a case study in agentic software development—vibe coded initially through the use of AI agents and evolving into full AI Agent workflow orchestration, demonstrating what's possible when human vision meets AI execution at scale.

The Origin Story

Like many great products, Leaderboard Fantasy began with a personal pain point. Managing a fantasy golf pool for friends meant:

  • Manually copying leaderboards every tournament weekend
  • Calculating standings with increasingly complex formulas
  • Sending updates to the group via text and email
  • Hours of work for what should have been simple fun

The spreadsheet grew unwieldy. Friends of friends wanted in. Other groups heard about it and asked to use it too. That's when the realization hit: this wasn't just a personal problem—fantasy golf fans everywhere were either struggling with spreadsheets or settling for platforms that didn't understand the sport.

The Architecture: Cloud-Native from Day One

Leaderboard Fantasy is built as a distributed system across multiple GCP services, with infrastructure managed entirely through Terraform.

System Components

┌───────────────────────────────────────────────────────────────┐
│                     Google Cloud Platform                     │
├───────────────────────────────────────────────────────────────┤
│                                                               │
│  ┌──────────────┐    ┌──────────────┐    ┌─────────────────┐  │
│  │  App Engine  │    │  Cloud Run   │    │  Cloud Storage  │  │
│  │   (Web UI)   │◄──►│  (Data API)  │◄──►│   (Assets)      │  │
│  └──────────────┘    └──────────────┘    └─────────────────┘  │
│         │                   │                                 │
│         │            ┌──────┴──────┐                          │
│         │            │             │                          │
│         ▼            ▼             ▼                          │
│  ┌─────────────┐ ┌─────────┐ ┌──────────┐                     │
│  │    Redis    │ │ Secret  │ │ MongoDB  │                     │
│  │  (Sessions) │ │ Manager │ │  Atlas   │                     │
│  └─────────────┘ └─────────┘ └──────────┘                     │
│                                                               │
│  ┌─────────────────────────────────────────────────────────┐  │
│  │              Terraform-Managed Infrastructure           │  │
│  │  • VPC Networks & Connectors  • NAT Gateways            │  │
│  │  • Static IPs                 • Firewall Rules          │  │
│  │  • Service Accounts           • Cloud Scheduler         │  │
│  └─────────────────────────────────────────────────────────┘  │
│                                                               │
└───────────────────────────────────────────────────────────────┘

leaderboard-web (Frontend Application)

The user-facing application runs on Google App Engine, providing:

  • Server-Side Rendering: Spring Boot with Thymeleaf for fast initial page loads
  • OAuth2 Authentication: Google Sign-In with Spring Security
  • Session Management: Redis-backed distributed sessions for horizontal scaling
  • Responsive Design: Tailwind CSS for mobile-first layouts

lfs-data (Data API)

The backend API runs on Google Cloud Run, offering:

  • RESTful API: Full CRUD operations for tournaments, contests, rosters, and groups
  • Real-Time Scoring: Integration with PGA Tour data feeds via RapidAPI
  • AI-Powered Chat: Spring AI with Google Vertex AI Gemini for intelligent player insights
  • Event-Driven Architecture: Asynchronous event processing with automatic retry logic

lfs-terraform (Infrastructure as Code)

All GCP infrastructure is managed through Terraform:

  • Networking: VPC, subnets, NAT gateways, firewall rules
  • Compute: Cloud Run service configurations, App Engine settings
  • Security: Service accounts with least-privilege permissions
  • Scheduling: Cloud Scheduler for periodic data synchronization

The Tech Stack

Backend (lfs-data)

  • Java 21 with Spring Boot 3.5
  • MongoDB Atlas for document-oriented data storage
  • **Spring AI ** with Google Vertex AI Gemini for AI-powered chat
  • Spring Data REST for rapid API development
  • Lombok for reduced boilerplate
  • ULID for time-sortable unique identifiers

Frontend (leaderboard-web)

  • Spring Boot 3.1 with Thymeleaf for server-side rendering
  • Spring Security 6 with OAuth2 for authentication
  • Spring Session with Redis for distributed sessions
  • Tailwind CSS for utility-first styling
  • Spring Actuator for health monitoring and metrics

Infrastructure

  • Google Cloud Run for containerized, auto-scaling API deployment
  • Google App Engine for managed web application hosting
  • Google Cloud Storage for static assets and user uploads
  • Google Secret Manager for secure credential storage
  • MongoDB Atlas for managed, globally distributed database
  • Redis for session storage and caching
  • Terraform for infrastructure-as-code

CI/CD

  • GitLab CI/CD for automated builds, tests, and deployments
  • Docker for containerized builds
  • Automatic home server deployment: Every commit to main automatically deploys to the self-hosted test environment
  • Production releases: Tagged releases (rel_*) deploy to GCP App Engine and Cloud Run
  • Slack integration for deployment notifications

Key Platform Features

Live Tournament Scoring

The platform integrates with PGA Tour data feeds to provide:

  • Real-time leaderboard updates during tournaments
  • Automatic score calculations based on customizable rules
  • Support for weather delays, playoffs, and international events
  • Mobile-optimized views for checking scores on the course

Groups: Persistent Communities

Inspired by the original friend group that started it all:

  • Create public or private groups
  • Invite members via email
  • Leader/member role hierarchy
  • Group message boards for trash talk and strategy discussion
  • Season-long rivalries and persistent standings

Flexible Contest Engine

Every group can customize their experience:

  • Configurable roster sizes (4-20 players)
  • Adjustable scores-to-count rules
  • Custom missed cut penalties
  • Public contests for global competition
  • Private contests for friends only

AI-Powered Chat Assistant

Built with Spring AI and Google Vertex AI Gemini:

  • Player Statistics: Career performance, recent form, tournament history
  • Roster Analysis: Evaluate your picks against field strength
  • Head-to-Head Comparisons: Compare any two players across metrics
  • Smart Alternatives: Get AI-suggested replacements for injured or underperforming players
  • Context-Aware Advice: Responses tailored to specific tournaments and contests

Comprehensive Notification System

Multi-channel communication via Mailjet integration:

  • Contest result notifications
  • Group invitation alerts
  • Weekly digest emails
  • Bidirectional unsubscribe synchronization

Cloud Platform Deep Dive

Google Cloud Run

The lfs-data API leverages Cloud Run's serverless container platform:

# Deployment configuration highlights
- Auto-scaling from 0 to N instances based on traffic
- VPC connector for secure internal communication
- NAT gateway for static outbound IP (required for some APIs)
- Secrets mounted as environment variables
- Health checks via Spring Actuator endpoints

Why Cloud Run?

  • True stateless API first architecture
  • Pay-per-use pricing (scale to zero when idle)
  • Automatic HTTPS and load balancing
  • Container-based for local development parity
  • Integrates seamlessly with Cloud Build and GitLab CI

MongoDB Atlas

The platform uses MongoDB Atlas for its document database:

  • Multi-tenant data model: Isolated data per group with shared collections
  • Flexible schema: Evolving data structures without migrations
  • Real-time capabilities: Change streams for live updates
  • Global distribution: Automatic failover and read replicas

Terraform Infrastructure Management

All infrastructure changes go through code review:

# Example: VPC Connector for Cloud Run
resource "google_vpc_access_connector" "leaderboard_vpc_connector" {
  name          = "leaderboard-vpc-connector"
  region        = var.region
  ip_cidr_range = "X.X.X.X/28"
  network       = google_compute_network.default.name
}

Benefits of infrastructure-as-code:

  • Version-controlled infrastructure changes
  • Reproducible environments
  • Drift detection and remediation
  • Clear audit trail for compliance

The AI Development Story

Leaderboard Fantasy represents an evolution in how software gets built. The platform was developed initially using vibe coding chat interactions, but is now primarily through agentic AI orchestration—the same methodology documented in the companion blog post.

The Workflow

  1. Specification: Detailed feature specs written with Claude, divided logically into 4-8 hour implementation units with documented dependencies
  2. Implementation: Claude Code Web reads the repository, analyzes existing patterns, implements features end-to-end
  3. Quality Gates: GitLab CI runs linting, tests, and security checks automatically
  4. Review: Human review maintains final say on architecture and quality
  5. Deployment: Tagged releases trigger automated production deployments

Velocity Multiplier

What would traditionally require:

  • Solo developer: 4-6 months of full-time work
  • Small team: 3-4 people, 2-3 months

Actual development: Nights and weekends over 3 months, with AI agents handling the mechanical implementation while human judgment guided architecture and user experience.

Development Environment

Local Development

The project supports multiple development modes:

# Run locally with Maven
./mvnw spring-boot:run -Dspring.profiles.active=dev

# Run with Docker
docker-compose up

# Deploy to home server for staging
git push origin develop  # Triggers GitLab CI

Profile-Based Configuration

# Profiles: local, dev, test, gcp
# Each profile configures:
# - MongoDB connection (local, Atlas dev, Atlas prod)
# - Redis session store
# - API key authentication
# - Feature flags

Testing Strategy

  • Unit Tests: Service and model testing with JUnit 5
  • Integration Tests: Full API testing with Spring Boot Test
  • Local GCP Emulators: Test against production-like infrastructure
  • Bruno API Collections: Manual testing and documentation

Self-Hosted Test Environment

One of the most valuable development infrastructure decisions was setting up a self-hosted Docker-based test environment. Every commit to main automatically deploys to a home server, providing a production-like staging environment at zero cloud cost.

Container Architecture

The test environment runs a complete application stack via Docker Compose:

┌──────────────────────────────────────────────────────────┐
│                    Home Server Stack                     │
├──────────────────────────────────────────────────────────┤
│                                                          │
│  ┌─────────┐    ┌─────────────┐    ┌──────────────────┐  │
│  │  Nginx  │───►│  Spring App │───►│  Redis (Sessions)│  │
│  │ (SSL)   │    │  Container  │    └──────────────────┘  │
│  └─────────┘    └─────────────┘              │           │
│       │                │                     │           │
│       │                ▼                     ▼           │
│       │         ┌─────────────────────────────┐          │
│       │         │   MongoDB (Local Instance)  │          │
│       │         └─────────────────────────────┘          │
│       │                                                  │
│       │         ┌─────────────────────────────┐          │
│       └────────►│   Prometheus + Grafana      │          │
│                 │      (Monitoring)           │          │
│                 └─────────────────────────────┘          │
│                                                          │
└──────────────────────────────────────────────────────────┘

Docker Compose Services

The docker-compose.dev.yml orchestrates six core services:

services:
  app:        # Spring Boot application (Dockerfile.dev)
  redis:      # Session storage (redis:7.0-alpine)
  mongodb:    # Local database (mongo:7.0)
  nginx:      # Reverse proxy with SSL termination
  prometheus: # Metrics collection (optional)
  grafana:    # Metrics visualization (optional)

Each service includes health checks, proper restart policies, and named volumes for data persistence.

Automated Deployment Pipeline

GitLab CI automatically deploys every commit to main:

deploy-home-server:
  stage: deploy-home
  rules:
    - if: $CI_COMMIT_BRANCH == "main"
      when: on_success

The deployment process:

  1. Package: Creates a tarball of source, configs, and Docker files
  2. Upload: Securely transfers package to home server via SSH
  3. Backup: Automatically backs up current deployment (keeps last 3)
  4. Build: Builds fresh Docker images with --no-cache
  5. Deploy: Rolling update with health checks at each stage
  6. Verify: Confirms all services are healthy via actuator endpoints
  7. Notify: Sends Slack notification on success/failure

Zero-Downtime Deployment Script

The deploy.sh script handles the full deployment lifecycle:

./scripts/deploy.sh deploy        # Full deployment
./scripts/deploy.sh rollback      # Restore previous version
./scripts/deploy.sh health        # Check service health
./scripts/deploy.sh backup        # Manual backup

Key features:

  • Rolling updates: Services restart sequentially with health verification
  • Automatic rollback: On failure, can restore from timestamped backups
  • Database backups: MongoDB dumps and Redis snapshots before each deploy
  • Log preservation: Application logs copied to backup before updates

Benefits of Self-Hosted Staging

Cost Savings: Running on existing hardware eliminates ~$100-170/month in cloud staging costs.

Faster Iterations: No cloud deployment delays—changes are live within minutes of merge.

Production Parity: Same Docker containers, same nginx configuration, same health checks as production.

Learning Opportunity: Hands-on experience with Docker orchestration, SSL certificates, reverse proxies, and deployment automation.

Safe Experimentation: Test risky changes without impacting production or incurring cloud costs.

Environment Parity

The self-hosted environment mirrors production configuration:

| Component | Home Server | Production (GCP) | |-----------|-------------|------------------| | Web Server | Nginx container | App Engine | | API | Spring Boot container | Cloud Run | | Database | MongoDB container | MongoDB Atlas | | Sessions | Redis container | Redis (Memorystore) | | SSL | Let's Encrypt | Managed certificates | | Monitoring | Prometheus/Grafana | Cloud Monitoring |

This parity catches environment-specific issues before they reach production.

What I Learned

Technical Insights

  • Spec quality matters more than coding speed. A well-written 30-minute specification saves days of agent confusion and rework.
  • Cloud Run + MongoDB Atlas is a powerful combination. Serverless compute with managed database eliminates most operational overhead.
  • Terraform for everything. Even "simple" infrastructure changes should go through code review.
  • Spring AI is production-ready. The integration with Vertex AI Gemini works seamlessly for real-world AI features.

Process Insights

  • Different AI agents excel at different tasks. Claude for architecture and complex features, Copilot for context-aware edits, Gemini for quick iterations.
  • Decomposition is everything. Tasks too large cause hallucinations; tasks too small lose efficiency. Finding the right granularity is an art.
  • Human review remains critical. AI agents are excellent scaffolding; humans provide judgment, taste, and vision.

Product Insights

  • Golf fans are underserved. The fantasy golf market is smaller than football or basketball, but the fans are passionate and engaged.
  • Social features drive retention. Groups keep people coming back week after week, tournament after tournament.
  • Simplicity wins. The "30-second signup" philosophy removed friction and increased conversion.

Future Roadmap

  • Payment Processing: Premium features and prize pools
  • Native Mobile Apps: iOS and Android for on-course score checking
  • Advanced Analytics: Historical trends, predictive modeling, and course fit analysis
  • API Platform: Public API for third-party integrations

The Real Takeaway

Leaderboard Fantasy proves something important: the barrier to building production software has fundamentally changed.

A solo developer with:

  • Clear vision and product sense
  • Well-structured specifications
  • Appropriate AI agent orchestration
  • Cloud-native infrastructure knowledge

...can now build what previously required teams and months.

The spreadsheet is still saved in Google Drive—a reminder not just of where this started, but of how far we've come. Those friends are still playing, by the way. Now with custom trophies, years of history tracked automatically, and rivalries that have outlasted the original Excel file by years.


Want to play? Join at leaderboardfantasy.com

Curious about the development process? Read the full AI-assisted development story

Technologies Used
  • Java 21
  • Spring Boot 3.5
  • MongoDB Atlas
  • Google Cloud Run
  • App Engine
  • Terraform
  • Spring AI
  • Gemini
  • Redis
  • Docker
  • Thymeleaf
  • Tailwind CSS
  • GitLab CI/CD