Remove blockchain dependence from credit flow:
- watch credits now DB-only
- webhook earnings now DB-only
- wallet balance now DB-only
- admin bonus/adjustment routes operate on DB totals
Add admin adjustment API for account control.
Keep Solana service file unused for now; safe to delete later.
Credit economy changes:
- creditsPerMinute: 10 -> 2 (45min episode = 90 COOP vs 450)
- movieRequestCost: 100 -> 500 (~5.5 episodes per movie)
- tvRequestCost: 200 -> 1000 (~11 episodes per season)
- tvPerSeasonCost: 50 -> 250
Race condition fix:
- Credits now deducted immediately at request time
- No more multiple requests before approval
- On DECLINED: automatic refund with ADJUSTMENT transaction
- On APPROVED: no extra deduction (already paid)
Updated schema defaults and all code fallbacks.
Balance checks were reading on-chain Solana token balance (0
during db-only mode). Now wallet and overseer routes return
user.totalEarned - user.totalSpent as the usable credit balance.
This makes credits spendable even when devnet faucet is dry.
- /wallet returns dbBalance, with onChainBalance as extra info
- /overseer/balance returns dbBalance for request eligibility
- /overseer/request checks dbBalance before approving spend
- /wallet/admin returns dbBalance
Catch and swallow airdrop errors quietly. Logs were flooded with
429 retry messages. Now fails fast and lets DB-only credits take
over when devnet faucet is dry.
Devnet airdrop faucet rate-limited. mintTokens() now returns a
db-only signature instead of failing when Solana is unreachable,
unfunded, or mint creation fails. This lets watch events and
backfill still credit users in the database. Blockchain minting
will resume automatically once SOL is available.
Mint authority had zero SOL balance on devnet, causing
'Attempt to debit an account but found no record of a prior
credit' error. Now getTokenMint() checks balance, airdrops 2 SOL
if needed, then creates the SPL token mint. Also added caching
so mint is only created once.
getTokenMint() was a stub returning null. Now checks SOLANA_MINT_ADDRESS
env var first, then auto-creates a new SPL token mint on devnet using
the existing mint authority keypair. This enables actual token minting
for backfill and live watch events.
Backend couldn't reach Tautulli (172.20.1.255) or Overseer
(172.20.1.225) from Docker bridge network. Switched to host
network mode so backend can access local network services.
Updated DATABASE_URL and REDIS_URL to use localhost.
Tautulli get_history requires internal user_id, not Plex ID.
Now queries get_users first, matches by username/email/friendly_name,
then uses matched user's ID for history fetch.
ENCRYPTION_KEY was 64 hex chars = 64 bytes. AES-256 needs exactly
32 bytes. Now hashing with SHA-256 to derive proper 32-byte key
regardless of input length. Fixed in auth.ts backfill encrypt
and wallet.ts encrypt/decrypt.
New users automatically get credited for their last 30 days of
Plex watch history via Tautulli. Creates wallet if needed,
fetches history, calculates credits with same rules as live
webhooks, mints tokens, and creates watchEvent + transaction
records. Only runs on first-time signup.
1. Auth callback now deletes old sessions before creating new one,
and adds Date.now() nonce to JWT to prevent unique constraint
violations on duplicate login attempts.
2. Solana mint authority now accepts both JSON array and base58
formats for SOLANA_MINT_AUTHORITY_KEYPAIR env var.
- New color palette: barn red primary, cream backgrounds, hay gold
- Added Abril Fatface display font for headlines
- Wood grain texture backgrounds via CSS gradients
- Barnyard personality in copy: 'Join the Flock', 'Enter the Coop'
- Replaced hardcoded slate colors with theme variables
- Updated landing, login, dashboard, onboarding, leaderboard
Caddy routes /api/* to port 3002 but docker-compose exposed
backend on 3001. Changed backend port, healthcheck, and
frontend fallback to 3002 for consistency.
Plex auth uses PIN-based flow, not standard OAuth2 authorization_code.
- backend/auth: POST /api/v2/pins to create PIN, GET /api/v2/pins/{id} to get authToken
- frontend/login: store pinId in sessionStorage before redirect
- frontend/callback: send pinId to backend instead of query code
- backend/index: fix dotenv path resolution for tsx (__dirname returns '.')
- Change port 3000 from 127.0.0.1 to 0.0.0.0 (frontend)
- Change port 3001 from 127.0.0.1 to 0.0.0.0 (backend)
- Allows access from 172.20.1.0/24 network
- Nginx now listens on HTTP only (port 80)
- Remove SSL cert volume mounts from docker-compose
- Remove SSL troubleshooting sections
- Update docs to indicate SSL handled by Caddy/reverse proxy
- Simplify nginx.conf to remove HTTPS server block
- Add Docker build troubleshooting section
- Update Quick Start with SSL cert and public dir steps
- Add prisma db push instruction for database setup
- Document common build errors and solutions
- Fix duplicate 'signature' variable in webhooks.ts
- Add Prisma binary target for Alpine Linux
- Fix tsconfig path alias (@/* -> ./src/*)
- Add missing next-themes dependency
- Add build args for NEXT_PUBLIC_* env vars
- Fix SSR issues with zustand and providers
- Add providers-wrapper with dynamic ssr:false import
- Add SSL certs and public dir for nginx
- Update Dockerfiles for proper Prisma engine handling
- Install python3, make, g++ in builder for native module compilation
- Copy node_modules from builder stage to avoid rebuild in production
- Fixes usb package compilation error in node:20-alpine
- Change build context from ./frontend|backend to root (.)
- Update Dockerfiles to copy from correct paths
- Use npm install instead of npm ci (workspaces share root lockfile)
- Remove obsolete version attribute from docker-compose.yml
Fixes npm ci errors when package-lock.json is at workspace root.
Fix security vulnerability in Next.js 14.0.4.
See: https://nextjs.org/blog/security-update-2025-12-11
Other npm deprecation warnings are from transitive dependencies
(@solana/wallet-adapter packages) and don't affect functionality.
Add environment variable templates for:
- Root .env.example (all services)
- backend/.env.example (API configuration)
- frontend/.env.local.example (client config)
Copy to .env and fill in your secrets before running.
Add complete token system with Plex/Tautulli/Overseer integration:
- Anchor program for SPL token mint/burn/transfer
- Express backend with OAuth, webhooks, Solana integration
- Next.js frontend with dashboard, admin panel, wallet management
- Docker deployment for 172.20.1.0/24 infrastructure
- Production configs with SSL, Nginx, health monitoring
Tautulli webhooks auto-mint on watch events.
Overseer integration burns for content requests.