9516f5d570
- 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
93 lines
4.3 KiB
Markdown
93 lines
4.3 KiB
Markdown
# CoopCredits ($COOP) Media Rewards Ecosystem
|
|
|
|
A complete Solana-based rewards system integrated with Plex, Tautulli, and Overseer.
|
|
|
|
## 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
|
|
|
|
```bash
|
|
# 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 (see docs/SETUP-INFRASTRUCTURE.md)
|
|
|
|
# 3. Create required directories
|
|
mkdir -p docker/nginx/ssl
|
|
mkdir -p frontend/public
|
|
|
|
# 4. Generate SSL certificates (self-signed for local dev)
|
|
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
|
-keyout docker/nginx/ssl/key.pem \
|
|
-out docker/nginx/ssl/cert.pem \
|
|
-subj "/CN=localhost"
|
|
|
|
# 5. Start with Docker Compose
|
|
docker-compose up -d --build
|
|
|
|
# 6. Initialize database (first time only)
|
|
docker-compose exec backend npx prisma db push
|
|
|
|
# 7. Deploy Solana program (optional, for token features)
|
|
cd anchor-program
|
|
anchor deploy
|
|
```
|
|
|
|
## 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
|
|
├── docker/ # Docker configurations
|
|
├── deployment/ # Deployment scripts
|
|
└── docker-compose.yml # Full stack orchestration
|
|
```
|
|
|
|
## User Flow
|
|
|
|
1. **Login** → User visits coop.hobokenchicken.com, authenticates with Plex
|
|
2. **Wallet** → Auto-created Solana wallet or connect existing
|
|
3. **Watch** → Viewing on Plex → Tautulli triggers → $COOP minted
|
|
4. **Earn** → Real-time balance updates on dashboard
|
|
5. **Spend** → Request content on Overseer → $COOP deducted
|
|
6. **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.
|