Skip to main content

Project Overview

A publisher-first ad server with OpenRTB compatibility and extensive customization capabilities.

Architecture Overview

ComponentTechnologyPurpose
API Layerinternal/apiREST handlers for ad requests and management
Selection Logicinternal/logicPluggable ad selection and filtering algorithms
Data Layerinternal/dbDatabase models and access patterns
ConfigurationPostgreSQLCampaign and line item storage
Operational DataRedisReal-time counters and rate limiting
AnalyticsClickHouseEvent tracking and reporting

Key Features

FeatureDescription
Publisher ControlPluggable ad selection logic, custom targeting, dual-counter pacing
Multi-Format Ad SupportHTML, banner (server-composed with responsive images), and native formats
Quality ControlBuilt-in ad reporting system for content moderation
AnalyticsClickHouse storage, Prometheus metrics, custom event tracking
IntegrationJavaScript SDK, server-to-server API, traffic simulator

Educational Focus

This ad server demonstrates core advertising technology concepts through working code. The implementation covers:

Ad Selection Logic: Rule-based filtering with pluggable selector patterns and optimized single-pass performance Campaign Pacing: Dual-counter systems for budget and impression distribution Real-time Decisions: Sub-100ms ad serving with caching and optimization Data Architecture: Multi-store patterns for configuration, counters, and analytics Integration Patterns: SDK design and server-to-server API structures Quality Control: User reporting and content moderation workflows

Target Audience

AudienceUse Case
Students & EducatorsLearn advertising technology through working code and documentation
PublishersUnderstand ad server internals and evaluate third-party alternatives
EngineersStudy complete ad serving implementation with modern Go practices
Product ManagersGain technical depth on ad serving capabilities and trade-offs

Project Scope

What this provides:

  • Educational platform for ad serving concepts
  • Foundation for small to mid-sized publishers to build upon
  • Starting point for custom ad selection algorithms
  • Research framework for ad serving behavior and integration experiments

What this is NOT:

  • Production ad server optimized for massive scale
  • Complete solution for large publishers
  • Replacement for existing monetization platforms

See limitations.md for detailed constraints and production considerations.

Customizable Ad Selection

Implement the selectors.Selector interface to create custom ad selection logic. The default RuleBasedSelector uses an optimized single-pass filter for maximum performance while maintaining standard targeting and pacing.

Available Filters (internal/logic/filters):

  • FilterByTargeting - Device, geo, registered dimensions, custom key-values
  • FilterBySize - Creative dimensions and format compatibility
  • FilterByActive - line item status
  • FilterByFrequency - User exposure limits
  • FilterByPacing - Daily delivery caps and dual-counter distribution
  • SinglePassFilter - Optimized implementation combining all criteria (3x faster)

Compose individual filters to build custom selection logic, or use the optimized single-pass implementation for maximum performance.