Content Engine

Internal documentation — closet/storage niche (Pinterest)

Build Status

Render Pipeline

Done

Queue → Playwright render → PNG → Supabase Storage → public URL. Worker reads from render_queue_ready view, processes batches of 5.

Publish Worker

Blocked

Built and tested. Reads from next_pins_to_publish view, posts via Pinterest v5 API. Blocked on Pinterest trial access approval (App ID: 1555297).

Metrics Ingestion

Blocked

Built. Pulls daily pin analytics (impressions, clicks, saves) from Pinterest API, upserts to pin_metrics_daily. Also blocked on Pinterest API approval.

Optimization / Decision Engine

Not Started

Scoring logic, scale/pause/kill decisions based on CTR, EPC, RPP. Depends on metrics data flowing.

Scheduling / Orchestration

Not Started

Cron or task runner to automate the full loop: render → publish → collect metrics → decide → act.

Domain / Landing Pages

Blocked

bizzy-business.com purchased via Cloudflare Registrar. Nameserver mismatch blocking activation. Support ticket filed 2026-03-22.

Architecture

Ideas → Content → Visual Assets → Distribution → Learning ↑___________________________________↓ ┌─────────────┐ ┌──────────────┐ ┌───────────────┐ ┌──────────────┐ │ Supabase │────▶│ Render Worker │────▶│Publish Worker │────▶│Metrics Worker│ │ (state) │◀────│ (Playwright) │ │(Pinterest API)│ │(Analytics API)│ └─────────────┘ └──────────────┘ └───────────────┘ └──────────────┘ │ │ │ ┌──────────────────┐ │ └───────────────────▶│ Decision Engine │◀──────────────────────┘ │ (score → act) │ └──────────────────┘ Data + State = Supabase Execution = Node workers "What to do" "How it gets done" Platform-agnostic. First instance: Pinterest + closet/storage niche. Designed to clone across 40+ niches and multiple platforms.

Pin Lifecycle

draft → queued → posted → [paused | scaled | killed | error] │ │ └── render job ──────┘── publish queue ──▶ pinterest │ metrics_daily ──▶ decision

Workers

WorkerFileReads FromWrites ToStatus
Render worker.js render_queue_ready view image_render_jobs, Supabase Storage Live
Publish publish-worker.js next_pins_to_publish view publish_queue, pins Blocked
Metrics metrics-worker.js pins (posted) pin_metrics_daily Blocked

Schema Reference

TableRowsPurpose
pins35Core content. Title, hook, description, destination URL, status, Pinterest pin ID.
image_render_jobs15Render queue. Links pin to template, overlay text, rendered image URL.
publish_queue32Publish queue. Pin → board mapping, scheduling, attempt tracking.
products10Amazon affiliate products. Name, URL, price, category.
boards5Pinterest boards mapped to content clusters.
templates5Visual templates with format, style, fatigue tracking.
landing_pages1Affiliate landing pages. HTML, public URL, disclosure.
pin_metrics_daily0Daily performance: impressions, clicks, saves, revenue, computed CTR/EPC/RPP.
pin_decisions0Automated decisions: score, action, reasoning.
experiments0Hypothesis testing framework (planned/running/won/lost).

Key Views

ViewUsed ByJoins
render_queue_readyRender workerimage_render_jobs WHERE status = 'queued'
next_pins_to_publishPublish workerpublish_queue + pins + landing_pages + image_render_jobs

Runbooks

Run the render worker

Processes up to 5 queued render jobs per run. Run multiple times to clear the queue.

cd CE2 && node worker.js

Run the publish worker

Posts up to 5 queued pins to Pinterest. Requires valid PINTEREST_ACCESS_TOKEN in .env.

cd CE2 && node publish-worker.js

Run the metrics worker

Pulls last 7 days of Pinterest analytics for all posted pins. Set METRICS_LOOKBACK_DAYS in .env to change window.

cd CE2 && node metrics-worker.js

Re-queue pins for re-render

