mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-17 22:27:19 +00:00
- ModuleManager: Central tracking for installed marketplace modules - DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module) - BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings - RootShell: Real root command execution utility - TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands - Terminal Pro module: Adds aliases (ll, la, h), command history - ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games - fade_in/fade_out animations for smooth transitions
7.5 KiB
7.5 KiB
PHASE 6: PREMIUM MONETIZATION - QUICK START ⚡
Get AeThex's premium monetization running in under 10 minutes.
Prerequisites
- ✅ Phase 1-5 completed and running
- ✅ Stripe account (free at stripe.com)
- ✅ Node.js 18+ installed
- ✅ PostgreSQL database running
1. Database Setup (2 minutes)
Run the migration:
cd /workspaces/AeThex-Connect
# Option A: Using the migrate script
npm run migrate
# Option B: Using psql directly
psql $DATABASE_URL -f src/backend/database/migrations/006_premium_monetization.sql
Verify migration:
psql $DATABASE_URL -c "SELECT * FROM feature_limits;"
You should see 3 rows (free, premium, enterprise) with default limits.
2. Stripe Setup (3 minutes)
Create Stripe Account
- Go to https://dashboard.stripe.com/register
- Skip setup - go straight to test mode
- Click "Developers" → "API keys"
Copy Your Keys
# Add to .env file:
STRIPE_SECRET_KEY=sk_test_51...
STRIPE_PUBLISHABLE_KEY=pk_test_51...
Create Products & Prices
Quick Method - Use Stripe CLI:
# Install Stripe CLI
brew install stripe/stripe-cli/stripe # macOS
# or download from: https://stripe.com/docs/stripe-cli
# Login
stripe login
# Create Premium Yearly
stripe prices create \
--unit-amount=10000 \
--currency=usd \
--recurring="interval=year" \
--product-data="name=AeThex Premium Yearly"
# Copy the price ID (price_...) to STRIPE_PREMIUM_YEARLY_PRICE_ID
# Create Premium Monthly
stripe prices create \
--unit-amount=1000 \
--currency=usd \
--recurring="interval=month" \
--product-data="name=AeThex Premium Monthly"
# Copy price ID to STRIPE_PREMIUM_MONTHLY_PRICE_ID
# Create Enterprise
stripe prices create \
--unit-amount=50000 \
--currency=usd \
--recurring="interval=month" \
--product-data="name=AeThex Enterprise"
# Copy price ID to STRIPE_ENTERPRISE_PRICE_ID
Manual Method - Dashboard:
- Go to Products → Add Product
- Name: "AeThex Premium Yearly"
- Price: $100.00
- Billing: Recurring, Yearly
- Click "Save"
- Copy the Price ID (starts with
price_) - Repeat for Monthly ($10) and Enterprise ($500)
Setup Webhook (for local testing)
# Forward webhooks to local server
stripe listen --forward-to localhost:5000/webhooks/stripe
# Copy the webhook signing secret (whsec_...) to .env
STRIPE_WEBHOOK_SECRET=whsec_...
3. Environment Variables (1 minute)
Update your .env file:
# Stripe (required)
STRIPE_SECRET_KEY=sk_test_51...
STRIPE_PUBLISHABLE_KEY=pk_test_51...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_PREMIUM_YEARLY_PRICE_ID=price_...
STRIPE_PREMIUM_MONTHLY_PRICE_ID=price_...
STRIPE_ENTERPRISE_PRICE_ID=price_...
# Platform (optional - has defaults)
PLATFORM_FEE_PERCENTAGE=10
FREE_MAX_FRIENDS=5
FREE_STORAGE_GB=0.1
PREMIUM_STORAGE_GB=10
ENTERPRISE_STORAGE_GB=-1
Frontend .env (in src/frontend/):
REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_test_51...
4. Start the Server (1 minute)
# Backend
npm start
# Frontend (new terminal)
cd src/frontend
npm run dev
You should see:
✓ Premium routes loaded at /api/premium
✓ Stripe webhook listening at /webhooks/stripe
✓ Server running on port 5000
5. Test Premium Flow (3 minutes)
Test Domain Availability
curl -X POST http://localhost:5000/api/premium/domains/check-availability \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"domain": "testuser.aethex"}'
Expected response:
{
"success": true,
"available": true,
"domain": "testuser.aethex",
"price": 100.00
}
Test Subscription via Frontend
- Open http://localhost:5173/premium/upgrade
- Click "Choose Premium"
- Enter domain name:
yourname.aethex - Click "Check Availability"
- Enter test card:
4242 4242 4242 4242 - Expiry: Any future date (e.g., 12/25)
- CVC: Any 3 digits (e.g., 123)
- Click "Subscribe"
- Should redirect to success page
Verify in Database
-- Check subscription
SELECT * FROM premium_subscriptions WHERE user_id = 'your-user-id';
-- Check domain
SELECT * FROM blockchain_domains WHERE owner_user_id = 'your-user-id';
-- Check user tier upgraded
SELECT id, email, premium_tier FROM users WHERE id = 'your-user-id';
6. Test Webhook (2 minutes)
With Stripe CLI running (stripe listen --forward-to...):
# Trigger test webhook
stripe trigger customer.subscription.updated
# Check your server logs - should see:
# ✅ Webhook received: customer.subscription.updated
# ✅ Subscription updated successfully
Verify webhook events:
SELECT * FROM payment_transactions ORDER BY created_at DESC LIMIT 5;
Quick Troubleshooting
"Migration failed"
# Check database connection
psql $DATABASE_URL -c "SELECT version();"
# Check if migration already ran
psql $DATABASE_URL -c "\dt premium_*"
# Force re-run
psql $DATABASE_URL -c "DROP TABLE IF EXISTS premium_subscriptions CASCADE;"
npm run migrate
"Stripe key invalid"
- Make sure you copied the FULL key (starts with
sk_test_orpk_test_) - Check for extra spaces
- Verify in Stripe dashboard it's from test mode
"Webhook signature verification failed"
# Get new webhook secret
stripe listen --forward-to localhost:5000/webhooks/stripe
# Copy the new whsec_... to .env
# Restart server
"Domain registration hangs"
- Check Stripe keys are set
- Verify price IDs are correct
- Check server logs for errors
- Try test card: 4242 4242 4242 4242
Test Cards
Successful Payment
Card: 4242 4242 4242 4242
Expiry: Any future date
CVC: Any 3 digits
Declined Payment
Card: 4000 0000 0000 0002
Requires Authentication (3D Secure)
Card: 4000 0025 0000 3155
Next Steps
Test Full Flow
- ✅ Create free account
- ✅ Hit friend limit (5 friends)
- ✅ Upgrade to premium
- ✅ Register domain
- ✅ Check unlimited friends works
- ✅ View analytics dashboard
- ✅ Cancel subscription
- ✅ Verify downgrade at period end
Production Deployment
See PHASE6-COMPLETE.md for:
- Production webhook setup
- Live Stripe keys
- Security checklist
- Monitoring setup
Common Commands
# Check subscription status
curl http://localhost:5000/api/premium/subscription \
-H "Authorization: Bearer YOUR_TOKEN"
# Get analytics
curl http://localhost:5000/api/premium/analytics?period=7d \
-H "Authorization: Bearer YOUR_TOKEN"
# List domains
curl http://localhost:5000/api/premium/domains \
-H "Authorization: Bearer YOUR_TOKEN"
# Check feature limits
curl http://localhost:5000/api/premium/features \
-H "Authorization: Bearer YOUR_TOKEN"
# Browse marketplace
curl http://localhost:5000/api/premium/marketplace
Support
Stripe docs: https://stripe.com/docs
Test mode: https://dashboard.stripe.com/test
Webhook testing: https://stripe.com/docs/webhooks/test
Issues?
- Check server logs
- Check Stripe dashboard logs
- Verify environment variables
- Check database migrations ran
- Test with curl first, then frontend
Success Checklist
- Database migration completed
- Stripe keys configured
- Products & prices created
- Webhook listening (local)
- Server starts without errors
- Domain availability check works
- Test payment succeeds
- User tier upgraded in database
- Subscription visible in Stripe
- Webhook events logged
✨ You're ready to monetize! ✨
Phase 6 Quick Start Complete
Time to Revenue: 10 minutes 🚀