A modern live streaming platform built with Next.js, featuring real-time chat, notifications, and monetization tools.
π Live Demo: streamix-ten.vercel.app
- Live Streaming: Go live instantly with powerful streaming tools powered by LiveKit
- Real-time Chat: Interactive chat with moderation tools and subscriber-only mode
- Notifications: Real-time WebSocket notifications for follows, tips, and subscriptions
- Monetization: Built-in tipping and subscription system with Stripe integration
- VOD Support: Video-on-demand with AWS S3 storage and CloudFront CDN
- User Management: Complete user profiles and channel management with Clerk authentication
- Search & Discovery: Find streams and content easily with advanced search
- View Tracking: Real-time view count tracking with Redis and batch processing
- Responsive Design: Mobile-first design with dark/light theme support
This is a monorepo containing multiple microservices:
apps/web- Next.js 15 frontend application with TypeScriptapps/notify-worker- Background notification processing serviceapps/notify-wss- WebSocket server for real-time notificationsapps/viewer-worker- Batch processing service for view count updates
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS 3
- Backend: Node.js, Prisma ORM, PostgreSQL
- Real-time: WebSockets (Socket.IO), Redis Pub/Sub
- Storage: AWS S3, CloudFront CDN, PostgreSQL
- Payments: Stripe (subscriptions, tips, webhooks)
- Streaming: LiveKit (WebRTC, SFU)
- Authentication: Clerk (OAuth, webhooks)
- Deployment: Docker, Docker Compose, Vercel, AW
- Monitoring: Winston logging, health checks
- Docker and Docker Compose
- Node.js 20+ (for local development)
- PostgreSQL (if running locally)
- Redis (if running locally)
-
Clone the repository
git clone <repository-url> cd streamix
-
Set up environment variables
# Copy environment files for each service cp apps/web/.env.example apps/web/.env cp apps/notify-worker/.env.example apps/notify-worker/.env cp apps/notify-wss/.env.example apps/notify-wss/.env cp apps/viewer-worker/.env.example apps/viewer-worker/.env # Edit each .env file with your configuration
-
Start all services
docker-compose up -d
-
Access the application
- Web App: http://localhost:3000
- WebSocket Server: http://localhost:8000
- Viewer Worker Health: http://localhost:3003/health
- Database: localhost:5432
- Redis: localhost:6379
-
Install dependencies
# Install root dependencies npm install # Install app dependencies cd apps/web && npm install cd ../notify-worker && npm install cd ../notify-wss && npm install cd ../viewer-worker && npm install
-
Set up the database
cd apps/web npx prisma migrate dev npx prisma generate -
Start services
# Terminal 1 - Web app cd apps/web && npm run dev # Terminal 2 - Notification worker cd apps/notify-worker && npm run dev # Terminal 3 - WebSocket server cd apps/notify-wss && npm run dev # Terminal 4 - Viewer worker cd apps/viewer-worker && npm run dev
streamix/
βββ apps/
β βββ web/ # Next.js 15 frontend application
β β βββ src/
β β β βββ app/ # App Router pages and API routes
β β β βββ components/ # Reusable UI components
β β β βββ hooks/ # Custom React hooks
β β β βββ lib/ # Utilities and services
β β β βββ types/ # TypeScript type definitions
β β βββ prisma/ # Database schema and migrations
β β βββ .env.example # Environment variables template
β βββ notify-worker/ # Background notification processing
β β βββ src/
β β β βββ services/ # Notification processing logic
β β β βββ lib/ # Database and Redis connections
β β βββ .env.example # Environment variables template
β βββ notify-wss/ # WebSocket notification server
β β βββ src/
β β β βββ services/ # WebSocket and Redis services
β β β βββ middleware/ # Authentication middleware
β β βββ .env.example # Environment variables template
β βββ viewer-worker/ # View count batch processing
β βββ src/
β β βββ services/ # View count processing logic
β β βββ lib/ # Database and Redis connections
β βββ .env.example # Environment variables template
βββ docker-compose.yml # Docker orchestration
βββ README.md # This file
Each service has its own .env.example file with the required environment variables. Copy and configure them for your setup:
# Copy environment files
cp apps/web/.env.example apps/web/.env
cp apps/notify-worker/.env.example apps/notify-worker/.env
cp apps/notify-wss/.env.example apps/notify-wss/.env
cp apps/viewer-worker/.env.example apps/viewer-worker/.env
# Edit each .env file with your configurationKey Environment Variables:
- Database:
DATABASE_URL(PostgreSQL connection string) - Redis:
REDIS_URL(Redis connection string) - Authentication: Clerk keys for user management
- Payments: Stripe keys for subscriptions and tips
- Storage: AWS S3 credentials for file uploads
- Streaming: LiveKit credentials for live streaming
- WebSocket: Server configuration for real-time features
For Production Deployment:
- Web App: Deployed on Vercel at streamix-ten.vercel.app
- Workers: Deployed on AWS ECS Fargate (notify-worker, notify-wss, viewer-worker)
- Database: PostgreSQL on Neon
- Cache: Redis Cloud
- Storage: AWS S3 with CloudFront CDN
- CloudFront configuration is only needed for production CDN setup
The application uses PostgreSQL with Prisma ORM. Run migrations:
cd apps/web
npx prisma migrate devThe application runs as a multi-service Docker stack:
- web: Next.js application (port 3000)
- notify-worker: Background notification processor
- notify-wss: WebSocket server (port 8000)
- viewer-worker: View count batch processor (port 3003)
- postgres: PostgreSQL database (port 5432)
- redis: Redis cache (port 6379)
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f web
docker-compose logs -f notify-worker
docker-compose logs -f notify-wss
docker-compose logs -f viewer-worker
# Stop all services
docker-compose down
# Rebuild and restart
docker-compose up --build -d
# Access service shell
docker-compose exec web sh
docker-compose exec notify-worker sh
docker-compose exec notify-wss sh
docker-compose exec viewer-worker sh
docker-compose exec postgres psql -U postgres -d streamix# Run migrations
docker-compose exec web npx prisma migrate deploy
# Reset database
docker-compose exec web npx prisma migrate reset
# Open Prisma Studio
docker-compose exec web npx prisma studioAll services include health checks:
- PostgreSQL:
pg_isreadycommand - Redis:
redis-cli pingcommand - Web: HTTP GET to
/api/health - Notify Worker: Simple node process check
- Notify WSS: HTTP GET to
/ping - Viewer Worker: HTTP GET to
http://localhost:3003/health
Service won't start:
- Check logs:
docker-compose logs <service-name> - Ensure all environment variables are set
- Verify ports aren't already in use
Database connection issues:
- Wait for PostgreSQL to be healthy
- Check DATABASE_URL format
- Verify network connectivity between services
WebSocket connection issues:
- Check NEXT_PUBLIC_WS_URL is correct
- Verify notify-wss service is running
- Check firewall settings
Build failures:
- Clear Docker cache:
docker system prune -a - Rebuild without cache:
docker-compose build --no-cache - Check Dockerfile syntax
- Web App Documentation
- Notification Worker Documentation
- WebSocket Server Documentation
- Viewer Worker Documentation
# Run all tests
npm test
# Run specific service tests
cd apps/web && npm test
cd apps/notify-worker && npm test
cd apps/notify-wss && npm test
cd apps/viewer-worker && npm testCurrent Production Setup:
- Web App: streamix-ten.vercel.app (Vercel)
- Workers: AWS ECS Fargate (notify-worker, notify-wss, viewer-worker)
- Database: Neon PostgreSQL
- Cache: Redis Cloud
- Storage: AWS S3 + CloudFront CDN
- Streaming: LiveKit Cloud
For Local Docker Deployment:
-
Set up production environment variables
-
Build and deploy with Docker
docker-compose up -d
-
Set up reverse proxy (nginx/traefik)
-
Configure SSL certificates
-
Set up monitoring and logging
- Development: Uses local services and hot reloading
- Staging: Mirrors production with test data
- Production: Optimized builds with production databases
- Environment Variables: Use proper secrets management
- Monitoring: Add logging and monitoring services
- Scaling: Consider horizontal scaling for stateless services
- Backups: Implement database backup strategy
- Security: Use non-root users and security scanning
Streamix - Where creators go live and audiences connect in real-time.