System Architecture
Relevant source files
The following files were used as context for generating this wiki page:
The FusionOps (internal name LP Factory) system is an Astro-based control plane designed for the creation, deployment, and tracking of PPC and affiliate marketing landing pages. The architecture follows a monorepo structure consisting of a frontend dashboard, multiple specialized Cloudflare Workers for backend logic and event tracking, and an integrated autonomous agent system (Hermes/FBIS) for risk analysis and operations.
Sources: CLAUDE.md:10-15, AGENTS.md:3-5
Core Monorepo Components
The system is organized into several distinct applications and services that handle different parts of the landing page lifecycle.
Monorepo Structure
| App | Technology | Purpose |
|---|---|---|
apps/lander | Astro + React | Main UI dashboard for campaign and template management. |
apps/api-worker | Cloudflare Worker + D1 | Primary CRUD API for campaigns, sites, and templates. |
apps/pixel-worker | Cloudflare Worker + D1 | First-party tracking pixel for clicks and conversions. |
apps/worker | Cloudflare Worker + D1 | Webhook handling, lead notifications, and validation. |
apps/fbis-mcp-server | Python FastMCP | Autonomous agent integration for ban intelligence. |
Sources: CLAUDE.md:28-66, INFRASTRUCTURE_SETUP.md:71-76
Architectural Data Flow
The following diagram illustrates the high-level interaction between the frontend, the various Cloudflare Workers, and the underlying databases.
The system leverages Cloudflare's Edge network to ensure low-latency tracking and landing page delivery. Sources: INFRASTRUCTURE_SETUP.md:5-40, CLAUDE.md:51-70
Database Layer
The project utilizes a hybrid database approach combining Cloudflare D1 for edge-localized storage and Neon Postgres for centralized site configuration and settings.
D1 SQLite Databases
D1 instances are used where edge performance is critical, such as tracking and real-time API responses.
- fusionops-main: Stores campaigns, templates, and site metadata.
- fusionops-pixel: Stores raw event data (clicks, user UUIDs, timestamps).
- fusionops-callback: Stores lead data received from external postbacks.
Sources: INFRASTRUCTURE_SETUP.md:71-76, CLAUDE.md:68-73
Neon Postgres
Neon is used as the primary relational store for higher-level management data.
- settings: A key-value store for global application configuration.
- sites: JSONB storage for complex landing page configurations.
- deploy_history: Tracks deployment status across various targets (Cloudflare, Vercel, Netlify).
Sources: INFRASTRUCTURE_SETUP.md:144-165, scripts/setup-infrastructure.js:338-360
Template and Build System
FusionOps uses a "Build-Variant" approach to generate landing pages. Templates are typically designed as Astro components or static HTML, then processed to inject dynamic values and tracking scripts.
Template Generation Logic
The template-router.js handles the routing and rendering of different template formats, including legacy modules and newer "Loveable" (React+Vite) imports.
Tracking Injection
A core requirement is the "zero-GTM" tracking architecture. The build pipeline automatically injects three layers of tracking:
- Layer 1:
window.dataLayerpush for form events (form_start,form_submit). - Layer 2: First-party pixel via
navigator.sendBeaconto the Pixel Worker. - Layer 3: Conditional Voluum
dtpCallbackscripts.
Sources: gen-lp.md:65-75, src/utils/template-router.js:154-180
Hermes + FBIS Autonomous System
The system includes a suite of autonomous agents powered by a Python FastMCP server. These agents perform nightly analysis to detect "ban patterns" and risk levels for advertising accounts.
Agent Teams
- FBIS Team (Intelligence): Composed of agents like ARGUS (Proxy risk) and CHRONO (Ban timeline prediction).
- LP Builder Team: Automates the construction of landing pages using the template system.
- Verdict Agent: Aggregates scores from other agents to produce a final
verdict_score(0-100) and triggers auto-pause rules if scores exceed thresholds (e.g., score ≥ 80).
Sources: HERMES_FBIS_AUDIT.txt:30-45, HERMES_FBIS_AUDIT.txt:74-85
Risk Scoring API
The API Worker exposes specific endpoints for the Hermes agents to store and retrieve analysis data.
| Endpoint | Method | Action |
|---|---|---|
/api/analysis/risk-score | POST | Writes calculated risk scores to D1. |
/api/accounts | GET | Queries advertising account status for analysis. |
/api/pixel-events | GET | Retrieves click/conversion data for quality analysis. |
Sources: HERMES_FBIS_AUDIT.txt:115-125, HERMES_FBIS_AUDIT.txt:168-180
Infrastructure Management
Infrastructure is managed via script-based automation and environment variable configuration.
Deployment Pipeline
Deployments are handled primarily through GitHub Actions, which execute the following steps:
- Trigger on push to
main. - Build the Astro site dashboard.
- Execute
inject-tracking.mjsto prepare landing page assets. - Deploy Cloudflare Workers using Wrangler.
- Deploy the dashboard to Cloudflare Pages.
Sources: CLAUDE.md:162-170, INFRASTRUCTURE_SETUP.md:200-210
Setup Automation
The setup-infrastructure.js script automates the creation of D1 databases and the execution of SQL migrations across the three required instances.
// Database configuration used by setup script
const CONFIG = {
databases: {
main: 'fusionops-main',
pixel: 'fusionops-pixel',
callback: 'fusionops-callback'
},
migrations: {
main: ['0001_init.sql', '0002_deploy_history.sql', '0002_add_templates.sql'],
// ... other migrations
}
};
Sources: scripts/setup-infrastructure.js:28-40, scripts/setup-infrastructure.js:158-180
The FusionOps architecture represents a highly distributed and automated system, optimized for performance at the edge while maintaining a robust centralized control plane for complex marketing operations and risk management.