We all have those lingering items on our to-do lists, tasks we initially planned to tackle swiftly, only to find years have slipped by. For me, it was a cloud portfolio challenge from June 2022, focused on building an image delivery service. What started as a simple bookmark eventually transformed into something far more ambitious and technologically advanced, thanks to the rapid evolution of cloud and AI in the intervening years. This is the story of my “AI Image Battle Arena,” a project that proves sometimes, waiting for the right tools can lead to truly exceptional results.

The original challenge, proposed by Lars Klint, called for an image delivery service incorporating compute, storage, load balancing, and a CDN. While straightforward, my vision diverged significantly when I finally revisited it in October 2025. I asked: What if the images weren’t static, but dynamically generated by AI, and users could engage in head-to-head battles to vote for their favorites? This reimagining gave birth to the AI Image Battle Arena 🥊.

Instead of a conventional image gallery, my application operates as follows:
1. Asynchronous AI Generation: Images are generated on a schedule using various AI providers like Freepik, Google Imagen, and Leonardo AI.
2. Interactive Voting: Users are presented with two random, AI-generated images from the same provider and vote on their preference via swipe gestures.
3. Real-time Analytics: A Valkey (Redis-compatible) database tracks votes, statistics, and winners.
4. Global Delivery: The entire service is powered by load-balanced full-stack droplets and served efficiently through a CDN.

This “Hot or Not” for AI art ensures fair comparisons by sourcing images from a single provider per battle, making the system robust and adaptable through intelligent provider management.

Embracing Simplicity: My Digital Ocean Journey

As a seasoned cloud architect with extensive experience across AWS, Azure, and GCP, I’m accustomed to the vastness of hyperscaler platforms. Yet, a recommendation to explore Digital Ocean proved to be a refreshing detour. The platform’s commitment to developer experience and simplicity truly shines, especially for innovative side projects.

Here’s why Digital Ocean stood out:

  • Managed Databases (Valkey): Setting up a Valkey cluster via Pulumi was remarkably intuitive, requiring minimal configuration beyond specifying size, region, and VPC.
  • Integrated Spaces + CDN: Digital Ocean Spaces, their S3-compatible object storage, comes with a built-in CDN. This seamless integration meant zero overhead in configuring global content delivery.
  • Enhanced Metrics Agent: A surprising bonus was the free, enhanced metrics agent for droplets, offering deeper observability into performance, including memory usage—a feature often premium on other platforms.
  • Support and Credits: Generous promotional credits and responsive, human-centric support further solidified a positive experience.
  • Streamlined Domain Management: Combining Namecheap for affordable domain registration with Digital Ocean’s nameservers provided a cost-effective and user-friendly DNS management solution.

While hyperscalers remain essential for enterprise workloads, Digital Ocean offers unparalleled agility for prototyping and learning, proving that different projects benefit from different tools.

Prioritizing Safety: The Choice of Random Prompts

A deliberate design choice for the AI Image Battle Arena was to generate images from a curated set of prompts rather than accepting user input. This decision was driven by three key considerations:

  1. Asynchronous Generation: Since images are pre-generated via cron jobs, there’s no live user session for input capture.
  2. Reduced Scope for User Input Management: User input introduces complexities like validation, rate limiting, moderation, and data privacy—aspects I aimed to defer for this project.
  3. Mitigating Prompt Injection: Using internal, pre-vetted prompts (crafted with Claude and Gemini) completely eliminates the risk of malicious prompt injection attacks.

This approach ensured the project remained focused on its core technical challenges rather than content moderation.

The 2025 Tech Stack That Made It Happen

The success of the AI Image Battle Arena hinges on a modern tech stack that wasn’t fully mature in 2022:

  • Backend with Go + Gin: Go’s performance, concurrency, and static typing made it ideal for the API server, managing image generation orchestration, provider fallback, and vote tracking.
  • Frontend with Next.js 14: The interactive voting interface was built with Next.js, leveraging its mobile-first design, Framer Motion animations, and server-side rendering for a smooth user experience.
  • Infrastructure as Code with Pulumi (Go): Moving beyond traditional IaC languages, Pulumi allowed me to define infrastructure in Go, benefiting from type safety, native language constructs, and improved error handling—creating a unified development environment.
  • AI Orchestration with Google Agent Development Kit (ADK): The true game-changer was Google’s ADK. This framework enabled the creation of an intelligent orchestrator agent that dynamically selects AI image providers, handles fallbacks, and manages retries—a level of sophisticated, automated resilience that was impractical just a few years ago.

