Skip to content

Repository files navigation

PhantomOS

The Operating System for Gaming Merchandise

PhantomOS is an AI-powered merchandise intelligence platform for gaming publishers. Connect your sales data, map products to IP assets with AI assistance, and unlock insights into what fans actually want.


The Problem

Gaming publishers sell merchandise featuring their IP but operate blind:

  • Sales data scattered across Shopify, Amazon, licensing partners
  • No visibility into which characters/themes drive revenue
  • Can't answer: "Which character sold best this quarter?"

The Solution

PhantomOS aggregates, maps, and analyzes merchandise data:

  1. Connect - Shopify OAuth, CSV import (Amazon, WooCommerce coming)
  2. Map - AI-assisted product tagging to characters, themes, logos
  3. Analyze - Revenue by IP asset, trend detection, demand forecasting

Our moat: The IP Asset Graph - a proprietary database of product-to-character mappings that doesn't exist anywhere else. See COMPETITIVE_MOAT.md for details.


Live Features

FeatureDescription
DashboardRevenue metrics, growth trends, category breakdown, asset performance charts
Sales MapInteractive world map showing revenue distribution by region (NA, EU, APAC, LATAM)
Fan Intelligence HubAI-powered insights with history tracking - mark recommendations as actioned, view past analyses
Asset TaggingMap products to game IPs and characters with AI suggestions that learn from confirmed tags
Data ConnectorsShopify OAuth, CSV import for products and sales
SettingsAccount management, team invites with secure tokens
Pilot WaitlistGated access system for controlled launch
Role-Based AccessOwner/Admin can edit; Member/Analyst are read-only
Analytics TrackingPosthog integration for user behavior insights

Tech Stack

LayerTechnology
FrameworkNext.js 16 (App Router), React 19, TypeScript
StylingTailwind CSS 4
DatabaseNeon PostgreSQL (serverless)
ORMDrizzle ORM
AuthNextAuth.js v4 (credentials, JWT)
AIAnthropic Claude API (claude-sonnet-4-20250514)
Rate LimitingUpstash Redis
EncryptionAES-256-GCM (credential encryption)
AnalyticsPosthog (EU region)
ChartsRecharts
IconsLucide React

Quick Start

# Clone and install
git clone https://github.com/ptengelmann/PhantomOS.git
cd phantomos
npm install
# Configure environment
cp .env.example .env.local
# Edit .env.local with your credentials# Push database schema
npx drizzle-kit push
# Run development server
npm run dev

Demo Data (Optional)

Seed with fictional "Phantom Warriors" game data:

DATABASE_URL="your-connection-string" npx tsx scripts/seed-demo-data.ts

Creates: 1 Game IP, 6 characters, 60 products, 6 months of sales (~$227K revenue)

Generate Analytics Snapshots

Populate analytics_snapshots and ai_insights tables:

DATABASE_URL="your-connection-string" npx tsx scripts/generate-analytics.ts --insights

Environment Variables

# Database
DATABASE_URL=postgresql://user:pass@host/db?sslmode=require
# Auth
NEXTAUTH_SECRET=random-32-char-string
NEXTAUTH_URL=http://localhost:3000
# AI
ANTHROPIC_API_KEY=sk-ant-...
# Analytics (Posthog)
NEXT_PUBLIC_POSTHOG_KEY=phc_...
NEXT_PUBLIC_POSTHOG_HOST=https://eu.i.posthog.com # or https://us.i.posthog.com# Shopify OAuth
SHOPIFY_API_KEY=your-shopify-api-key
SHOPIFY_API_SECRET=your-shopify-api-secret
# Rate Limiting (Upstash Redis)
UPSTASH_REDIS_REST_URL=https://xxx.upstash.io
UPSTASH_REDIS_REST_TOKEN=xxx
# Encryption (for connector credentials)
ENCRYPTION_KEY=32-character-hex-string # openssl rand -hex 32# Email (optional - Resend)
RESEND_API_KEY=re_xxx
EMAIL_FROM=noreply@yourdomain.com
# App Config
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Pilot Mode (optional)
PILOT_MODE=true
ALLOWED_EMAILS=dev@example.com
ADMIN_SECRET_KEY=your-admin-secret

Project Structure