Reset completed render jobs back to queued (e.g., to fix local:// paths):

UPDATE image_render_jobs SET status = 'queued', render_status = 'queued', image_url = NULL WHERE image_url LIKE 'local://%';

Queue a pin for publishing

INSERT INTO publish_queue (pin_id, pinterest_board_name, priority, status, scheduled_for, attempts, max_attempts) VALUES ('PIN_UUID', 'Board Name', 1, 'queued', now(), 0, 3);

Add a new niche (future)

1. Create new boards in boards table with cluster name.
2. Create pins referencing the new cluster.
3. Add products for the niche to products.
4. Create templates if visual style differs.
5. Run render → publish pipeline as normal.

Active Blockers

Cloudflare nameserver mismatch — bizzy-business.com zone expects merlin/sureena nameservers but registrar has andy/naya. Cloudflare Registrar domains can't self-service fix this. Support ticket filed 2026-03-22. If no response by 2026-03-25, escalate.

Pinterest API trial access pending — App ID 1555297, created 2026-03-22. API returns 401 "application consumer type is not supported." App secret unavailable. Check email for approval. If still pending 2026-03-25, post in Pinterest Developer Community with App ID.

Amazon affiliate revenue ingestion — No integration yet. Revenue/orders columns in pin_metrics_daily default to 0. EPC and RPP will be inaccurate until Amazon data flows in.

Decision Log

2026-03-22: Migrated from ChatGPT to Claude

All project management and development moved to Claude (Cowork). ChatGPT docs in docs/archive/ are stale — this site is the source of truth.

2026-03-22: Switched to Supabase Secret API keys

Rotated from old JWT-based service_role key to new sb_secret_ format. Easier rotation, browser-safe rejection. All workers read from .env.

2026-03-22: Queue-based worker architecture

Each worker reads from a Supabase view, processes a batch, updates state. "What to do" = Supabase. "How it gets done" = Node workers. Designed to clone across niches without code changes.

Progress Reports

24.03.2026 Progress Report

Pre-data

26 pins live in Small Space Storage — first proof of end-to-end publishing. Publish worker ran, Pinterest accepted content, system moved from "built and waiting" to "live and accumulating."

Identified content_type tagging gap: Small Space Storage and Kitchen Organization have all pins tagged as generic pin with no info/affiliate split. Home Office is the only niche with the split correctly populated (220 info, 30 affiliate, 15 generic). Allocation engine can't run correctly without this fixed.

Analytics ingestion not flowing: 26 pins live, 0 impressions in database. Metrics worker completing with a fetch error — running but failing silently. Needs verification before the feedback loop can start. Held off on live pipeline run — no data to act on.

Three Kitchen Organization experiments designed and ready (EPC: single-product hero vs. multi-product roundup; CTR: before/after fridge transformation vs. product-only; CTR: specific space callouts vs. generic messaging). Waiting on pins to post and accumulate 500+ impressions each.

Tomorrow: Verify analytics ingestion, fix content_type tags across SSS and KO, post Kitchen Organization and Home Office pins, add real Amazon URLs to 10 home_office placeholder pins.

23.03.2026 Progress Report

Build Complete

Fixed all 685 broken destination URLs. 1,055 pins now point to live destinations: 1,004 to Pages subdomain landing pages by board, 51 to Amazon affiliate links. Zero broken URLs remain.

Renamed and cleaned the project folder to CE2. Deleted stale scripts, created archive folders, confirmed no broken references.

Diagnosed the Cowork sandbox network issue (proxy blocks direct Supabase calls) and built a GitHub Actions workflow (ce2-daily-run.yml) to run the pipeline externally. Ready to deploy — needs repo push and secrets configured.

Fixed Unsplash image integration in the render worker: added has_background tracking per job so pins that missed real photos during rate limits can be selectively re-queued without re-rendering the full set.

Blockers at EOD: Pinterest API approval pending, Cloudflare domain transfer earliest March 30, 10 home_office affiliate pins with placeholder Amazon URLs.

Last updated: 2026-03-24