# RANKORA — BUILD RULE (non-negotiable)

## The one rule
Build **Rankora** as a **100% real, working, real-time clone of Adaptify's functionality and UI/UX**.
Every feature must **actually work** — no fake data, no stubs, no placeholders, no hallucinated
fields, no "coming soon". If a feature is configured in the UI, it must *do the thing* for real.

## Hard requirements
1. **Real, not fake.** Every number/state comes from real data or a real API call. Empty = honest zero/`—`, never invented.
2. **No guessing.** Build from the recon findings below. If a detail isn't in them, mark it `NOT FOUND` and ask — do not invent.
3. **Same UX as Adaptify.** Match the screens, flows, copy, enums, and behaviors exactly (top-nav + site switcher, Website Overview, one-click publishing via plugin + connection code, white-label, backlinks, GEO, keyword strategy, reporting).
4. **Verify everything.** Each slice: `pnpm exec tsc --noEmit` clean → `pnpm build` passes → tested live on :3007 before claiming done.
5. **No broken buttons / links.** Everything clickable must resolve and function.

## Source of truth (the findings — read these, don't guess)
- `rankora/RECON-BUILD-SPEC.md` — exact field names, enums, payloads per section (from the real captured API)
- `/Users/bilalkarim/Documents/siki-etc/adaptify-local/` — `endpoint-responses/*.json` (real API responses incl. `fs_bots.json` = full site settings), `deep-responses/`, `static/_next/static/chunks/*.js` (real client logic), `ADAPTIFY-*-API-REFERENCE.html`, `ADAPTIFY-UIUX-CLONE.html`
- `/Users/bilalkarim/Downloads/adaptify-seo/` — the **real Adaptify WordPress plugin** (`plugin.php`, `classes/`) → mirror its mechanism (WP Application Passwords + `/add-wp-pw` pairing, `adaptify/v1/info` route)
- `/Users/bilalkarim/Documents/seojin-app/docs/adaptify-ui/` + `SCREENSHOT-ANALYSIS.md` — annotated screen specs

## Key real facts (from recon — use exactly)
- **Publishing frequency** (sites.publishCadence): disabled(0/mo) · weekly(4) · regular(10, recommended) · daily(20) · boost(40–80). Field `autoPublishEvery` (days): ≥5→weekly, 2–4→10x, 1→20x, 0→disabled. `publishMode`: publish|draft. GEO toggle = `geoContentBeta`.
- **Platforms**: wordpress, webflow, shopify, wix, squarespace, ghost, hubspot, duda, lovable, other.
- **WordPress connect = one-click plugin + connection code** → plugin creates Application Password, POSTs `{code, site_url, user_name, application_pw}` to `/api/plugin/connect` (14-day code). NOT manual entry.
- **Backlinks**: `backlinkProfiles{authorName,bio,linkedinUrl,topics,backlinkPreference}`, `backlinkPlan` ∈ {0,1,2,3,5,10,20}/mo.
- **Brand/GEO**: platforms chatgpt|claude|gemini|perplexity; `numPrompts` (default 10); per-prompt `{brandMentioned,sentiment,competitorsMentioned,position}`.
- **Reporting/white-label**: `reportParams{toEmail,clientName,agencyName,reportTitle,weeklyReport,monthlyReport,notifyBacklinks,clientPortalEnabled,notWhiteLabeled,show{Backlinks,Technical,ContentAnalysis,PerformanceGraphs}}`.
- **Dashboard "SEO Potential"** = `/13` in Adaptify (exact 13-check calc NOT recoverable). Ours = real audit categories.

## App facts
- Stack: Next.js 16 (App Router) · Drizzle + better-sqlite3 (`rankora.db`) · Tailwind v4 · port **3007**.
- Login: `demo@rankora.app` / `demo1234` (demo) — created via real signup otherwise.
- Google OAuth creds are in `.env.local` (GSC live once the Google user is a test user).

## What needs external credentials to fully execute (state honestly, don't fake)
- GEO/SEO **analysis** + AI **content generation** → LLM API key (Anthropic/OpenAI).
- Backlink **outreach** sending → email provider.
- Live GSC data → the Google account must be an OAuth test user + own the property.
Everything else (plugin pairing, white-label, publishing adapters, settings) works with no external deps.

## Status ledger (update as you go)
- ✅ Auth (signup/signin/signout), Dashboard (clickable), Sites overview, Add site
- ✅ Google Search Console real OAuth (start/callback/refresh) + honest not-configured state
- ✅ Multi-platform publishing adapters (WP/Webflow/Shopify/Ghost/webhook) — real test+publish
- ✅ WordPress one-click plugin pairing (connection code + real PHP plugin + /api/plugin/connect)
- ✅ Website Settings hub (8 sections, real save)
- ✅ White-label execution (brand name/logo/color applied across shell)
- ⬜ Backlink outreach execution · GEO/SEO analysis execution · AI content generation (need keys/infra)
