# Architectural Response

**Re:** ModpackChecker Phase 11 — Complete Licensing & Distribution System
**Date:** 2026-04-12

## 1. Gemini's Verdict
Build the licensing system directly into Arbiter on Command Center. Two BuiltByBit listings (Standard $14.99, Professional $24.99), one webhook endpoint, tier detection via resource_id. No DRM, no obfuscation. Gated updates + gated support is the moat.

## 2. Action Plan

### Database (Command Center PostgreSQL — arbiter_db)
- [ ] Create `mvc_licenses` table: id, order_id (UNIQUE), buyer_id, discord_id (UNIQUE), tier (default 'standard'), max_activations (default 2), status (default 'active'), created_at
- [ ] Create `mvc_activations` table: id, license_id (FK), panel_domain, panel_ip, activated_at, last_seen, UNIQUE(license_id, panel_domain)

### Arbiter API Routes (src/routes/mvc.js)
- [ ] `POST /api/mvc/activate` — receives {order_id, domain, ip}, checks license exists + under activation limit, inserts activation, returns {status, tier}
- [ ] `POST /api/mvc/validate` — 72hr phone-home, updates last_seen, returns {status, tier}
- [ ] `POST /api/mvc/deactivate` — deletes activation row, frees slot
- [ ] `POST /api/mvc/webhook/bbb` — BuiltByBit purchase webhook, auto-provisions license with tier based on resource_id
- [ ] `GET /api/mvc/latest-version` — returns current version number for update checks

### Arbiter Environment Variables
- [ ] Add to .env: `BBB_STANDARD_RESOURCE_ID`, `BBB_PRO_RESOURCE_ID`

### Arbiter Discord Bot Command
- [ ] `/verify-mvc ORDER_ID` — checks mvc_licenses, if valid and discord_id not claimed by another user, sets discord_id and assigns "ModpackChecker Customer" role

### Blueprint Extension Changes
- [ ] Admin UI: Single "BuiltByBit Order ID" text input + "Save & Activate" button + status indicator (green/yellow/red/gray)
- [ ] Phone-home cron: Laravel Artisan command `mvc:validate`, registered to run daily via Schedule
- [ ] Payload: order_id, domain (config('app.url')), version, php_version
- [ ] Grace period: On validation failure, write status + expires_at to local config. Yellow banner in admin. After 7 days, red banner + hide client-facing widgets
- [ ] Tier-gated features: If tier != 'professional', disable FTB support, disable auto-cron, disable Discord webhook
- [ ] Update check: Call GET /api/mvc/latest-version daily, show "update available" link to BuiltByBit page in admin

### Pricing (LOCKED — DO NOT CHANGE)
- Standard: $14.99 (CurseForge + Modrinth, manual checks, 48h support)
- Professional: $24.99 (+ FTB, auto-cron, Discord webhooks, 24h support)
- Two separate BuiltByBit listings, same webhook URL
- Launch at full price, no discounts except 15% Discord-exclusive for bug reporters

## 3. Updated Rules/Context
- The Arbiter codebase is at services/arbiter-3.0/ but deploys to Command Center at /opt/arbiter-3.0
- Arbiter deployment pattern: backup → clone to /tmp → syntax check → copy to /opt/arbiter-3.0 → restart service → verify
- Database is PostgreSQL arbiter_db on Command Center (127.0.0.1)
- The Chronicler handles Arbiter deployments via Trinity Core SSH — Code handles code writing, Chronicler handles deployment
- Blueprint extension code is at services/modpack-version-checker/blueprint-extension/
- Test the full flow on the Dev Panel before any production deployment
