Skip to content

Repository files navigation

Teer Prediction Platform

A comprehensive Teer prediction platform built with Next.js 14+, TypeScript, Tailwind CSS, and Prisma ORM. This platform allows users to subscribe, get daily predictions, and provides admins with full management capabilities.

🚀 Tech Stack

  • Framework: Next.js 14+ (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS with dark mode support
  • Database: PostgreSQL with Prisma ORM v7
  • Authentication: NextAuth.js v5
  • Forms: React Hook Form + Zod validation
  • File Uploads: Uploadthing
  • State Management: Zustand
  • Date Handling: date-fns

📁 Project Structure

commonnumber-pred/
├── app/
│   ├── api/auth/[...nextauth]/     # NextAuth API route
│   ├── layout.tsx                   # Root layout with providers
│   ├── page.tsx                     # Homepage
│   └── globals.css                  # Global styles with theme
├── components/
│   ├── ui/                          # Reusable UI components
│   ├── navbar.tsx                   # Navigation bar
│   └── providers.tsx                # Session provider wrapper
├── lib/
│   ├── prisma.ts                    # Prisma client singleton
│   ├── auth.ts                      # NextAuth configuration
│   ├── auth-helpers.ts              # Auth helper functions
│   └── utils.ts                     # Utility functions
├── prisma/
│   ├── schema.prisma                # Complete database schema
│   └── seed.ts                      # Database seed script
└── .env                             # Environment variables

📊 Database Schema

The platform includes comprehensive models for:

  • User: User accounts with authentication and subscription status
  • SubscriptionPlan: Different subscription tiers (1-day, 3-day, 7-day)
  • Subscription: User subscriptions with status tracking
  • Payment: Payment records with approval workflow
  • House: Teer houses (Shillong, Khanapara, etc.)
  • Result: Daily results for each house
  • Prediction: Daily predictions (public and premium)
  • PaymentMethod: Payment methods (UPI, Bank Transfer)
  • DreamSymbol: Dream interpretation database (110+ symbols)
  • Notification: User notifications
  • Setting: Site configuration

🛠️ Getting Started

Prerequisites

  • Node.js 18+ installed
  • PostgreSQL database (local or remote)
  • npm package manager

Installation Steps

  1. Install dependencies

    npm install
  2. Configure environment variables

    The .env file contains all necessary configuration. Update the following:

    DATABASE_URL="your-postgres-connection-string"
    NEXTAUTH_SECRET="your-secret-key"
    UPI_ID="your-upi-id@paytm"
    WHATSAPP_NUMBER="+91XXXXXXXXXX"
  3. Setup database

    # Push schema to database
    npm run db:push
    
    # Seed initial data
    npm run db:seed
  4. Run development server

    npm run dev

    Open http://localhost:3000 to view the app.

🔐 Default Credentials

After seeding the database:

Admin Account:

  • Username: admin
  • Password: admin123
  • Access: Full admin panel + all features

Test User:

  • Username: testuser
  • Password: user123
  • Access: User features only

⚠️ Change these passwords in production!

✅ Features Implemented

Core Infrastructure

  • ✅ Next.js 14+ with App Router and TypeScript
  • ✅ Tailwind CSS with dark mode support
  • ✅ Prisma ORM v7 with complete schema
  • ✅ NextAuth.js v5 authentication
  • ✅ Database seed script with sample data
  • ✅ Utility functions and auth helpers
  • ✅ Reusable UI components (Button, Card, Input, Label)
  • ✅ Navigation bar with authentication state
  • ✅ Session provider wrapper

Pages

  • ✅ Homepage with hero section, statistics, features showcase, and latest results

🚧 Features To Implement

This project provides a solid foundation. Here's what needs to be built:

Authentication & User Pages

  • /login - Login page
  • /register - Registration page
  • /dashboard - User dashboard
  • /subscription - Subscription plans page
  • /predictions - Predictions page with dream interpretation
  • /latest-results - Complete results page
  • /account - Account settings
  • /payments - Payment history

Admin Panel (/admin/*)

  • Dashboard with statistics
  • User management (CRUD)
  • Subscription plans management
  • Payment approval system
  • House management
  • Results management
  • Predictions management
  • Payment methods management
  • Settings management

API Routes

All CRUD operations need implementation in app/api/:

  • Public: results, plans, registration
  • Protected: user profile, subscriptions, payments, predictions
  • Admin: complete management APIs

Auto-Prediction System

  • Prediction algorithms (dream, formula, pattern analysis)
  • Cron job for daily auto-predictions
  • Historical data analysis

📚 Database Commands

# Generate Prisma Client
npx prisma generate

# Push schema to database (no migrations)
npm run db:push

# Seed database with sample data
npm run db:seed

# Open Prisma Studio (database GUI)
npm run db:studio

# Reset database (⚠️ deletes all data)
npx prisma migrate reset

🔧 Available Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint
npm run db:push      # Push schema to database
npm run db:seed      # Seed database
npm run db:studio    # Open Prisma Studio

🚀 Deployment

Vercel (Recommended)

  1. Push code to GitHub
  2. Import project in Vercel
  3. Add environment variables
  4. Deploy

Required Environment Variables

DATABASE_URL=
NEXTAUTH_URL=
NEXTAUTH_SECRET=
UPI_ID=
WHATSAPP_NUMBER=
UPLOADTHING_SECRET=
UPLOADTHING_APP_ID=
CRON_SECRET=

🔒 Security Notes

  • ⚠️ Change default admin password immediately
  • ⚠️ Use strong secrets (32+ characters) in production
  • ⚠️ Enable HTTPS in production
  • ⚠️ Regularly backup database
  • ⚠️ Validate all user inputs server-side
  • ⚠️ Use rate limiting for API routes
  • ⚠️ Sanitize file uploads

📝 Implementation Guide

Creating a New Page

// app/your-page/page.tsx
export default function YourPage() {
  return <div>Your content</div>
}

Creating an API Route

// app/api/your-route/route.ts
import { NextResponse } from 'next/server'
import { prisma } from '@/lib/prisma'
import { requireAuth } from '@/lib/auth-helpers'

export async function GET() {
  const user = await requireAuth()
  const data = await prisma.yourModel.findMany()
  return NextResponse.json(data)
}

Using Forms with Validation

'use client'
import { useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'
import * as z from 'zod'

const schema = z.object({
  field: z.string().min(1, 'Required'),
})

export function YourForm() {
  const form = useForm({
    resolver: zodResolver(schema),
  })
  // ... form implementation
}

📖 Next Steps

  1. Implement Authentication Pages: Build login and registration
  2. Create User Dashboard: Show subscription status and predictions
  3. Build Admin Panel: Complete CRUD for all resources
  4. Add API Routes: Implement all API endpoints
  5. Prediction System: Build auto-prediction algorithms
  6. File Upload: Integrate Uploadthing for payment screenshots
  7. Testing: Test all features thoroughly
  8. Deploy: Deploy to production

🤝 Contributing

  1. Create feature branch
  2. Make changes
  3. Test thoroughly
  4. Submit pull request

📄 License

MIT License


The foundation is complete. Start building features following the structure provided! 🎉

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages