Skip to content
Edit this page View source of this page

Architecture

Architecture

Overview

PDF Remote Converter is structured as a Python CLI tool and library. It uses a provider-based architecture to support multiple cloud API backends with failover and HTTP caching.

Key Components

Component Purpose
Converter High-level facade for document conversion.
Router Provider selection and failover logic.
ProviderBackend Protocol for provider implementations.
Config Pydantic settings for environment variables.
HTTP Client Hishel-cached httpx client for API requests.

Provider Architecture

All providers implement the ProviderBackend protocol:

class ProviderBackend(Protocol):
    name: str
    supported_formats: set[str]
    monthly_quota: int
    quota_remaining: int

    def convert(self, input_path: Path, output_path: Path) -> ConversionResult:
        ...

    def is_healthy(self) -> bool:
        ...

Failover Logic

The Router selects providers based on:

  1. Health: is_healthy() returns True.
  2. Quota: quota_remaining > 0.
  3. Preference Order: CloudConvert → Adobe → ApyHub → Google Drive → Zamzar.

Failover occurs on:

  • QuotaExceededError
  • RateLimitError
  • ProviderUnavailableError