# CoinKrazy Launch Configuration Guide

## Step 1: Configure OAuth Credentials

### Google OAuth
1. Go to https://console.cloud.google.com/apis/credentials
2. Create a new OAuth 2.0 Client ID (Web application)
3. Add authorized redirect URIs:
   - https://playcoinkrazy.com/api/oauth/callback
   - https://coinkrazy-38mmepdj.manus.space/api/oauth/callback
4. Copy the Client ID
5. In CoinKrazy Management UI → Settings → Secrets:
   - Add `GOOGLE_OAUTH_CLIENT_ID` with your Client ID

### GitHub OAuth
1. Go to https://github.com/settings/developers
2. Click "New OAuth App"
3. Set Authorization callback URL:
   - https://playcoinkrazy.com/api/oauth/callback
4. Copy the Client ID
5. In CoinKrazy Management UI → Settings → Secrets:
   - Add `GITHUB_OAUTH_CLIENT_ID` with your Client ID

### Apple OAuth
1. Go to https://developer.apple.com/account/resources/identifiers/list
2. Create a new Services ID
3. Configure Web Redirect URIs:
   - https://playcoinkrazy.com/api/oauth/callback
   - https://coinkrazy-38mmepdj.manus.space/api/oauth/callback
4. Create a private key for the Service ID
5. In CoinKrazy Management UI → Settings → Secrets:
   - Add `APPLE_OAUTH_CLIENT_ID` with your Service ID

---

## Step 2: Set Up Twilio Verify Service

### Create Twilio Account
1. Go to https://www.twilio.com/
2. Sign up for a free account (includes trial credits)
3. Go to Console → Account Settings
4. Copy your Account SID and Auth Token

### Create Verify Service
1. In Twilio Console, go to Verify → Services
2. Click "Create new Service"
3. Name it "CoinKrazy"
4. Copy the Service SID

### Add to CoinKrazy
In CoinKrazy Management UI → Settings → Secrets, add:
- `TWILIO_ACCOUNT_SID`: Your Account SID
- `TWILIO_AUTH_TOKEN`: Your Auth Token
- `TWILIO_VERIFY_SERVICE_SID`: Your Verify Service SID
- `TWILIO_PHONE_NUMBER`: Your Twilio phone number (for SMS notifications)

---

## Step 3: Launch Marketing Plan

### Email Sequences
The platform includes automated email templates:
- **Welcome Email**: Sent on signup with 5,000 GC welcome bonus
- **Daily Bonus Reminder**: Sent daily at 9 AM with bonus amount
- **Referral Invitation**: Sent when user invites friends (1 SC reward)
- **Re-engagement**: Sent to inactive players after 7 days

### SMS Campaigns
After setting up Twilio:
- **Verification SMS**: Sent during signup with OTP code
- **Tournament Alerts**: Sent when new tournaments start
- **Bonus Notifications**: Sent when daily bonuses are available
- **VIP Tier Updates**: Sent when players advance to new tiers

### Referral Program
Players earn 1 SC for each successful referral:
- Share referral code with friends
- Friend signs up with code
- Referrer receives 1 SC bonus per successful referral
- Leaderboard shows top referrers

### Player Acquisition Channels
1. **Organic**: Word-of-mouth via referral program
2. **Email**: Welcome and re-engagement sequences
3. **SMS**: Tournament and bonus notifications
4. **Social**: Share buttons for Twitter, Facebook, WhatsApp
5. **Paid**: Retargeting ads to lapsed players

---

## Step 4: Pre-Launch Checklist

### Security
- [ ] All OAuth credentials configured
- [ ] Twilio Verify service set up
- [ ] SSL certificate active (automatic with Manus)
- [ ] Rate limiting enabled for API endpoints
- [ ] CSRF protection active

### Payments
- [ ] Stripe live keys added (or keep sandbox for testing)
- [ ] PayPal credentials configured
- [ ] Webhook endpoints verified
- [ ] Payment confirmation emails tested

### Content
- [ ] Terms of Service updated
- [ ] Privacy Policy published
- [ ] Responsible Gaming resources linked
- [ ] Support contact information displayed

### Testing
- [ ] User signup flow tested (email + OAuth)
- [ ] SMS verification tested
- [ ] Payment processing tested
- [ ] Daily bonus claim tested
- [ ] Referral system tested
- [ ] Admin dashboard access verified

### Analytics
- [ ] Analytics dashboard configured
- [ ] Conversion tracking enabled
- [ ] Player retention metrics tracked
- [ ] Revenue reporting set up

---

## Step 5: Launch Day

1. **Verify all systems**:
   - Dev server running without errors
   - All credentials in Settings → Secrets
   - Database migrations applied
   - Payment processing active

2. **Monitor metrics**:
   - Watch for signup errors in browser console
   - Monitor server logs for issues
   - Track first player signups
   - Verify email/SMS delivery

3. **Support ready**:
   - Support email monitored
   - FAQ page accessible
   - Contact form working
   - Admin dashboard accessible

4. **Marketing activation**:
   - Email sequences activated
   - SMS campaigns scheduled
   - Social sharing enabled
   - Referral program live

---

## Troubleshooting

### OAuth Not Working
- Check that Client IDs are correctly added to Settings → Secrets
- Verify redirect URIs match exactly (including https://)
- Check browser console for error messages
- Look for "Authorize params not found" errors

### SMS Not Sending
- Verify Twilio credentials in Settings → Secrets
- Check Twilio account has sufficient trial credits
- Verify phone numbers are in E.164 format (+1234567890)
- Check Twilio logs for delivery errors

### Payment Processing Issues
- Verify Stripe/PayPal credentials in Settings → Secrets
- Test with card number 4242 4242 4242 4242 (Stripe test mode)
- Check webhook endpoints are receiving events
- Review payment logs in admin dashboard

### Player Signup Errors
- Check database connection in Settings
- Verify all required tables exist
- Look for validation errors in browser console
- Check server logs for database errors

---

## Support

For issues or questions:
1. Check the admin dashboard for error logs
2. Review browser console for client-side errors
3. Check server logs in Management UI → Dashboard
4. Contact Manus support at https://help.manus.im
