← back to Site Factory

PROCESS.md

228 lines

# Site Factory — Process Spec

**Status:** DRAFT — blocked on 5 questions at the bottom. No code until those are answered.
**Created:** 2026-04-30
**Owner:** Steve

The "Site Factory" is the meta-pipeline that takes a freshly-registered domain to a launched, branded, monetized, app-store-ready site with a live admin and a 3D factory-floor visualization. It's the productized version of the work Steve has been doing site-by-site (Forza, Phillipe Romano, Novasuede, Wholivedthere, etc.), but driven end-to-end by the 4 Horsemen + skill chain, with a built-in Manager critic agent at every step.

## Suggested fixes (top, per Steve's rule)

> Anything found by the Manager-critic at any stage gets logged here, with severity + diff suggestion + which-skill-to-rerun.

_(empty — pipeline not built yet)_

---

## Pipeline (linear stages, each with a Manager pass before it advances)

```
                    ┌─────────────────── Manager critic loop ──────────────────┐
                    │                                                          │
0. Intake ──► 1. Domain ──► 2. Brand ──► 3. UX ──► 4. UI ──► 5. Build ──► 6. Deploy ──► 7. Monetize ──► 8. Analytics ──► 9. Launch ──► 10. App Store
                    │                                                          │
                    └─► writes to /docs/site-factory/<domain>-<date>.gdoc ──────┘
                          + appends to master spreadsheet (one row per action)
                          + posts to CNCP analytics panel
```

**Manager critic = `code-reviewer` + `architect-reviewer` + `style-lint` + `a11y-check` subagents in parallel after every stage.** If any returns a sev≥medium finding, the pipeline pauses and the finding goes to the top of `Suggested fixes`. Steve approves or `/loop`s the stage.

### Stage 0 — Intake
- Input: domain name + 1-paragraph "what is this site for"
- Action: pick a palette index (mod 20) → assign to project
- Output: `~/Projects/site-factory/sites/<domain>/intake.json`

### Stage 1 — Domain (skill: `domain-setup` → `domain-email-setup`)
- Register at GoDaddy (skip if already owned)
- NS swap → Cloudflare zone (proxy on)
- A record → Kamatera `45.61.58.125` → reverse-proxy slot
- Let's Encrypt SSL via certbot
- PurelyMail MX + SPF + DKIM + DMARC
- Mailbox: `info@<domain>` provisioned, password stashed in 1Password vault entry `info@<domain>`
- Reconcile to `~/cncp-starter/cncp-config.json` `domains[]`
- **Manager:** verify DNS propagation, MX deliverability test, SSL grade ≥ A

### Stage 2 — Brand (skill: `frontend-design` + `theme-factory` + `palette` + `four-horsemen`)
- Pull palette from rotation (top-20 fashion-house index — see Q4)
- Generate 3 variants via `stampede` skill (maximalist / refined / brutalist)
- Steve picks 1 in CNCP "Site Factory" panel → that becomes the brand
- Output: `brand.json` (palette, type scale, logo SVG, hero image)
- **Manager:** check contrast ratios (WCAG AA), font licensing, palette uniqueness vs other site-factory sites

### Stage 3 — UX (skill: `four-horsemen` Paper module)
- Wireframe the Steve-standard layout:
  - Single-page, hero + scroll
  - Hamburger top-right → right-slide panel
  - Panel tabs: About Us · Contact · What it does · Who it's for · Pricing
  - 3-tier pricing: Free / Tier 2 / Tier 3 (names per-site)
- Output: `ux.json` (Paper file id + screenshot)
- **Manager:** flow review, no-dark-pattern check, mobile + iPad breakpoints planned

### Stage 4 — UI (skill: `four-horsemen` Figma + 21st.dev Magic)
- Translate UX wireframe + brand into final UI components
- Mobile-first, iPad breakpoint, desktop max-width 1440
- Output: Figma file URL + 21st.dev component bundle
- **Manager:** `style-lint` + `a11y-check` on the rendered UI screenshots

