Skip to content
James Ross
Agency · Front RowDeployed, pilot

Client reporting platform

Automated Multi-Client Marketing Reporting

Monthly multi-client reporting from GA4, Google Ads, Shopify, Klaviyo, and WordPress where numbers never come from the LLM.

stack: Next.js · PostgreSQL · pg-boss · SQL Window Functions · JSON Schema Validator · Chromium PDF · Postmark · Docker Compose / Coolify

Built for Front Row's digital division. Client details withheld.

01 / Problem

The problem

Monthly agency reporting across five disconnected marketing and commerce platforms breaks down when provider rate limits interrupt backfills or manual spreadsheets introduce calculation drift.

Using an LLM to draft client commentary creates unacceptable hallucination risk unless every number is computed deterministically and validated before a human ever sees the draft.

02 / Architecture

The build

  • Five connectors (GA4, Google Ads, Shopify, Klaviyo, WordPress) with graceful degradation, a Postgres token bucket enforcing provider rate limits, and resumable 14-month backfill.
  • Raw snapshots stored prior to normalization against a metric dictionary, with month-over-month and year-over-year computed via SQL window functions and checked by deterministic QA gates.
  • LLM-written narrative constrained to a strict JSON schema with a fact validator and repair loop, flowing into a draft/edited/approved review queue.
  • Immutable publications with restatements, Chromium PDFs, tokenized share links, and Postmark email delivery with bounce handling on Next.js, pg-boss, Postgres, and Docker Compose on Coolify.

03 / Diagram

System schematic

01 / 5 CONNECTORSGA4 · Google AdsShopify · KlaviyoWordPressPG token bucket14-mo backfill02 / DETERMINISTICSQL Window MetricsRaw snapshots + dictMoM / YoY + QA gatesZero LLM numbers03 / NARRATIVE QAJSON Schema LLMFact validator + repairDraft → Edited→ Approved queue04 / PUBLISHImmutableReportsChromium PDFPostmark + links
Five-source reporting pipeline: rate-limited connectors, raw snapshots, SQL window metrics, deterministic QA, and schema-validated LLM narrative.

04 / Scope

Status & scale

Status

Deployed, pilot

Connectors

5 data sources

Backfill window

14 months resumable

Core rule

SQL metrics only

05 / Stack

Components

  • Next.js
  • PostgreSQL
  • pg-boss
  • SQL Window Functions
  • JSON Schema Validator
  • Chromium PDF
  • Postmark
  • Docker Compose / Coolify

06 / Writing