Skip to content

Repository files navigation

Teer Prediction Platform

A complete, production-ready Next.js 15 application for Teer predictions with admin panel, user subscriptions, and automated prediction generation.

Features

For Users

  • πŸ†“ Free Access: View latest Teer results
  • πŸ“Š Advanced Predictions: AI-powered predictions based on 30-day frequency analysis
  • πŸ’³ Flexible Subscriptions: Multiple subscription packages (1-30 days)
  • πŸ“± WhatsApp Integration: Easy communication for payment verification
  • πŸ”’ Secure Payments: Manual verification with proof upload

For Administrators

  • 🏒 House Management: CRUD operations for Teer houses
  • πŸ“ˆ Results Management: Upload results individually or via CSV (30-day bulk upload)
  • 🧠 Auto-Predictions: Generate predictions with frequency analysis
    • Common numbers (top 10 frequent)
    • Direct numbers (recent high-frequency)
    • House numbers (consistent patterns)
    • Ending numbers (last digit analysis)
    • Hot/Cold numbers (trending analysis)
  • πŸ’° Payment Management: Approve/reject payments with proof images
  • 🎯 Payment Methods: Configure payment QR codes and UPI details

Tech Stack

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript
  • Database: MySQL with Prisma ORM
  • Authentication: NextAuth.js v5
  • Styling: Tailwind CSS + shadcn/ui
  • Validation: Zod
  • Notifications: Sonner (toast)
  • File Handling: Built-in upload system
  • CSV Parsing: PapaParse

Project Structure

teer-prediction-app/
β”œβ”€β”€ actions/                 # Server actions
β”‚   β”œβ”€β”€ admin/              # Admin-only actions
β”‚   β”‚   β”œβ”€β”€ houses.ts
β”‚   β”‚   β”œβ”€β”€ results.ts
β”‚   β”‚   β”œβ”€β”€ predictions.ts
β”‚   β”‚   β”œβ”€β”€ payment-methods.ts
β”‚   β”‚   └── payments.ts
β”‚   β”œβ”€β”€ auth.ts             # Authentication actions
β”‚   └── subscription.ts     # User subscription actions
β”œβ”€β”€ app/                    # Next.js app directory
β”‚   β”œβ”€β”€ admin/             # Admin panel routes
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”œβ”€β”€ auth/              # Authentication pages
β”‚   β”œβ”€β”€ dashboard/         # User dashboard
β”‚   β”œβ”€β”€ predictions/       # Predictions page
β”‚   β”œβ”€β”€ results/           # Results page
β”‚   β”œβ”€β”€ subscription/      # Subscription page
β”‚   β”œβ”€β”€ error.tsx          # Global error handler
β”‚   β”œβ”€β”€ layout.tsx         # Root layout
β”‚   β”œβ”€β”€ not-found.tsx      # 404 page
β”‚   └── page.tsx           # Home page
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ ui/               # shadcn/ui components
β”‚   β”œβ”€β”€ error-boundary.tsx
β”‚   └── toaster.tsx
β”œβ”€β”€ lib/                   # Utility functions
β”‚   β”œβ”€β”€ validations/      # Zod schemas
β”‚   β”œβ”€β”€ errors.ts         # Error handling
β”‚   β”œβ”€β”€ file-upload.ts    # File upload utilities
β”‚   β”œβ”€β”€ predictions.ts    # Prediction algorithm
β”‚   β”œβ”€β”€ prisma.ts         # Prisma client
β”‚   └── utils.ts          # Helper functions
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma     # Database schema
β”œβ”€β”€ public/
β”‚   └── uploads/          # File upload directory
β”œβ”€β”€ types/
β”‚   └── next-auth.d.ts    # TypeScript definitions
β”œβ”€β”€ .env.example          # Environment variables template
β”œβ”€β”€ middleware.ts         # Route protection
└── package.json

Getting Started

Prerequisites

  • Node.js 18+ and npm
  • MySQL database
  • Git

Installation

  1. Clone the repository
git clone <repository-url>
cd teer-prediction-app
  1. Install dependencies
npm install
  1. Set up environment variables
cp .env.example .env

Edit .env with your values:

