Skip to content

gmtechsolutionus/FUTUCHAT-WEB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ FutuChat - Crypto Payment & Telegram Auth Integration

Advanced AI chat platform with cryptocurrency payments and Telegram authentication

Vercel Coinbase Commerce Telegram X.AI


๐ŸŒŸ Features

๐Ÿ’ฐ Cryptocurrency Payments

  • Accept BTC, ETH, USDC, USDT, DAI, and more via Coinbase Commerce
  • Two pricing tiers: 7 Days ($30) and 30 Days ($80)
  • Secure payment verification with webhook signatures
  • Real-time payment status tracking

๐Ÿ” Telegram Authentication

  • One-click login with Telegram OAuth
  • Secure identity verification
  • No email/password required
  • Privacy-preserving (only Telegram ID stored)

๐Ÿ’ฌ AI Chat Interface

  • Powered by X.AI Grok
  • Markdown rendering with syntax highlighting
  • Code block copy functionality
  • Conversation history persistence

๐ŸŽจ Beautiful UI

  • Modern glassmorphism design
  • Neon glow effects and animations
  • Fully mobile-responsive
  • Dark cyberpunk aesthetic

๐Ÿ—๏ธ Architecture

Frontend (HTML/CSS/JS)
    โ†“
Vercel Serverless Functions
    โ†“
External APIs:
โ”œโ”€ Coinbase Commerce (Payments)
โ”œโ”€ Telegram Bot API (Authentication)
โ””โ”€ X.AI Grok (Chat AI)

See ARCHITECTURE.md for detailed flow diagrams


๐Ÿš€ Quick Start

Prerequisites

  • Vercel account
  • Coinbase Commerce account
  • Telegram bot token
  • X.AI API key

Setup (20 minutes)

  1. Clone and Deploy

    git clone <your-repo>
    cd futuchat
    vercel
  2. Configure Services (see QUICK_START.md)

    • Set up Coinbase Commerce
    • Create Telegram bot
    • Add environment variables
  3. Update Configuration

    • Edit app.js line 381 with your bot username
    • Deploy changes
  4. Test Payment Flow

    • Visit your deployed site
    • Test with small payment amount
    • Verify Telegram login works

๐Ÿ“– Detailed instructions: QUICK_START.md


โš™๏ธ Environment Variables

Add these in Vercel Dashboard โ†’ Settings โ†’ Environment Variables:

# AI Chat (existing)
XAI_API_KEY=your_xai_key
SYSTEM_PROMPT=your_custom_prompt

# Crypto Payments (new)
COINBASE_COMMERCE_API_KEY=your_coinbase_key
COINBASE_WEBHOOK_SECRET=your_webhook_secret

# Telegram Auth (new)
TELEGRAM_BOT_TOKEN=1234567890:ABC...
TELEGRAM_BOT_USERNAME=your_bot_username

๐Ÿ“– Setup guide: PAYMENT_SETUP_GUIDE.md


๐Ÿ“ Project Structure

/workspace
โ”œโ”€โ”€ index.html                  # Main UI
โ”œโ”€โ”€ app.js                      # Frontend logic
โ”œโ”€โ”€ styles.css                  # Styling
โ”œโ”€โ”€ logo.svg                    # Brand logo
โ”‚
โ”œโ”€โ”€ api/
โ”‚   โ”œโ”€โ”€ chat.js                # X.AI Grok integration
โ”‚   โ”œโ”€โ”€ create-charge.js       # Create payment charge
โ”‚   โ”œโ”€โ”€ webhook.js             # Payment webhooks
โ”‚   โ”œโ”€โ”€ verify-payment.js      # Verify payment status
โ”‚   โ””โ”€โ”€ activate-telegram.js   # Telegram auth & activation
โ”‚
โ””โ”€โ”€ docs/
    โ”œโ”€โ”€ QUICK_START.md         # Fast setup guide
    โ”œโ”€โ”€ PAYMENT_SETUP_GUIDE.md # Detailed payment setup
    โ”œโ”€โ”€ ARCHITECTURE.md        # Technical architecture
    โ””โ”€โ”€ IMPLEMENTATION_SUMMARY.md  # What was built

๐ŸŽฏ User Flow

  1. User visits site โ†’ Sees pricing plans with "Buy with Crypto" buttons
  2. Clicks buy โ†’ Redirects to Coinbase Commerce payment page
  3. Pays with crypto โ†’ BTC, ETH, USDC, or other supported coins
  4. Payment confirms โ†’ Returns to app with success screen
  5. Logs in via Telegram โ†’ One-click OAuth authentication
  6. Auto-activation โ†’ Access key generated and activated
  7. Access granted โ†’ Can now use AI chat interface