phantomos/
├── src/
│ ├── app/
│ │ ├── (marketing)/ # Public: landing, features, FAQ, roadmap, waitlist
│ │ ├── (dashboard)/ # Protected: overview, intelligence, products, connectors, settings
│ │ ├── admin/ # Waitlist management
│ │ └── api/ # REST endpoints
│ ├── components/
│ │ ├── ui/ # Button, Card, Input, Badge, Table, Select
│ │ ├── charts/ # RevenueChart, AssetPerformanceChart, CategoryBreakdown, SalesMap
│ │ ├── dashboard/ # Sidebar, Header, StatsCard, ConnectorWizard
│ │ ├── marketing/ # Navbar, Footer
│ │ └── providers/ # SessionProvider, AnalyticsProvider
│ └── lib/
│ ├── db/schema.ts # Drizzle schema (13 tables)
│ ├── ai/index.ts # Claude AI integration
│ ├── auth/index.ts # NextAuth config + session helpers
│ ├── rate-limit/ # Upstash Redis rate limiting
│ ├── crypto/ # AES-256-GCM encryption
│ ├── audit/ # Compliance audit logging
│ ├── email/ # Resend email integration
│ ├── analytics/ # Posthog integration
│ └── utils/index.ts # Helpers
├── scripts/ # Database scripts
├── middleware.ts # Route protection
└── drizzle.config.ts # ORM config

Database Schema

TablePurpose
usersAuth accounts, linked to publisher
publishersMulti-tenant organizations
connectorsData sources (Shopify, CSV, etc.)
game_ipsGame franchises
ip_assetsCharacters, logos, themes within games
productsMerchandise items
product_assetsMany-to-many: products ↔ IP assets
salesOrder/revenue records
analytics_snapshotsPre-computed daily/weekly/monthly metrics
ai_insightsPersisted AI-generated recommendations
audit_logsCompliance audit trail for all actions
waitlistPilot program applications
invitationsRegistration tokens for approved users

See ARCHITECTURE.md for complete schema details.


API Endpoints

Dashboard & Data

MethodEndpointDescription
GET/api/dashboard/statsRevenue, orders, top assets
GET/api/productsProduct list with filters
POST/api/productsCreate/import products
GET/api/connectorsList connected sources

AI

MethodEndpointDescription
GET/api/ai/insightsRetrieve stored insights
POST/api/ai/insightsGenerate & persist Claude insights
PATCH/api/ai/insightsMark insight as read
POST/api/ai/taggingAI product tag suggestions
POST/api/ai/forecastRevenue forecasting

Connectors

MethodEndpointDescription
POST/api/connectors/shopify/authInitiate OAuth
GET/api/connectors/shopify/callbackOAuth callback
POST/api/connectors/shopify/sync/productsSync products
POST/api/connectors/shopify/sync/ordersSync orders

Waitlist (Admin)

MethodEndpointDescription
POST/api/waitlistSubmit application
GET/api/waitlist/adminList entries (requires key)
POST/api/waitlist/approveApprove application
POST/api/waitlist/rejectReject application

Design System

Monochromatic minimalism:

ElementStyle
Colors#0a0a0a (black), #737373 (gray), #e5e5e5 (border), #fafafa (bg)
Borders1px solid, no border-radius
TypographyGeist font, uppercase tracking-wide labels
PhilosophyData-first, invisible design

Commands

CommandDescription
npm run devDevelopment server (port 3000)
npm run buildProduction build
npx drizzle-kit pushPush schema to database
npx drizzle-kit studioOpen Drizzle Studio
npx tsx scripts/seed-demo-data.tsSeed demo data
npx tsx scripts/generate-analytics.tsGenerate analytics snapshots

User Management

Scripts for managing users and companies (run with DATABASE_URL env var):

# Create demo user (read-only access to demo data)
npx tsx scripts/create-demo-user.ts email@example.com Password123 "User Name"# Create new company (fresh account, no demo data)
npx tsx scripts/create-company.ts "Company Name" admin@company.com Password123 "Admin Name"# Reset user password
npx tsx scripts/reset-password.ts email@example.com NewPassword123
# Check user account details
npx tsx scripts/check-user.ts email@example.com

User Roles

RoleAccess Level
ownerFull access - edit, delete, invite, manage
adminFull access - edit, delete, invite
memberRead-only - view data only
analystRead-only - view data only

Documentation

FilePurpose
README.mdThis file - quick start guide
ARCHITECTURE.mdTechnical architecture details
ROADMAP.mdProduct roadmap and priorities
COMPETITIVE_MOAT.mdDefensibility and moat strategy
INVESTOR_READINESS_CHECKLIST.mdLaunch readiness tracking

Roadmap

Current Focus: Intelligence Platform (Phase 1)

  • Grow the IP Asset Graph
  • Improve AI tagging accuracy
  • Expand pilot program

Future Vision (Post-PMF):

  • Advanced AI (image recognition, NL queries)
  • Additional connectors (Amazon, WooCommerce)
  • Enterprise features (SSO, custom reporting)

Security Infrastructure (Complete):

  • Rate limiting on all API endpoints
  • AES-256-GCM credential encryption
  • Audit logging for compliance
  • Session-first authentication pattern

See ROADMAP.md for full details.


License

Proprietary - All rights reserved.


Built for gaming publishers who know their IP is their most valuable asset.

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages