# Trinity Console

**The Command Center for Firefrost Gaming**

Trinity Console is the comprehensive admin dashboard for managing Arbiter 3.0, built for The Trinity (Michael, Meg, Holly) to operate Firefrost Gaming's subscription-based Minecraft community.

---

## Philosophy

> "Fire + Frost + Foundation = Where Love Builds Legacy"

Built to be:
- **Maintainable from an RV** - Low-bandwidth friendly, no complex build pipeline
- **Scalable** - From soft launch to hundreds of subscribers
- **Resilient** - Real-time monitoring, automatic sync, comprehensive audit logs
- **Built for decades** - Not months

---

## Features

### Phase 1: Core Command Bridge
- Player management table (sortable, searchable, bulk actions)
- Server status matrix (grouped by node, real-time sync)
- Subscription tier management
- Force sync controls
- Dashboard with key metrics

### Phase 2: Intelligence & Safety
- Grace period tracking (3-day countdown)
- Chargeback/ban list management
- Discord role audit tools
- Payment failure tracking
- Automated alerts

### Phase 3: Legacy Polish
- Revenue analytics (MRR, tier migration)
- Player history tracking
- Admin audit log
- Minecraft skin previews
- Discord avatar integration
- Bulk import/export tools
- Real-time activity feed

---

## Tech Stack

**Backend:**
- Node.js + Express
- PostgreSQL 15
- EJS templating
- Server-Sent Events (SSE)

**Frontend:**
- htmx (SPA-like reactivity, zero build step)
- Tailwind CSS (utility-first styling)
- Vanilla JavaScript

**Why this stack?**
- No webpack, no npm build, no transpiling
- Works on spotty RV cellular connections
- Maintainable by non-developers (Meg, Holly)
- Fast, responsive, production-ready

---

## Directory Structure

```
src/
├── routes/admin/          # Admin routes
│   ├── index.js          # Main router
│   ├── middleware.js     # Auth guards
│   ├── dashboard.js      # Overview page
│   ├── players.js        # Player management
│   ├── servers.js        # Server matrix
│   ├── financials.js     # Revenue analytics
│   ├── audit.js          # Audit log viewer
│   ├── grace-period.js   # Grace period dashboard
│   ├── bans.js           # Ban management
│   ├── role-audit.js     # Discord role sync
│   └── api.js            # AJAX/htmx endpoints
├── views/admin/          # EJS templates
│   ├── dashboard.ejs
│   ├── players/
│   ├── servers/
│   ├── financials/
│   └── ...
├── views/components/     # Reusable components
│   ├── sidebar.ejs
│   ├── header.ejs
│   └── stats-card.ejs
└── public/               # Static assets
    ├── css/
    └── js/
```

---

## Database Schema

**New Tables:**
- `player_history` - Track tier changes
- `admin_audit_log` - Log all admin actions
- `banned_users` - Permanent ban list

**Enhanced Tables:**
- `subscriptions` - Added MRR, grace period, referrals

See `migrations/trinity-console.sql` for complete schema.

---

## Deployment

**Prerequisites:**
- Arbiter 3.0 deployed and running
- PostgreSQL 15 with base tables
- Discord OAuth configured
- Pterodactyl Panel API keys

**Steps:**
1. Run database migration: `psql -U arbiter -d arbiter_db -f migrations/trinity-console.sql`
2. Install dependencies: `npm install`
3. Restart service: `sudo systemctl restart arbiter-3`
4. Access: `https://discord-bot.firefrostgaming.com/admin`

---

## Access Control

**The Trinity (Full Access):**
- Michael (The Wizard): 269225344572063754
- Meg (The Emissary): 219309716021444609
- Holly (The Catalyst): 669981568059703316

Configured via `ADMIN_USERS` in `.env`

---

## Tier System

**Fire Path:**
- Fire Elemental ($5/month) - Tier 5
- Fire Knight ($10/month) - Tier 10
- Fire Master ($15/month) - Tier 15
- Fire Legend ($20/month) - Tier 20

**Frost Path:**
- Frost Elemental ($5/month) - Tier 105
- Frost Knight ($10/month) - Tier 110
- Frost Master ($15/month) - Tier 115
- Frost Legend ($20/month) - Tier 120

**Universal:**
- The Awakened ($1/month) - Tier 1
- The Sovereign ($499 lifetime) - Tier 499

---

## Development Timeline

**Designed:** March 31, 2026 (Gemini consultation)  
**Implemented:** April 1, 2026 (full code delivery)  
**Deployed:** April 1, 2026 (production ready)  
**Soft Launch:** April 15, 2026 (public access)

---

## Credits

**Architecture:** Gemini AI (trusted partner)  
**Implementation:** The Golden Chronicler #50 (Claude)  
**Vision:** Michael (The Wizard)  
**Built with love by The Trinity** 🔥❄️💙

---

*"For children not yet born"*