See ARCHITECTURE.md for detailed flow diagrams


๐Ÿ”’ Security

Multi-Layer Security:

  • โœ… Payment Verification: Webhook HMAC-SHA256 signature validation
  • โœ… Identity Verification: Telegram auth hash cryptographic verification
  • โœ… Access Control: SHA-256 hashed access keys with time-based expiration
  • โœ… API Protection: Environment variables, HTTPS-only, sanitized errors

Best Practices:

  • No sensitive data in client code
  • All secrets in environment variables
  • Signature verification on all webhooks
  • Auth timestamp expiration checks
  • Hashed key storage (not plaintext)

๐Ÿงช Testing

Test Payment Flow:

# 1. Create test charge
curl -X POST https://your-domain.vercel.app/api/create-charge \
  -H "Content-Type: application/json" \
  -d '{"plan":"7-day","amount":30,"duration":7}'

# 2. Verify payment (after paying)
curl "https://your-domain.vercel.app/api/verify-payment?chargeCode=ABC123"

Manual Testing:

  1. Click "Buy with Crypto" button
  2. Complete small test payment ($1-2)
  3. Return to app after payment
  4. Login with Telegram
  5. Verify auto-activation works
  6. Test chat functionality

๐Ÿ“Š API Endpoints

Endpoint Method Purpose
/api/create-charge POST Create Coinbase payment charge
/api/webhook POST Receive payment confirmations
/api/verify-payment GET Check payment status
/api/activate-telegram POST Verify Telegram & activate access
/api/chat POST AI chat endpoint (existing)

See ARCHITECTURE.md for detailed API documentation


๐Ÿ“š Documentation


๐ŸŽจ UI Screenshots

Pricing Plans

Beautiful pricing cards with "Buy with Crypto" buttons, neon glow effects, and "Most Popular" badge.

Payment Success

Animated success screen with Telegram login widget integration.

Chat Interface

Modern dark theme with markdown rendering, code highlighting, and smooth animations.


๐Ÿ› ๏ธ Tech Stack

  • Frontend: HTML5, CSS3, Vanilla JavaScript
  • Backend: Vercel Serverless Functions (Node.js)
  • Payments: Coinbase Commerce API
  • Authentication: Telegram Bot API OAuth
  • AI: X.AI Grok API
  • Deployment: Vercel
  • Storage: localStorage (client-side)

Recommended for Production:

  • Database: Vercel KV, Upstash Redis, or Supabase
  • Monitoring: Sentry, LogRocket
  • Analytics: Vercel Analytics, PostHog

๐Ÿ“ˆ Roadmap

โœ… Completed:

  • Crypto payment integration
  • Telegram authentication
  • Auto-activation flow
  • Payment webhooks
  • Beautiful UI/UX
  • Mobile responsive design
  • Comprehensive documentation

๐Ÿšง Recommended Next:

  • Database integration for persistence
  • User dashboard for subscription management
  • Email notifications
  • Admin panel
  • Usage analytics
  • Rate limiting
  • Automated testing

๐Ÿ”ฎ Future Ideas:

  • Team/organization plans
  • Referral system
  • Multiple pricing tiers
  • API access tiers
  • Mobile app
  • White-label options

๐Ÿ†˜ Troubleshooting

Payment Issues

  • "Payment system not configured" โ†’ Add COINBASE_COMMERCE_API_KEY to Vercel
  • "Invalid webhook signature" โ†’ Check COINBASE_WEBHOOK_SECRET matches
  • Payment not confirming โ†’ Wait for blockchain confirmation (can take 10-60 min for BTC)

Telegram Issues

  • Login button not showing โ†’ Update bot username in app.js
  • "Telegram bot not configured" โ†’ Register domain with @BotFather using /setdomain
  • Auth failing โ†’ Verify TELEGRAM_BOT_TOKEN is correct

General Issues

  • Check Vercel function logs for errors
  • Verify all environment variables are set
  • Test each API endpoint individually
  • Clear browser cache and localStorage

See PAYMENT_SETUP_GUIDE.md for detailed troubleshooting


๐Ÿ“ž Support


๐Ÿ“„ License

[Your License Here]


๐Ÿ™ Acknowledgments

  • Coinbase Commerce - Crypto payment infrastructure
  • Telegram - Authentication platform
  • X.AI - Grok AI model
  • Vercel - Serverless deployment platform

๐ŸŽฏ Get Started Now!

  1. Read QUICK_START.md
  2. Set up Coinbase Commerce & Telegram bot
  3. Configure environment variables
  4. Deploy and test!

You'll be accepting crypto payments in 20 minutes! ๐Ÿš€


Built with โค๏ธ for the cybersecurity community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •