A modern points system platform with points, lifelines, gambling games, and real-time admin monitoring.
- Authentication System - Secure login/register
- Points System - Earn and spend points
- Lifelines - Use helpful lifelines with points
- Gambling Games - Slot machine & dice games
- Leaderboard - Compete with other players
- Transaction History - Track all your activity
- Real-time Monitoring - Live activity feed
- User Management - Manage users and points
- Analytics Dashboard - System statistics
- User-wise Analysis - Individual user tracking
- Frontend: Next.js 15, React, TypeScript, Tailwind CSS
- Backend: Next.js API Routes, MongoDB
- Authentication: JWT tokens with httpOnly cookies
- Animations: Framer Motion
- UI Components: Radix UI, Shadcn/ui
-
Clone the repository
git clone <your-repo-url> cd codedark
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
Fill in your MongoDB connection string and JWT secret:
MONGODB_CONNECTION_URI=mongodb+srv://... JWT_SECRET=your-super-secret-key BCRYPT_ROUNDS=12
-
Run the development server
npm run dev
-
Push to GitHub
git add . git commit -m "Ready for deployment" git push origin main
-
Deploy to Vercel
- Go to vercel.com
- Import your GitHub repository
- Add environment variables in Vercel dashboard
- Deploy!
MONGODB_CONNECTION_URI=your-mongodb-atlas-connection
JWT_SECRET=your-production-jwt-secret
BCRYPT_ROUNDS=12
NODE_ENV=production- Slot Machine: 10 points per spin, various payouts
- Dice Game: Variable betting, multipliers based on dice result
- Lifelines: Different costs, limited uses per user
codedark/
โโโ app/ # Next.js 15 App Router
โ โโโ api/ # API Routes
โ โ โโโ auth/ # Authentication endpoints
โ โ โ โโโ login/route.ts # User login
โ โ โ โโโ register/route.ts # User registration
โ โ โ โโโ logout/route.ts # User logout
โ โ โ โโโ me/route.ts # Get current user
โ โ โโโ admin/ # Admin-only endpoints
โ โ โ โโโ users/route.ts # User management
โ โ โ โโโ analytics/route.ts# System analytics
โ โ โ โโโ activity/route.ts # Real-time activity
โ โ โโโ gambling/ # Gaming endpoints
โ โ โ โโโ slot/route.ts # Slot machine game
โ โ โ โโโ dice/route.ts # Dice roll game
โ โ โโโ lifelines/ # Lifeline system
โ โ โ โโโ route.ts # Get user lifelines
โ โ โ โโโ use/route.ts # Use a lifeline
โ โ โโโ user/ # User data endpoints
โ โ โ โโโ history/route.ts # Transaction history
โ โ โโโ leaderboard/route.ts # User rankings
โ โโโ admin/ # Admin dashboard
โ โ โโโ page.tsx # Real-time monitoring
โ โโโ dashboard/ # User dashboard
โ โ โโโ page.tsx # Main user interface
โ โโโ gambling/ # Gaming pages
โ โ โโโ page.tsx # Slot machine & dice
โ โโโ lifelines/ # Lifelines system
โ โ โโโ page.tsx # Use lifelines
โ โโโ history/ # Transaction history
โ โ โโโ page.tsx # User activity log
โ โโโ leaderboard/ # Rankings
โ โ โโโ page.tsx # User leaderboard
โ โโโ globals.css # Global styles
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Landing/login page
โโโ components/ # Reusable components
โ โโโ ui/ # UI components
โ โ โโโ button.tsx # Button component
โ โ โโโ input.tsx # Input component
โ โ โโโ select.tsx # Select component
โ โ โโโ loading.tsx # Loading spinners
โ โ โโโ toast.tsx # Toast notifications
โ โโโ authentication-card.tsx # Login/register form
โ โโโ error-boundary.tsx # Error handling
โโโ contexts/ # React contexts
โ โโโ AuthContext.tsx # Authentication state
โโโ lib/ # Utility libraries
โ โโโ mongodb.ts # Database connection
โ โโโ auth.ts # JWT & password utils
โ โโโ utils.ts # Helper functions
โโโ .env.local # Environment variables
โโโ .env.example # Environment template
โโโ next.config.js # Next.js configuration
โโโ tailwind.config.js # Tailwind CSS config
โโโ package.json # Dependencies
โโโ README.md # This file
- JWT token management
- User session persistence
- Login/logout functionality
- Admin role detection
- MongoDB connection pooling
- Database operations
- Error handling
- RESTful endpoints
- JWT authentication middleware
- Admin authorization checks
- Input validation & sanitization
- Slot machine with configurable payouts
- Dice game with multiplier system
- Real-time point updates
- Animation system with Framer Motion
- Real-time activity monitoring
- User management interface
- System analytics
- Live data updates (3-second intervals)
- Consistent design system
- Accessible components
- Loading states
- Error boundaries
- Toast notifications
{
_id: String,
username: String,
email: String,
password: String (hashed),
points: Number,
isActive: Boolean,
isAdmin: Boolean,
lifelines: Array,
history: Object,
createdAt: Date,
updatedAt: Date
}- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed proprietary software for Code In The Dark Event for Invente.
Built by Pranav ๐ฅท