# RecordGod

**The records vertical** — Discogs-native intake, canon/lore enrichment, storefront, 3D vinyl,
and the store-side API that PriceGod codes against. Records is the first and biggest **module**
of StoreGod, not a standalone product.

> **Architecture is canonical in [PLATFORM.md](../dealgod/PLATFORM.md).** If this README disagrees
> with that file, that file wins. Read it first for the three surfaces (dealgod.pro dashboard /
> store admin / storegod.pro marketing) and the three keys.

---

## ⚠️ Status — this repo is the origin, not the live code

RecordGod started life here as its own Postgres-native back-office app (a strangler replacing the
old WordPress plugin). It has since been **migrated into StoreGod as a plugin**. The live shop
`robotmonster.party/admin` runs the StoreGod **`storegod-new`** image, and the records code it
executes is **`../STOREGOD/plugins/recordgod/`** — not this repo.

- **Canonical / live code:** `../STOREGOD/plugins/recordgod/` (mounted by `core.packs` when the
  store's `STOREGOD_MODULES` includes records). That tree is newer and is what deploys.
- **This repo:** the originating standalone app + the full docs/history vault. Recent commits
  here are kept in **parity** with the StoreGod plugin (e.g. the `storegod_v1` rename), but new
  feature work lands in StoreGod. Treat this as **legacy/reference** — verify against the plugin
  before trusting anything here as current.

If you are doing store-app work, work in `../STOREGOD`. This repo is for archaeology, the docs in
`docs/`, and the data/migration scripts at the root.

---

## The name change

**"WowPlatter" is dead.** It was the WordPress founder and the original API namespace. The name
is retired in favour of **StoreGod**. The API is now **`/storegod/v1`** (canonical) with
**`/wowplatter/v1`** kept only as a **legacy alias** for old PriceGod installs — remove once
nothing hits it. See `app/storegod_v1.py`.

## Where RecordGod sits in the platform

- **DealGod** is the brain (value / identify / lore / supply / ScanGod) and the account+billing
  home. RecordGod is a **client** of it — the store server holds a **StoreGod connect key**
  (minted in the dealgod.pro **STOREGOD tab**) and calls DealGod's `/api/*` server-side. See
  `app/dealgod.py`.
- **StoreGod** is the store software a merchant runs. RecordGod is a **module inside it**, not a
  separate service.
- **Management moved.** A store is provisioned and its connect key minted in the **dealgod.pro
  STOREGOD tab** — there is no separate storegod.pro admin panel. **storegod.pro is a marketing
  site only.**
- **PriceGod** (the Discogs seller extension) is the main API consumer. Staff laptops carry a
  staff `rg_…` token (handed out via the one-paste **`SG1.` connect code**), authenticate to the
  *store*, and the store proxies value to DealGod. No DealGod key ever touches the floor.

## The store contract (`/storegod/v1`)

The seam PriceGod codes against (`app/storegod_v1.py`, `require_token` in `app/auth.py`):

| Route | Purpose |
|---|---|
| `GET  /ping` | connection test + identity chip (`store`, `plan`, `name`, `role`) |
| `GET  /inventory/lookup?release_id=` / `?barcode=` | "do WE have this?" — the daily driver |
| `POST /inventory/intake` | new-stock intake → enrich from the `discogs_full` mirror → stage locally; carries `est_market_value` (the DealGod target from the PriceGod overlay) |

`release_id` (Discogs release id) is the universal join key. Intake stages non-destructively
(UPSERT on SKU); live/Woo stays authoritative for sale-state (see `docs/RECORDGOD_PLAN.md` §6).

## What's in this repo

```
app/            FastAPI app (main.py) — admin, shop, intake, sales, layout, payments (Square),
                storegod_v1 contract, dealgod client, 3D virtual store
schema.sql      inventory / virtual-store / sales tables, release_id-keyed, store_id seam
migrate*.py     one-shot MariaDB(clone)→Postgres migrators
disc_sync.py, customer_woo_sync.py, shipping_sync.py, audio_sync.py, refresh.sh
                data pipelines (Discogs disc art, Woo customer/shipping sync, previews)
docs/           the planning vault — RECORDGOD_PLAN.md (charter), WOWPLATTER_*_AUDIT/DEEPDIVE,
                DIG_FLIP_HANDOVER, NAVIGATOR/STOREFRONT/AI_AGENT plans, SCANGOD bridge briefs
```

## Run it (dev)

```bash
python3 -m venv .venv && ./.venv/bin/pip install -r requirements.txt
RECORDGOD_TOKEN=dev-tok ./.venv/bin/uvicorn app.main:app --reload --port 8010
./.venv/bin/python test_smoke.py    # infra-free self-check
psql recordgod < schema.sql         # Postgres schema
```

DB is `recordgod-db` on the VPS. Deploy of the **live** store is a StoreGod baked-image rebuild
(`../STOREGOD`, `bash deploy.sh`), **not** a deploy of this repo — see PLATFORM.md § Hosting.

## Start here

- **[docs/RECORDGOD_PLAN.md](docs/RECORDGOD_PLAN.md)** — the founding charter, triage, and build order.
- **[PLATFORM.md](../dealgod/PLATFORM.md)** — the canonical platform architecture.