Architecting for Resilience: Spaces as the Source of Truth

A critical architectural decision was establishing Digital Ocean Spaces as the single source of truth for all image data and metadata. While Valkey provides crucial “hot storage” for vote counts and real-time statistics, it functions purely as a performance cache.

This design is reinforced by a recreate_valkey flag in the deployment workflow. If needed, the entire Valkey cluster can be rebuilt from scratch by scanning object metadata stored persistently in Spaces. This decouples data persistence from caching, offering superior resilience, recoverability, and cost optimization. Losing the database means temporary performance impact, not data loss.

A Structured Approach: From Research to Deployment

My development process followed a clear, cost-effective pipeline:

  1. Phase 1: Research (Proof of Concepts): Before any core development, I conducted thorough API research for each AI provider, documenting authentication, request/response formats, and limitations. This proactive step eliminated integration headaches later.
  2. Phase 2: Backend Development: The Go API server was built, integrating the provider abstraction, ADK orchestrator, Valkey, and Spaces.
  3. Phase 3: Frontend Development: The Next.js voting interface was crafted, focusing on user interaction and responsiveness.
  4. Phase 4: Infrastructure (Pulumi): Only after local development was complete did I define and deploy the cloud infrastructure using Pulumi, minimizing billing and debugging in the cloud.

This “research-first, deploy-last” methodology ensures efficient resource utilization and a smoother development cycle.

Automated Deployment with GitHub Actions

A suite of GitHub Actions workflows provides robust CI/CD:

  • Deploy Workflow: A single click provisions all infrastructure (load balancer, droplets, database, CDN) and auto-deploys applications via UserData scripts, with configurable droplet counts and integrated monitoring.
  • Teardown Workflow: A secure, confirmation-required workflow to safely dismantle all cloud resources, halting billing and cleaning up DNS records.
  • Refresh Workflow: Synchronizes Pulumi state with actual cloud resources, detecting and resolving any configuration drift.

This automation transforms cloud deployments from a manual chore into a seamless, repeatable process.

Key Learnings and Surprises

This project offered invaluable insights:

  • The Value of Simplicity: Digital Ocean’s focused service offering enabled faster feature development.
  • IaC Language Cohesion: Using Go for both backend and infrastructure (Pulumi) significantly reduced cognitive load.
  • AI Agents are Production-Ready: Google ADK proved to be a powerful tool for building resilient, intelligent orchestration.
  • UserData’s Power: Leveraging UserData scripts for comprehensive droplet bootstrapping simplified deployment immensely.
  • Research is Paramount: Dedicated research time upfront saved countless hours during integration.

Challenge Met, and Exceeded âś…

The original challenge requirements were comprehensively addressed: compute (full-stack droplets), storage (DO Spaces), load balancing (DO Load Balancer), and CDN (DO Spaces built-in). Beyond that, the project incorporated:

  • Pulumi for Infrastructure as Code
  • Google ADK for sophisticated AI orchestration
  • Automated GitHub Actions for deployment
  • Production-grade monitoring
  • Robust security practices
  • Smart cost optimization

Final Reflection: Timing is Everything

Missing the 2022 deadline was, in hindsight, a blessing. The technology available in 2025—Google ADK, advanced generative AI APIs, a mature Pulumi Go SDK, and enhanced Digital Ocean features—allowed for a project that was not only compliant with the original challenge but also innovatively pushed its boundaries. For anyone with a long-standing project on their list, remember: sometimes, the perfect moment arrives when the tools and your skills align.

My thanks to Lars Klint for the initial spark, Kelby Enevold for introducing me to Google ADK, and the Digital Ocean team for a refreshingly positive cloud experience.

What’s Next? Part 2 is Coming đź“…

As my Digital Ocean credits approach their expiration, I’m planning a “lite” version of this project, focusing on cost optimization for sustained operation. Part 2 will delve into strategies for scaling down gracefully while preserving core functionality.

Follow me on LinkedIn for updates on Part 2!

Explore the Project

The full source code is available on GitHub: wheeleruniverse/cgc-lb-and-cdn.
Experience the live demo (when deployed): wheeleraiduel.online.

Your feedback and stars are welcome!

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed