A comprehensive platform enabling YouTube creators to raise funds through revenue-sharing agreements and fractional channel stakes. Investors can browse, invest, and trade shares while receiving transparent, automated revenue distributions.
β Creator Onboarding
- Google OAuth integration with YouTube API access
- Automatic channel verification and ownership validation
- Real-time analytics fetching (subscribers, views, engagement)
- Revenue estimation based on channel metrics
β Marketplace
- Browse active revenue-share offerings
- Filter by category, minimum investment, and performance
- Detailed offering pages with channel analytics
- Real-time funding progress tracking
β Investment Flow
- KYC verification with compliance checks
- Investment eligibility validation
- Stripe payment integration with escrow
- Automated share allocation
β Revenue Distribution
- Monthly revenue reconciliation system
- Automated payout calculations (5% platform fee)
- Investor payout tracking and history
- Multi-offering support per channel
β Dashboards
- Creator Dashboard: Manage channels, offerings, and investor relations
- Investor Dashboard: Portfolio tracking, ROI calculations, payout history
- Frontend: Next.js 14, React, TypeScript, Tailwind CSS
- Backend: Next.js API Routes, Prisma ORM
- Database: PostgreSQL
- Authentication: NextAuth.js with Google OAuth
- Payments: Stripe (supports cards, bank transfers)
- YouTube Integration: Google YouTube Data API v3
- UI Components: Radix UI, Lucide Icons
- Users: Multi-role (Creator/Investor/Admin) with KYC status
- Channels: Verified YouTube channels with analytics
- Offerings: Revenue-share opportunities with terms
- Investments: Share purchases and ownership tracking
- Payouts: Monthly revenue distributions
- Transactions: Complete payment history
- Node.js 18+ and npm/yarn
- PostgreSQL database
- Google Cloud Console account (for YouTube API)
- Stripe account (for payments)
cd /home/gulshan/youtube-feature
npm installCopy .env.example to .env and configure:
cp .env.example .envRequired configurations:
-
Database
DATABASE_URL="postgresql://user:password@localhost:5432/youtube_platform" -
Google OAuth + YouTube API
- Go to Google Cloud Console
- Create a new project
- Enable YouTube Data API v3
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:8000/api/auth/callback/google - Add scopes:
email,profile,https://www.googleapis.com/auth/youtube.readonly
GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com" GOOGLE_CLIENT_SECRET="your-client-secret" -
NextAuth
# Generate secret openssl rand -base64 32NEXTAUTH_URL="http://localhost:8000" NEXTAUTH_SECRET="generated-secret-here" -
Stripe
- Create account at stripe.com
- Get API keys from dashboard
STRIPE_SECRET_KEY="sk_test_..." STRIPE_PUBLISHABLE_KEY="pk_test_..." STRIPE_WEBHOOK_SECRET="whsec_..." # After setting up webhook
# Generate Prisma client
npm run db:generate
# Push schema to database
npm run db:push
# (Optional) Open Prisma Studio to view data
npm run db:studionpm run devVisit http://localhost:8000
GET/POST /api/auth/[...nextauth]- NextAuth.js routes
POST /api/creator/channel- Verify and connect YouTube channelGET /api/creator/channel- Get creator's channelsPOST /api/creator/offering- Create revenue-share offeringGET /api/creator/offering- Get creator's offerings
GET /api/marketplace- List all active offerings (with filters)GET /api/marketplace/[id]- Get offering details
POST /api/investment- Create investment (with KYC check)GET /api/investment- Get investor's portfolio
POST /api/kyc- Submit KYC dataGET /api/kyc- Check KYC status
POST /api/payout/reconcile- Process monthly revenue distribution
- Sign Up β Google OAuth authentication
- Connect Channel β Verify YouTube ownership via API
- View Analytics β System fetches 12-month performance data
- Create Offering β Set revenue %, shares, price, duration
- Await Approval β Admin reviews (status: PENDING_APPROVAL)
- Go Live β Offering becomes ACTIVE in marketplace
- Monthly Reporting β Submit revenue via reconciliation API
- Auto Payouts β System distributes to investors
- Sign Up β Create account
- Complete KYC β Submit identity verification
- Browse Marketplace β Filter and discover offerings
- View Details β Channel analytics, terms, investor count
- Invest β Select shares, process payment via Stripe
- Receive Shares β Confirmed after payment success
- Track Performance β Dashboard shows ROI and payouts
- Monthly Payouts β Automatic revenue distributions
- β OAuth 2.0 for secure YouTube channel verification
- β KYC/AML checks before investment eligibility
- β Investment limits: $2,500 per transaction, $10,000 total
- β Escrow system: Funds held until offering completion
- β Encrypted data storage for sensitive KYC information
- β Role-based access control (Creator/Investor/Admin)
β οΈ Integrate professional KYC provider (Onfido, Stripe Identity, IDfy)β οΈ Consult legal counsel for securities complianceβ οΈ Implement rate limiting and DDoS protectionβ οΈ Add fraud detection for revenue reportingβ οΈ Enable 2FA for high-value accountsβ οΈ Audit smart contracts if tokenizing shares
Platform Fee: 5% of gross channel revenue before investor payouts
Example Calculation:
Channel monthly revenue: $10,000
Offering: 20% revenue share, 1000 shares
Platform fee (5%): $500
Investor pool: $9,500
Per offering: $9,500 Γ 20% = $1,900
Per share: $1,900 / 1000 = $1.90
sequenceDiagram
Creator->>API: Submit monthly revenue
API->>Database: Fetch active offerings
API->>Database: Calculate investor shares
API->>Stripe: Process payouts
Stripe->>Investors: Distribute payments
API->>Database: Record payout history
API->>Creator: Deduct platform fee
User (1) ββ (N) Channel
Channel (1) ββ (N) Offering
Offering (1) ββ (N) Investment
Investment (1) ββ (N) Payout
User (1) ββ (N) Transaction
- Creator can connect YouTube channel
- Analytics fetched correctly
- Offering creation with validation
- Investor can browse marketplace
- KYC submission and status check
- Investment flow with Stripe test mode
- Revenue reconciliation calculation
- Payout distribution
- Dashboard data accuracy
- Peer-to-peer share trading
- Order book implementation
- Price discovery mechanism
- Transfer fee structure
- Security token issuance (ERC-1400)
- Smart contract automation
- Multi-currency support
- Mobile app (React Native)
- Creator analytics dashboard
- Investor communication tools
- Institutional investor onboarding
- Accredited investor verification
- SEC/regulatory approval (if US-based)
- Tax reporting (1099 generation)
- International expansion
- Securities Law: Determine if offerings qualify as securities
- Registration: Register with appropriate regulatory bodies (SEC, FCA, etc.)
- Exemptions: Explore Reg CF, Reg A+, or Reg D exemptions
- Terms of Service: Draft comprehensive user agreements
- Risk Disclosures: Clear investment risk warnings
- Privacy Policy: GDPR, CCPA compliance
- Anti-Money Laundering: Implement robust AML procedures
This is a proprietary project. For questions or issues:
- Email: admin@yourplatform.com
- Documentation:
/docs/legal-framework.md
Proprietary - All Rights Reserved
Database Connection Error
# Check PostgreSQL is running
sudo service postgresql status
# Verify DATABASE_URL in .envYouTube API Error
# Ensure YouTube Data API v3 is enabled in Google Cloud Console
# Verify OAuth scopes include youtube.readonlyStripe Webhook Issues
# Use Stripe CLI for local testing
stripe listen --forward-to localhost:8000/api/webhooks/stripeBuilt with β€οΈ for the creator economy