Skip to Content
Engineering11 Documentation 🔥

CDN API

Pluggable CDN cache purging with Cloudflare integration.

What It Does

The CDN API provides an abstract interface for managing CDN cache purging operations with support for multiple CDN providers. Currently implements Cloudflare with an extensible factory pattern for adding additional providers.

Key Capabilities

  • Cache Purging: Clear cached files from CDN by URL
  • Provider Abstraction: Unified interface for multiple CDN providers
  • Secure Credentials: Integration with GCP Secrets Manager
  • Factory Pattern: Easy provider selection and instantiation

Main Components

BaseCDNService

Abstract base class defining CDN operations:

abstract purgeFiles(files: IFilesPayload): Promise<unknown>

Cloudflare Service

Concrete implementation for Cloudflare:

  • Retrieves credentials from secrets manager
  • Makes API calls to Cloudflare purge endpoint
  • Handles responses and logging
  • Graceful error handling

CDNFactory

Provider selection and instantiation:

CDNFactory.getProvider(provider?: ProviderList)

Common Use Cases

  • Cache invalidation when content updates
  • CDN cache management at scale
  • Multi-provider CDN support

What Customers Don’t Have to Build

  • Cloudflare API integration
  • Cache purge operations
  • Provider abstraction
  • Credential management
  • Error handling for CDN operations
Last updated on