Serverless PDF Automation Pipeline

Generates 1M+ personalized print-ready PDFs from 1B+ records in under 50 minutes - no database, no VMs.

PythonGCPCloud FunctionsCloud RunBigQueryCloud StorageFlaskDocker

Replaced a $200K/year mail-house vendor with a zero-database, serverless GCP pipeline that turns raw property records into personalized, print-ready PDFs at scale.

The Challenge

Client workflows relied on error-prone mail houses that couldn't handle dynamic property lists or provide auditability. Manual filtering of 17M+ properties had to contend with inconsistent addresses (+5/+9 ZIP variants, inconsistent formatting), and the client required a fully serverless, zero-maintenance architecture.

Key Decisions & Tradeoffs

  • Diagnosed a BigQuery-to-Pandas serialization bottleneck that was pushing batch processing to 30 minutes; re-routed the data through a BigQuery-to-Cloud-Storage CSV export instead of querying directly into a DataFrame, cutting that step to 3 minutes (90%+ reduction) without touching the pandas-gbq internals.
  • Rejected the ChatGPT API for owner-name deduplication after it proved unreliable at scale; implemented deterministic Levenshtein-based fuzzy matching instead, handling real-world address noise fully offline.
  • Used BigQuery tables for job-state tracking and Cloud Storage as a message queue instead of a traditional database, meeting the client's zero-maintenance requirement while keeping the pipeline fully auditable.
  • Split the workflow into 7 chained Cloud Functions with state handoff via Cloud Storage exports to work around the 60-minute serverless execution ceiling.
  • Chose PDFmake (JSON-driven templating) over headless-browser rendering to avoid memory crashes during 1M+ PDF generation runs.

Outcome

Delivered with zero production failures post-launch, real-time progress tracking that restored client trust after the prior mail-house errors, and eliminated $200K/year in vendor costs. Delivered well inside the original multi-year estimate.

Built and owned end-to-end as part of a small team at iTechnolabs, alongside two other concurrent projects.