Skip to content

Latest commit

 

History

116 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 Teer Khela - Complete Project

📊 Project Status

✅ COMPLETED (65%)

  • Backend API - 100% Complete ✅
  • Flutter App Core - 60% Complete ⏳
  • Admin Dashboard - 0% Pending ❌

🗂️ Project Structure

Riogold/
├── backend/                    ✅ COMPLETE
│   ├── src/
│   │   ├── config/            # Database, Firebase, Razorpay
│   │   ├── controllers/       # API request handlers
│   │   ├── middleware/        # Auth, premium check
│   │   ├── models/            # Database models
│   │   ├── routes/            # API routes
│   │   ├── services/          # Business logic
│   │   └── server.js          # Main server + cron jobs
│   ├── package.json
│   ├── .env.example
│   └── README.md
│
├── flutter_app/               ⏳ 60% COMPLETE
│   ├── lib/
│   │   ├── models/            ✅ Complete
│   │   ├── services/          ✅ Complete
│   │   ├── providers/         ✅ User provider done
│   │   ├── screens/           ⏳ 2/10 screens done
│   │   ├── widgets/           ❌ Pending
│   │   └── main.dart          ✅ Complete
│   ├── android/
│   └── pubspec.yaml           ✅ Complete
│
├── admin-dashboard/           ❌ NOT STARTED
│   └── (To be created)
│
└── COMPLETE_PROJECT_GUIDE.md  📚 Full documentation

✅ What's COMPLETE

Backend API (100%) 🎉

Location: backend/

Features:

  • ✅ PostgreSQL database with auto-setup
  • ✅ Web scraping for 6 Teer games
  • ✅ AI predictions engine (historical analysis)
  • ✅ Multi-language dream bot (100+ symbols)
  • ✅ Firebase Cloud Messaging integration
  • ✅ Razorpay auto-recurring subscriptions
  • ✅ Complete API endpoints (public, premium, admin)
  • ✅ Automated cron jobs:
    • Scrape results every 10 mins
    • Generate predictions at 5:30 AM
    • Send notifications at 6:00 AM
    • Expiry reminders at 9:00 AM
    • Data cleanup at 2:00 AM

API Endpoints:

  • Public: /api/results, /api/user/register, /api/user/:userId/status
  • Premium: /api/predictions, /api/dream-interpret, /api/common-numbers, /api/calculate-formula
  • Payment: /api/payment/create-subscription, /api/payment/webhook
  • Admin: /api/admin/login, /api/admin/stats, /api/admin/users, /api/admin/notification/send

Start Backend:

cd backend
npm install
cp .env.example .env
# Fill in credentials
npm run dev
# Runs on http://localhost:5000

Flutter App Core (60%) ⏳

Location: flutter_app/

What's Complete:

  • ✅ Project structure with all dependencies
  • ✅ Models: Result, Prediction, User, DreamInterpretation
  • ✅ API Service (complete backend integration)
  • ✅ Storage Service (SharedPreferences wrapper)
  • ✅ Notification Service (Firebase CM)
  • ✅ User Provider (state management)
  • ✅ Main app initialization
  • ✅ Splash Screen (example)
  • ✅ Home Screen (example with result grid)

Dependencies Included:

provider, http, shared_preferences
firebase_core, firebase_messaging
razorpay_flutter
flutter_spinkit, shimmer, cached_network_image
google_fonts, uuid, intl, url_launcher

❌ What Needs to be Built

1. Flutter UI Screens (Priority 1) 🚨

Create these 8 screens in flutter_app/lib/screens/:

  1. predictions_screen.dart

    • Premium gate for free users
    • Show predictions for all 6 games
    • Display FR/SR numbers, analysis, confidence
    • Refresh functionality
  2. dream_screen.dart

    • Premium gate
    • Language selector dropdown (Hindi, Bengali, English, etc.)
    • Text input for dream description
    • Submit button → Call API
    • Display results: symbols, numbers, analysis
    • Dream history list (past dreams)
  3. subscribe_screen.dart

    • Hero section: "50% OFF - ₹29/month"
    • Features list with checkmarks
    • Razorpay payment button
    • Handle payment success/failure
    • Activate premium after payment
  4. profile_screen.dart

    • User info (email if entered)
    • Premium status card:
      • If free: "Upgrade" button
      • If premium: "Active until [date]", "Manage" button
    • Settings: Notifications toggle, Language dropdown
    • About app, Logout
  5. result_detail_screen.dart

    • Game name header
    • Today's FR/SR (large display)
    • Quick stats card
    • Past results table (7 or 30 days based on premium)
    • Premium upsell if free
  6. common_numbers_screen.dart

    • Game selector dropdown
    • Hot numbers display (with frequency)
    • Cold numbers display
    • Day-wise analysis (premium only)
    • Premium upsell if free
  7. formula_calculator_screen.dart

    • Premium gate
    • Formula type selector (House, Ending, Sum)
    • Input fields for previous FR/SR
    • Calculate button
    • Results display with explanation
  8. manage_subscription_screen.dart

    • Subscription details card
    • Next billing date
    • Amount
    • Cancel subscription button (with confirmation dialog)

2. Razorpay Integration (Priority 1) 🚨

In subscribe_screen.dart:

import 'package:razorpay_flutter/razorpay_flutter.dart';

// Initialize
late Razorpay _razorpay;

@override
void initState() {
  super.initState();
  _razorpay = Razorpay();
  _razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
  _razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
}

// Open Razorpay checkout
void _openCheckout() async {
  // 1. Call API to create subscription
  final result = await ApiService.createSubscription(userId, email, planId);

  // 2. Open Razorpay
  var options = {
    'key': 'rzp_live_YOUR_KEY',
    'subscription_id': result['subscriptionId'],
    'name': 'Teer Khela Premium',
    'description': 'Monthly Subscription',
    'prefill': {'email': email},
  };
  _razorpay.open(options);
}