### Stage 5 — Build (skill: `frontend-developer` subagent)
- Next.js 14 app router, TypeScript, Tailwind, shadcn/ui
- Auth: Google OAuth via `google-oauth-integration` skill — separate `/admin` and `/` (user) flows
- Admin = Wix-like editor: live color/font/copy/section CRUD writing back to project's `theme.json`
- Admin sidebar: "Hook a skill" buttons (each opens the skill's UI in iframe — `four-horsemen`, `palette`, `style-lint`, etc.)
- Admin AI suggestion panel: streams `code-reviewer` + `style-lint` findings
- **Manager:** `code-reviewer` + `security-auditor` + `architect-reviewer` parallel pass, must be green before deploy

### Stage 6 — Deploy
- Primary: **Vercel** (per Steve's request, App-Store-ready PWA)
- Mirror: **Kamatera** under `<domain>.local` + nginx reverse proxy (fallback origin if Vercel goes down)
- CF: keep proxy on, set Vercel as origin via CNAME
- **Manager:** Lighthouse + `performance-audit`, fail if perf < 80 mobile

### Stage 7 — Monetize
- Stripe (default): Products + Prices for the 3 tiers, Checkout Session per tier, webhook → Postgres `site_factory.subscriptions`
- Per-site Stripe Restricted Key, scoped to that site's product family
- (Q2: clarify "Revnu" — RevenueCat? Razorpay? Direct Stripe only?)
- **Manager:** PCI scope check, webhook signature verification test

### Stage 8 — Analytics
- GA4 property per site under `steve@designerwallcoverings.com`
- Server-side: `analytics_events` table in Postgres, one row per page view + signup + checkout
- CNCP "Site Factory" panel pulls from both
- Per-project Gdrive doc updated nightly with: pageviews, signups, MRR, top pages, manager findings
- **Manager:** verify GA4 events fire, no PII in event params

### Stage 9 — Launch checklist
- robots.txt + sitemap.xml + canonical URLs + OG images per page
- 404 + 500 pages styled
- Cookie banner (since GA4)
- Terms / Privacy pages auto-generated from template
- **Manager:** SEO audit (meta tags, schema.org, internal links)

### Stage 10 — App Store readiness
- PWA manifest + service worker + offline shell
- Capacitor wrap → iOS + Android binaries
- TestFlight upload via `fastlane` (Q3 confirms whether you want full native or PWA-wrap)

---

## The Manager critic agent (per Steve's update)

Every stage above ends with:
```
manager.review(stage_output) →
  parallel:
    - code-reviewer subagent
    - architect-reviewer subagent
    - style-lint skill (UI screenshots)
    - a11y-check skill
    - security-auditor (stages 5–7)
  → consolidated report
  → if any sev ≥ medium: pause + bubble to top of Suggested-fixes
  → else: advance
```

The Manager has its own log line: `~/Projects/site-factory/logs/manager-<domain>.log`.

---

## Per-site directory layout

```
~/Projects/site-factory/sites/<domain>/
  intake.json
  brand.json          # palette, fonts, logo
  ux.json             # paper file ref
  ui.json             # figma + 21st refs
  theme.json          # live admin-editable
  app/                # Next.js source
  manager/            # all critic findings, json
  analytics/          # nightly GA4 + Stripe pulls
  PROJECT.gdoc.json   # gdrive doc id + last-sync
```

## Master logs

- **Spreadsheet** (Q5): one master Google Sheet `Site Factory — Actions Log`, one row per pipeline action, columns: timestamp · domain · stage · skill · status · manager-findings-count · gdrive-doc-link
- **Per-project Gdoc**: `Site Factory / <Domain> / <YYYY-MM-DD>` — index at top, suggested fixes at top of body, then stages, lessons, analytics
- **CNCP panel**: new tab `Site Factory` showing all sites + GA4 + Stripe MRR + Manager findings counts

---

## 3D Three.js factory viewer

- Path: `~/Projects/site-factory/viewer/`
- Stack: Three.js + React Three Fiber + drei
- Scene: factory floor, 10 conveyor stations (one per pipeline stage), little worker avatars walking site-cards from station to station
- Each card = one domain currently in pipeline; speed = stage progress
- Worker animations from `avatar-dance` skill if `?fun=true`
- Live-fed by WebSocket from `site-factory-orchestrator` agent (new pm2 entry `sf-orchestrator`)
- **Manager finding** spawns a red-flashing exclamation over the affected station

---

## Skill chain (sequence Steve asked for)

```
domain-setup → domain-email-setup → palette → theme-factory →
four-horsemen (Paper → Figma → 21st → Canva) → stampede (3 variants) →
frontend-design → frontend-developer → google-oauth-integration →
webapp-testing → a11y-check → performance-audit → style-lint →
code-reviewer → security-auditor → dw-eod-report-generator
```

Manager critic (`code-reviewer` + `architect-reviewer` + `style-lint` + `a11y-check`) runs as a 4-way parallel subagent after every stage.

## Infra additions

- New PM2 entry: `sf-orchestrator` on port :9880 (REST + WS)
- New PM2 entry: `sf-viewer` on port :9881 (3D factory)
- New PG schema: `site_factory.*` (sites, stages, manager_findings, analytics_events, subscriptions)
- New launchd: `com.steve.sf-nightly-gdoc-sync` runs 02:00 daily, pushes per-site analytics to each project's Gdoc
- New launchd: `com.steve.sf-hawk` watchdog (mirrors `pd-hawk` pattern)

---

## RESOLVED — 2026-04-30

- ✅ 3 sites: **wholivedthere.com, bubbesblock.com, claimmyaddress.com**
- ✅ Payments: **Stripe only** (no RevenueCat)
- ✅ Palettes: rotated fashion-20, overrides older "shared Gucci" memory for these 3
- 🟡 Defaulted (flag if wrong): App Store via PWA+Capacitor; canonical fashion-20 list; Drive folder `Site Factory/`

## OPEN QUESTIONS — historical, kept for traceability

1. ~~**The 3 starter sites.**~~ ✅ Steve 2026-04-30: **wholivedthere.com, bubbesblock.com, claimmyaddress.com** (the WhoLivedThere ecosystem from existing memory). Note: these are not yesterday-purchases — they're the existing 3-domain home-history platform with `~/Projects/wholivedthere/PLAN.md` already in flight. Site Factory will rebuild them as the first 3 productions. ⚠️ Conflict to resolve: existing memory says **Gucci palette** — does that still hold, or override with rotated fashion-20 indices?

2. **"Stripe or Revnu".** Stripe I'll wire by default. "Revnu" — did you mean **RevenueCat** (subscription-mgmt layer for App Store/Play in-app purchase), or something else? If RevenueCat, that pairs with the Stage 10 Capacitor wrap. Skip it for the web-only payment path.

3. **App Store path.** Vercel ≠ App Store. Two routes:
   - **(a)** PWA + Capacitor wrap → iOS + Android binaries via fastlane (1–2 days work, ~80% of native UX)
   - **(b)** Full native iOS (SwiftUI) + Android (Kotlin) — separate codebases, far longer
   - **Default I'd pick:** (a). Confirm?

4. **Top-20 fashion-house palette source.** Should I pick the canonical 20 (Chanel, Hermès, Gucci, LV, Prada, Dior, Burberry, YSL, Versace, Balenciaga, Tom Ford, Bottega, Valentino, Loewe, Givenchy, Celine, Fendi, Miu Miu, Off-White, Acne)? Or do you have a list? Each palette = 5 colors (primary, secondary, accent, surface, ink). Rotation is per-site index modulo 20 → no two adjacent sites share a palette.

5. **Gdrive + Sheet locations.**
   - The master spreadsheet — under `steve@designerwallcoverings.com` Drive, in which folder?
   - Per-project Gdocs — same Drive, in a `Site Factory/` folder?
   - And: do you want the Manager findings auto-emailed via the `george-gmail` agent, or only logged to the Gdoc?

---

## Once answered

I'll execute in two waves, both in parallel where independent:

**Wave A (infra) — runnable as soon as Q1+Q5 answered:**
- scaffold `~/Projects/site-factory/{orchestrator,viewer}`
- PG schema migration
- pm2 entries `sf-orchestrator` (:9880) and `sf-viewer` (:9881)
- launchd watchdog `com.steve.sf-hawk`
- CNCP panel stub

**Wave B (3 starter sites) — runnable as soon as Q1–Q4 answered:**
- run all 3 through Stages 0–9 in parallel (max-CPU/RAM as requested)
- each gets a unique palette index from the fashion-20
- each ends at Stage 9; Stage 10 (App Store) only on confirmed sites