DATABASE_URL="mysql://user:password@localhost:3306/teer_db"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="generate-a-random-32-char-string"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_WHATSAPP_NUMBER="919999999999"
  1. Generate NextAuth secret
openssl rand -base64 32
  1. Set up database
npx prisma migrate dev
npx prisma generate
  1. Seed initial data
npx prisma db seed
  1. Run development server
npm run dev

Visit http://localhost:3000

Create Admin User

  1. Register a new account via the UI
  2. Connect to MySQL:
mysql -u root -p teer_db
  1. Update user role:
UPDATE User SET role = 'ADMIN' WHERE email = 'your-email@example.com';

Subscription Packages

Default packages (can be managed by admin):

Package Days Price
1 Day 1 β‚Ή29
3 Days 3 β‚Ή59
7 Days 7 β‚Ή149
15 Days 15 β‚Ή249
30 Days 30 β‚Ή399

Prediction Algorithm

The system generates predictions using frequency analysis of the last 30 days:

  1. Common Numbers: Top 10 most frequently appearing numbers
  2. Direct Numbers: Recent high-frequency matches
  3. House Numbers: Numbers with 15-40% appearance rate
  4. Ending Numbers: Analysis of last digit patterns
  5. Hot Numbers: Frequently appearing in last 7 days
  6. Cold Numbers: Rarely appearing or overdue

Error Handling

Comprehensive error handling throughout:

  • βœ… Try/catch in all server actions
  • βœ… Zod validation with user-friendly messages
  • βœ… Toast notifications for success/errors
  • βœ… Global error boundary
  • βœ… Prisma error handling
  • βœ… File upload validation
  • βœ… Custom error classes

API Routes

Public

  • GET /api/packages - Get active subscription packages
  • GET /api/payment-methods - Get active payment methods

Protected (Authenticated)

All pages under /dashboard require authentication

Admin Only

All routes under /admin require admin role

File Uploads

Supported file types:

  • Images: JPEG, PNG, WebP (max 5MB)
  • CSV: CSV files for bulk results upload

Upload directories:

  • public/uploads/payment-qr - Payment QR codes
  • public/uploads/payment-proofs - Payment proof screenshots
  • public/uploads/csv - CSV files

Database Schema

Key models:

  • User: Authentication and user management
  • House: Teer houses
  • Result: Daily Teer results
  • Prediction: Generated predictions
  • SubscriptionPackage: Subscription plans
  • Subscription: User subscriptions
  • PaymentMethod: Payment QR codes and UPI
  • Payment: Payment records and proofs

Scripts

# Development
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Run linter
npm run lint

# Database operations
npx prisma migrate dev
npx prisma generate
npx prisma studio
npx prisma db seed

Deployment

See DEPLOYMENT.md for detailed deployment instructions for Hostinger Cloud Hosting.

Quick deployment checklist:

  1. Set up MySQL database
  2. Configure environment variables
  3. Run database migrations
  4. Build application
  5. Start with PM2
  6. Configure Nginx
  7. Set up SSL

CSV Upload Format

For bulk results upload, use this CSV format:

date,firstRound,secondRound
2024-01-01,45,67
2024-01-02,23,89
  • date: YYYY-MM-DD format
  • firstRound: 0-99 or empty
  • secondRound: 0-99 or empty

Security Features

  • πŸ” Password hashing with bcrypt
  • πŸ›‘οΈ CSRF protection via NextAuth
  • πŸ”’ SQL injection prevention via Prisma
  • βœ… Input validation with Zod
  • πŸ“ File upload restrictions
  • 🚫 Role-based access control
  • πŸ”‘ Secure session management

Browser Support

  • Chrome/Edge (latest)
  • Firefox (latest)
  • Safari (latest)
  • Mobile browsers (iOS Safari, Chrome Mobile)

License

MIT License

Support

For issues or questions:

  1. Check error logs in browser console
  2. Review server logs: pm2 logs teer-app
  3. Verify environment variables
  4. Check database connection

Contributing

  1. Fork the repository
  2. Create feature branch
  3. Make changes with tests
  4. Submit pull request

Roadmap

  • Email notifications for payment status
  • Advanced analytics dashboard
  • Mobile app (React Native)
  • Automated payment gateway integration
  • Multi-language support
  • Export predictions as PDF

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages