Applying Infrastructure-as-Code Principles to Programmatic Advertising

Monetization as Code

Kainar Kamalov and Jim Payne

Monetization stack as a core part of your infrastructure, taken just as seriously. Leveraging modern software development principles to enable automation, version control, A/B testing and more. 

Ad Monetization Is Stuck in the UI Age

We define servers in Terraform, version-control Kubernetes manifests, and peer-review every change. 

Monetization systems, however—the revenue engine of the business—are still managed through tools designed for a different era. Teams across the organization use dashboards that don't have version changes, UIs that don't support peer review, and workflows that make it too easy for production issues to slip through. The tools need to evolve for everyone.

We think revenue configuration deserves the same rigor as infrastructure.  We drew our inspiration from the implementation and practical experience of shipping infrastructure software where the YAML configuration is the source of truth. This is even more true in the AI agent era where tools like Claude Code are at home making changes to text files, managing source control, and using the command line to push changes and monitor logs. We wanted the ad monetization user to be able to take advantage of this same paradigm.

1apps:
2 - id: com.acme.puzzle
3 name: Puzzle Game
4 platform: android
5 traffic_control: 100
6 bidder_network:
7 meta: meta_12345
8 liftoff: liftoff_56789
9 magnite: magnite_87654
10placements:
11 - id: home_banner
12 app_id: com.acme.puzzle
13 format: banner
14 sizes: [[320, 50], [728, 90]]
15lineItems:
16 - name: Premium US & UK Android Traffic
17 placement_group: banners
18 bidders: [meta, magnite]
19 bidfloor: 5.50
20 priority: 1
21 targeting:
22 countries: ["US", "UK"]
23 os: ["android"]
24 - name: Liftoff Interstitial
25 placement_group: [interstitial]
26 bidders: [liftoff]
27 bidfloor: 5.50
28 priority: 1
29 targeting:
30 os: ["android", "ios"]
31lists
32 - name: blacklisted_domains
33 type: DOMAIN
34 values: ["another.com", "test.com"]
35 - name: blacklisted_categories
36 type: IAB_CONTENT_CATEGORY
37 values: ["IAB2-18"]
38

What Monetization as Code Enables

With CloudX, publishers define their entire monetization setup in YAML files: apps, placements, price floors, targeting rules, bidder configurations. Version control them, diff them, roll them back. The same workflow you use for application code.

Lists are first class concepts in the CX monetization stack: blocklists, domains, geographies, and bidders. They can be referenced with auto complete or by AI, and managed in a single place.

Let’s go through a few examples of the power and convenience of this approach.

Architecture at a Glance

1. Your Inventory YAML as the Source of Truth

Every account lives in a single inventory file containing guardrails, app metadata, placements, line items, deals, and allow/block lists.

Teams can duplicate proven setups, preview hypothetical launches, or generate configs programmatically. Because it's just YAML, you can lint it, diff it, and roll back—like any other config file.

2. Real-Time Validation, Built into the Editor

Validation happens as you type. The same rules engine that safeguards production runs locally in the editor, so errors are caught before they reach the database.

You feel the guardrails instantly:

  • Business logic stays sane—priorities in range, bid floors positive, formats valid.
  • Dynamic lookups verify references for apps, placements, and IAB categories.
  • Critical IDs are protected with read-only cues and smart prompts.
  • Inline helpers—indentation, hover cards, category lookups—keep YAML readable

The validator and editor share the same rules. What works for humans works for automation. That's what lets AI agents propose changes that actually pass validation.

3. Diff and Atomic Deployment

Operators switch seamlessly between editing and a visual diff that mirrors code-review muscle memory—green for additions, red for deletions.

When you hit Apply, the system runs a transaction: updates the database, refreshes bidder mappings, invalidates caches. If something references a placement you're deleting, it warns you before anything commits.

4. AI Agents as Teammates

With structure in place, AI becomes a trusted collaborator, not a black box.

Each session follows a Load → Converse → Diff loop: load the latest configuration, discuss optimization goals, receive a proposed patch, inspect the diff, and approve or adjust. Because AI suggestions arrive as transparent YAML or JSON patches, intent is always clear—and humans stay firmly in control.

What This Unlocks

When a line item underperforms, teams will beagle to `git log` the placement config and see exactly when someone adjusted the floor. When you need to clone a setup for a new game, you copy a YAML file instead of clicking through forms.

For operations teams, staging becomes simple—it's just a different file. Disaster recovery is `git revert`. CI can validate configs before they merge.

And when you add AI into the mix, it's working against the same validation rules you are. You review its diffs the same way you'd review a teammate's PR.

Example

Lets go over the example of raising price floors by 10%


About CloudX

CloudX is building the next-generation Supply-Side Platform for mobile app publishers. We believe ad monetization should be:

  • Transparent — Version-controlled and auditable
  • Programmatic — API-first and automatable
  • Safe — Changes validated before deployment
  • Fast — Bulk operations, not UI clicking

Infrastructure-as-code changed how we ship software. It's time revenue operations got the same treatment.

Next time you're clicking through a dashboard to update price floors, ask yourself: Why isn't this in version control?

Kainar Kamalov and Jim Payne