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:
- Health:
is_healthy()returnsTrue. - Quota:
quota_remaining > 0. - Preference Order: CloudConvert → Adobe → ApyHub → Google Drive → Zamzar.
Failover occurs on:
QuotaExceededErrorRateLimitErrorProviderUnavailableError
Related¶
- Adding a New Provider - Extend the provider architecture.
- High-Level API - API reference for
ConverterandConfig. - Provider Protocols - Detailed protocol definitions.