Engineered for High-Throughput Media Assembly & Autonomous Social Distribution
Explore the verified systems architecture of the Content Automation Platform: an autonomous, multi-tenant media production suite powered by 16 decoupled n8n workflow engines, multi-provider AI failover (Groq & Gemini), Windows SAPI / FFmpeg media synthesis, and idempotent fail-closed publishing to YouTube and Meta.
System Overview & Ingress Perimeter
The Content Automation Platform organizes content production across three operational tiers: an operator-facing CoreUI dashboard served by an Express BFF API (port 3000), 16 decoupled n8n workflow engines (port 5678) acting as distributed state machines, and a specialized background worker tier coordinating video assembly (FFmpeg), audio synthesis, and visual quality assurance.
01. Decoupled State Machine Orchestration
Instead of a monolithic backend worker, business processes are partitioned into 16 discrete n8n workflow definitions. Each workflow maintains an independent error-handling boundary, executes idempotent state mutations, and delegates heavy media compute to isolated Node.js child processes.
-
Reviewed
workflows/01_master_orchestrator.jsonCoordinates cron triggers and dispatches trend research jobs
-
Reviewed
workflows/12_supervisor_sentinel.jsonDeadlock detector and lease reaper for abandoned worker jobs
-
Reviewed
workflows/13_global_error_handler.jsonCentralized classification of network, quota, and schema failures
02. Pessimistic Lease Locking & Concurrency
High-throughput distributed media generation requires strict concurrency control. The PostgreSQL database uses sequential migrations to define a resilient job queue with row-level locks (SELECT FOR UPDATE SKIP LOCKED) and 30-second worker heartbeats to guarantee at-most-once execution.
-
Test Verified
database/schema.sql (lines 45–120)Defines jobs_queue, content_items, and worker_heartbeats tables
-
Reviewed
database/migrations/001_initial_schema.sqlForeign key constraints and immutable audit history triggers
-
Test Verified
tests/database.test.jsAsserts lease expiration, renewal, and deadlock protection
03. AI Provider Resiliency & Quota Circuit Breaker
Procedural script generation leverages Groq's high-speed Llama 3.3 70B model for primary synthesis. When rate limits (HTTP 429) or service outages (503) occur, requests automatically fail over to Google Gemini 2.5 Pro. If all providers exhaust quotas, the circuit breaker opens into a 60-second cooldown.
-
Reviewed
workers/original_generator.js (lines 55–130)Multi-provider adapter implementing exponential backoff
-
Reviewed
workflows/16_original_generation.jsonDynamic provider routing node with quota validation fallback
-
Reviewed
database/migrations/005_quotas.sqlProvider quota ledger tracking rolling token expenditure
04. Fail-Closed Rights & Human-in-the-Loop Review
Copyright risk and platform policy compliance are enforced before synthesis begins. Unlicensed source content is rejected at Workflow 04. Rendered video drafts undergo automated black-frame and audio QA (port 9100) before presenting in the CoreUI approval modal for explicit human sign-off.
-
Reviewed
workflows/04_rights_verification.jsonAutomated Creative Commons and license attribution check
-
Reviewed
workers/qa_worker.js (port 9100)FFmpeg freeze-frame detector and silence threshold analyzer
-
Reviewed
server/index.js (/api/approvals)Idempotent approval gateway generating signed publishing tokens
| Subsystem | Source Location | Evidence Artifact | Truth Classification | Architectural Role |
|---|---|---|---|---|
| Orchestration | workflows/01-16_*.json |
16 n8n workflow definitions | Code Reviewed | Distributed state machines for trend discovery, synthesis, QA & distribution |
| State Engine | database/schema.sql |
35 SQL table schemas + 8 migrations | Test Verified | Pessimistic lease locking, audit logging, and quota ledger |
| BFF REST API | server/index.js |
Express server on port 3000 | Code Reviewed | Operator authentication, approval endpoints, and telemetry aggregation |
| Video Synthesis | workers/original_generator.js |
Node worker + Windows SAPI & FFmpeg | Code Reviewed | Procedural script generation, TTS audio rendering, and subtitle burn-in |
| Technical QA | workers/qa_worker.js |
FastAPI / Express worker on port 9100 | Code Reviewed | Automated detection of frozen frames, audio clipping, and black screen |
| Social Publisher | workers/youtube_publisher.js |
Google API Client v3 resumable upload | Code Reviewed | Fail-closed YouTube and Meta distribution with token idempotency |
| Operator UI | frontend/src/ |
CoreUI React 18 + TypeScript | Code Reviewed | Pipeline control dashboard, job monitoring, and approval review modal |
| Automated Tests | tests/ |
7 test suites (database, api, workers) | Test Verified | Regression suites verifying lease lifecycle, schema integrity & error traps |
⚠️ Honest Engineering Disclosures & Environment Assumptions
To ensure complete integrity in technical recruitment and architectural evaluations, the following boundaries must be explicitly noted:
- Windows Platform Dependency: Audio synthesis currently invokes Windows SAPI TTS via native PowerShell sub-processes (
workers/original_generator.js). Production Linux containerization requires swapping to Piper TTS or an external TTS API. - Live Credentials Scope: In accordance with security preflights, live YouTube OAuth tokens and paid Groq/Gemini API keys are not stored in repository configuration. Production deployment requires external secrets injection via Docker environment or HashiCorp Vault.
- FFmpeg Binary Dependency: Media assembly and QA analysis require FFmpeg 6.0+ installed and discoverable on system PATH.
- No Unbounded Concurrency: Concurrency is intentionally capped by database connection pool sizing (default 20 connections) to avoid overwhelming local CPU during media encoding.