// Handle success
void _handlePaymentSuccess(PaymentSuccessResponse response) {
  // Update user premium status
  Provider.of<UserProvider>(context, listen: false).setPremium(true);
  // Show success dialog
  // Navigate to predictions
}

3. Firebase Notification Navigation (Priority 2)

In main.dart:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await StorageService.init();
  await NotificationService.initialize();

  // Set notification tap handler
  NotificationService.onNotificationTap = (screen) {
    // Navigate based on screen
    navigatorKey.currentState?.pushNamed('/$screen');
  };

  runApp(MyApp());
}

// Add global navigator key
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

// In MaterialApp:
MaterialApp(
  navigatorKey: navigatorKey,
  ...
)

4. React Admin Dashboard (Priority 3)

Create new project:

npm create vite@latest admin-dashboard -- --template react
cd admin-dashboard
npm install react-router-dom axios chart.js react-chartjs-2

Pages to create:

  1. Login (/login)
  2. Dashboard (/) - Stats, charts
  3. Users (/users) - Table, filters, actions
  4. Predictions (/predictions) - Override form
  5. Notifications (/notifications) - Send form, history
  6. Results (/results) - Manual entry
  7. Analytics (/analytics) - Charts
  8. Settings (/settings) - Config

All admin API calls require JWT:

axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;

🚀 Quick Start Guide

Backend:

cd backend
npm install
cp .env.example .env
# Edit .env with your credentials
npm run dev

Flutter:

cd flutter_app
flutter pub get
# Complete remaining screens (see above)
flutter run
# When ready:
flutter build apk --release

Admin Dashboard:

# Create project first (see above)
npm install
npm run dev

🔑 Required Credentials

1. PostgreSQL (Railway)

DATABASE_URL=postgresql://user:pass@host:port/db

Get from: railway.app

2. Razorpay

RAZORPAY_KEY_ID=rzp_live_xxx
RAZORPAY_KEY_SECRET=xxx
RAZORPAY_PLAN_ID=plan_xxx
RAZORPAY_WEBHOOK_SECRET=xxx

Get from: dashboard.razorpay.com

3. Firebase

FIREBASE_PROJECT_ID=xxx
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----..."
FIREBASE_CLIENT_EMAIL=xxx@xxx.iam.gserviceaccount.com

Get from: Firebase Console → Project Settings → Service Accounts

4. Admin

ADMIN_USERNAME=admin
ADMIN_PASSWORD=your_secure_password
JWT_SECRET=your_random_secret

📱 Firebase Setup for Flutter

  1. Go to Firebase Console → Add Android app
  2. Download google-services.json
  3. Place in: flutter_app/android/app/google-services.json
  4. Firebase automatically configured (already in main.dart)

💳 Razorpay Setup

Create Subscription Plan:

  1. Go to Razorpay Dashboard → Subscriptions → Plans
  2. Create New Plan:
    • Name: "Teer Khela Premium"
    • Amount: ₹2900 (₹29 in paise)
    • Billing Interval: Monthly
    • Auto-charge: Yes
  3. Copy Plan ID to .env

Webhook Setup:

  1. Go to Settings → Webhooks
  2. Add Webhook URL: https://your-api.com/api/payment/webhook
  3. Select Events: All subscription events
  4. Copy Webhook Secret to .env

📚 Documentation

  • Complete Guide: COMPLETE_PROJECT_GUIDE.md (detailed)
  • Backend README: backend/README.md
  • This File: Overview and quick reference

⏱️ Time Estimates

Task Time Priority
Flutter UI Screens (8) 2-3 days 🔴 High
Razorpay Integration 4-6 hours 🔴 High
Firebase Navigation 2-3 hours 🟡 Medium
Admin Dashboard 2-3 days 🟡 Medium
Testing & Polish 1-2 days 🟡 Medium
Total 5-8 days

🎯 Next Steps

  1. ✅ Backend is ready - Start backend server
  2. 🔥 Create 8 Flutter UI screens (templates provided)
  3. 💳 Implement Razorpay payment flow
  4. 🔔 Complete Firebase notification navigation
  5. 🎨 Build React admin dashboard
  6. ✅ Test everything end-to-end
  7. 🚀 Deploy to production

🆘 Need Help?

Backend Issues:

  • Check .env has all variables
  • Test database connection
  • Verify Firebase/Razorpay credentials

Flutter Issues:

  • Run flutter pub get
  • Check google-services.json is in android/app/
  • Update Flutter: flutter upgrade

Payment Issues:

  • Use Razorpay test mode for development
  • Verify plan ID is correct
  • Check webhook is receiving events

📝 Important Notes

  • Backend is production-ready and fully functional
  • Flutter app has complete API integration - just needs UI
  • All services (scraping, predictions, dream bot) are working
  • Cron jobs start automatically when backend runs
  • Database tables auto-create on first run
  • Admin APIs are ready for dashboard

🎉 What You Have

A production-ready backend with:

  • AI predictions engine
  • Multi-language dream interpretation
  • Auto-recurring subscriptions
  • Push notifications
  • Web scraping
  • Admin APIs
  • Automated tasks

Plus 60% of Flutter app with:

  • Complete backend integration
  • State management
  • Models and services
  • 2 example screens

📧 Support

If you encounter issues:

  1. Check relevant README files
  2. Verify all credentials in .env
  3. Check console logs for errors
  4. Test API endpoints with Postman

Built with ❤️ for Teer enthusiasts

Backend: Node.js + Express + PostgreSQL + Firebase + Razorpay Frontend: Flutter + Provider + Razorpay SDK Admin: React (to be built)

Good luck building! 🚀

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages