185018a42e39cc274028ef8ba4f6a6e5b458faf1
React re-renders caused useEffect to fire twice. First request succeeded, second consumed already-used PIN → 500. Added useRef guard to dedupe.
CoopCoins: Our Family Media Rewards
Welcome to our private media rewards system for the Hoboken Chicken family and friends! It's powered by Solana and integrates with our Plex, Tautulli, and Overseer setup. Earn CoopCoins ($COOP) for enjoying media, and use them to request new content!
System Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ coop.hobokenchicken.com │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ Next.js │ │ Express │ │ PostgreSQL │ │ Solana Devnet │ │
│ │ Frontend │◄─┤ API │◄─┤ Database │◄─┤ $COOP SPL │ │
│ │ │ │ │ │ │ │ Token │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ └─────────────────┘ │
│ ▲ ▲ │
│ │ │ │
│ Plex OAuth Tautulli Webhooks │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Plex Server │ │ Tautulli │ │ Overseer │ │
│ │ (Content) │ │ (Analytics) │ │ (Requests) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Quick Start
# 1. Clone and install dependencies
git clone <repository> coop-credits
cd coop-credits
npm install
# 2. Set up environment
cp .env.example .env
# Edit .env with your values
# 3. Create public directory
mkdir -p frontend/public
# 4. Start services
docker-compose up -d --build
# 5. Initialize database (first time only)
docker-compose exec backend npx prisma db push
# 6. Configure Caddy (see docs/CADDY-CONFIG.md)
# Services expose ports 3000 (frontend) and 3001 (backend) on localhost
See docs/CADDY-CONFIG.md for reverse proxy setup.
Project Structure
coop-credits/
├── anchor-program/ # Solana Anchor program for $COOP token
├── backend/ # Express API server
├── frontend/ # Next.js dashboard
├── shared/ # Shared types and utilities
├── docs/ # Documentation
│ └── CADDY-CONFIG.md # Reverse proxy setup
├── docker-compose.yml # Docker orchestration (no nginx)
└── .env.example # Environment template
Note: No internal reverse proxy. Use Caddy/Nginx/Traefik externally.
User Flow
- Login → User visits coop.hobokenchicken.com, authenticates with Plex
- Wallet → Auto-created Solana wallet or connect existing
- Watch → Viewing on Plex → Tautulli triggers → $COOP minted
- Earn → Real-time balance updates on dashboard
- Spend → Request content on Overseer → $COOP deducted
- History → Full transaction history visible on dashboard
Admin Features
- System overview and analytics
- User management and balance adjustments
- Minting rate controls
- Spending controls and promotions
- Emergency pause and recovery
Environment Variables
See backend/.env.example and frontend/.env.local.example for full configuration.
Description
Watch-to-earn credits for your Plex server. Earn by watching, spend on content requests. Self-hosted economics for media nerds.
Languages
TypeScript
75.2%
Shell
19.8%
Rust
2.6%
CSS
1.3%
Dockerfile
0.9%
Other
0.2%