A modern, full-stack platform for content creators to manage live streams and receive donations from their audience. Built with Next.js, Express.js, PostgreSQL, and Redis.
π Live Demo: https://tube-pay.w16manik.ninja
- Live Stream Management - Create, update, and manage live streams
- Real-time Donations - Receive instant donations with messages
- Payment Analytics - Track donation history and earnings
- QR Code Generation - Easy donation links for viewers
- Profile Management - Customize your creator profile
- Browse Live Streams - Discover active content creators
- Secure Donations - Support creators with Razorpay integration
- Payment History - Track your donation history
- Real-time Updates - See live donation counters
- Google OAuth Authentication - Secure user authentication
- Redis Caching - High-performance data caching
- Rate Limiting - Prevent payment abuse
- Real-time Updates - Live donation counters and notifications
- Responsive Design - Works on desktop and mobile
- TypeScript - Full type safety across the stack
- Next.js 15 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- Tailwind CSS - Utility-first CSS framework
- Lucide React - Icon library
- QRCode - QR code generation
- Express.js - Node.js web framework
- TypeScript - Type safety
- Prisma - Database ORM
- PostgreSQL - Primary database
- Redis - Caching and session storage
- Passport.js - Authentication middleware
- Razorpay - Payment gateway
- Docker - Containerization
- CORS - Cross-origin resource sharing
- Session Management - Secure user sessions
- Rate Limiting - API protection
- Node.js 18+
- Docker Desktop
- npm
git clone https://github.com/ManikLakhanpal/Tube-Pay.git
cd Tube-Paycd backend
# Install dependencies
npm install
# Set up environment variables
cp .env.example .envConfigure your .env file:
# Server Configuration
PORT=5000
NODE_ENV=development
# Database (Docker PostgreSQL)
DATABASE_URL="postgresql://postgres:password@localhost:5432/youtube_donations"
# Session
SESSION_SECRET="your-super-secret-session-key"
# Google OAuth
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# URLs
FRONTEND_URL="http://localhost:3000"
BACKEND_URL="http://localhost:5000"
# Redis (Docker Redis Stack)
REDIS_URL="redis://localhost:6379"
# Razorpay (for payments)
RAZORPAY_KEY_ID="your-razorpay-key-id"
RAZORPAY_KEY_SECRET="your-razorpay-key-secret"
# RESEND API KEY (for sending emails)
RESEND_KEY="your-resend-api-key"
RESEND_EMAIL="your-resend-email"# Run database migrations
npx prisma migrate dev
# Start development server
npm run devcd frontend
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.localConfigure your .env.local file:
NEXT_PUBLIC_API_URL="http://localhost:5000/"# Start development server
npm run dev# Run PostgreSQL container
docker run --name postgres-server \
-p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=youtube_donations \
-d postgres
# Verify PostgreSQL is running
docker ps# Run Redis Stack container (includes RedisInsight for monitoring)
docker run -d \
--name redis-stack \
-p 6379:6379 \
-p 8001:8001 \
redis/redis-stack:latest
# Verify Redis is running
docker ps
# Test Redis connection
docker exec redis-stack redis-cli ping- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Create OAuth 2.0 Client ID
- Set authorized redirect URIs:
http://localhost:5000/api/auth/google/callback(development)https://yourdomain.com/api/auth/google/callback(production)
- Sign up at Razorpay
- Get your API keys from the dashboard
- Add keys to backend
.envfile
# Terminal 1 - Backend
cd backend
npm run dev
# Terminal 2 - Frontend
cd frontend
npm run dev
# Docker containers should already be running from setup
# To check container status:
docker ps
# To stop containers:
docker stop postgres-server redis-stack
# To start containers:
docker start postgres-server redis-stack# Build frontend
cd frontend
npm run build
npm start
# Build backend
cd backend
npm run build
npm start# Check running containers
docker ps
# View container logs
docker logs postgres-server
docker logs redis-stack
# Access PostgreSQL shell
docker exec -it postgres-server psql -U postgres -d youtube_donations
# Access Redis CLI
docker exec -it redis-stack redis-cli
# Stop containers
docker stop postgres-server redis-stack
# Remove containers (data will be lost)
docker rm postgres-server redis-stack
# RedisInsight (Redis monitoring UI)
# Access at: http://localhost:8001# Go to root of project where docker-compose.yml file is present
# NOTE: Make sure you create .env file with help of .env.example and fill the fields
docker compose up- Sign In - Use Google OAuth to create an account
- Create Stream - Set up a new live stream with title and description
- Share QR Code - Share the generated QR code with your audience
- Receive Donations - Get real-time notifications and track earnings
- Manage Profile - Update your profile and stream settings
- Browse Streams - View all active live streams
- Select Creator - Choose a creator to support
- Make Donation - Enter amount and optional message
- Complete Payment - Use Razorpay to complete the transaction
- Track History - View your donation history
GET /api/auth/google- Google OAuth loginGET /api/auth/google/callback- OAuth callbackGET /api/auth/logout- Logout
GET /api/streams- Get all streamsGET /api/streams/live- Get live streamsPOST /api/streams- Create streamGET /api/streams/:id- Get stream by IDPATCH /api/streams/:id- Update streamDELETE /api/streams/:id- Delete stream
POST /api/payment/order- Create payment orderPOST /api/payment/verify- Verify paymentGET /api/payment/sent- Get sent paymentsGET /api/payment/received- Get received payments
GET /api/payment/cache/stats- Cache statisticsGET /api/payment/cache/health- Redis health checkPOST /api/payment/cache/clear- Clear payment caches
- Google OAuth - Secure authentication
- Session Management - Redis-based sessions
- Rate Limiting - API abuse prevention
- CORS Protection - Cross-origin security
- Input Validation - Data sanitization
- HTTPS Ready - Production security
- Redis Caching - Fast data retrieval
- Database Indexing - Optimized queries
- Pagination - Efficient data loading
- Real-time Updates - Live donation counters
- CDN Ready - Static asset optimization
cd backend
npm run type-checkcd frontend
npm run lint
npm run build# If containers won't start, check if ports are in use
lsof -i :5432 # Check PostgreSQL port
lsof -i :6379 # Check Redis port
# Remove existing containers if needed
docker rm -f postgres-server redis-stack
# Check Docker logs
docker logs postgres-server
docker logs redis-stack- Ensure PostgreSQL container is running:
docker ps - Check database URL in
.envfile - Verify database exists:
docker exec -it postgres-server psql -U postgres -l
- Ensure Redis container is running:
docker ps - Test Redis connection:
docker exec redis-stack redis-cli ping - Access RedisInsight at http://localhost:8001 for monitoring
Set up production environment variables:
NODE_ENV=production
DATABASE_URL="your-production-db-url"
REDIS_URL="your-production-redis-url"
SESSION_SECRET="your-production-session-secret"
FRONTEND_URL="https://yourdomain.com"cd backend
npx prisma migrate deploy# Frontend
cd frontend
npm run build
npm start
# Backend
cd backend
npm run build
npm start- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation - Check the README files in each directory
- Issues - Report bugs via GitHub Issues or just email me
- Discussions - Ask questions in GitHub Discussions or just email me
- Next.js - React framework
- Express.js - Node.js web framework
- Prisma - Database toolkit
- Razorpay - Payment gateway
- Redis - In memory data store
- Tailwind CSS - CSS framework
Made by Manik Lakhanpal π₯
