Welcome to the official repository for The Chronos Cypher, a 40-level technical quiz game with real-time scoring, team management, and comprehensive admin controls.
This project is built using a modern web stack for speed, scalability, and developer experience:
- Framework: Next.js 15 with App Router
- Database: Supabase (PostgreSQL)
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Authentication: Custom admin auth with bcrypt
- Real-time Features: Supabase real-time subscriptions
- 40 Progressive Levels: Each level unlocks after completing the previous one
- 5-Hour Time Limit: Global countdown timer across all levels
- Real-time Scoring: Dynamic score calculation with multiple factors
- Checkpoint System: Automatic saves at levels 1, 5, 10, 15, 20, 25, 30, 35
- Team-based Competition: Multiple teams can compete simultaneously
- Correct Answer (No hint): +1500 points
- Correct Answer (With hint): +1000 points
- Incorrect Answer: -400 points
- Question Skipped: -750 points
- Consecutive Correct Bonus: +200 points for every 3 consecutive correct answers
- Checkpoint Usage: -200 points per checkpoint revert
- Time Bonus: Up to +250 points based on level completion time
- Team Management: Create, delete, and monitor teams
- Real-time Dashboard: Live statistics and progress tracking
- Secure Authentication: Bcrypt-hashed passwords
- Game Monitoring: View detailed team statistics and performance
- Node.js 18+
- npm or yarn
- Supabase account
git clone https://github.com/dariogeorge21/asthra10-techdos.git
cd asthra10-techdos
npm install- Create a new Supabase project at supabase.com
- Copy your project URL and anon key
- Run the database migrations:
# In your Supabase SQL editor, run: # 1. supabase/migrations/001_create_teams_table.sql # 2. supabase/migrations/002_create_admin_users_table.sql
cp .env.example .env.localEdit .env.local with your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
ADMIN_JWT_SECRET=your_jwt_secret_for_admin_auth
GAME_DURATION_HOURS=5npm run devOpen http://localhost:3000 to view the application.
- Get Team Code: Obtain your unique team code from organizers
- Start Game: Enter team code on the landing page
- Navigate Levels: Complete levels sequentially from the levels overview
- Monitor Progress: Track your score and time remaining in real-time
- Access Admin Panel: Navigate to
/admin - Login: Use credentials provided by organizers
- Manage Teams: Create teams and monitor their progress
- View Statistics: Real-time dashboard with game analytics
app/
โโโ admin/ # Admin panel
โ โโโ page.tsx # Admin dashboard
โโโ api/ # API routes
โ โโโ admin/ # Admin-only endpoints
โ โโโ teams/ # Team management endpoints
โโโ levels/ # Game levels
โ โโโ page.tsx # Levels overview
โ โโโ level-1/ # Individual level pages
โ โโโ page.tsx
โโโ globals.css # Global styles
โโโ layout.tsx # Root layout
โโโ page.tsx # Landing page
lib/
โโโ supabase.ts # Database client and utilities
โโโ auth.ts # Authentication helpers
supabase/
โโโ migrations/ # Database schema migrations
โโโ 001_create_teams_table.sql
โโโ 002_create_admin_users_table.sql
components/ui/ # Reusable UI components
POST /api/teams/start-game- Initialize game for teamGET /api/teams/[team_code]- Get team dataPUT /api/teams/[team_code]/stats- Update question statisticsPUT /api/teams/[team_code]/score- Update score and levelPUT /api/teams/[team_code]/checkpoint- Save checkpointPUT /api/teams/[team_code]/revert- Revert to checkpoint
POST /api/admin/auth/login- Admin loginPOST /api/admin/auth/logout- Admin logoutGET /api/admin/teams- List all teamsPOST /api/admin/teams- Create new teamDELETE /api/admin/teams/[team_code]- Delete team
Each level should be created as a separate page in app/levels/level-X/page.tsx:
// app/levels/level-2/page.tsx
"use client";
import { useState, useEffect } from "react";
// ... other imports
const questions = [
{
id: 1,
question: "Your question here?",
options: ["Option A", "Option B", "Option C", "Option D"],
correct: "Option A",
hint: "Your hint here"
}
// ... more questions
];
export default function Level2Page() {
// Copy the structure from level-1/page.tsx
// Update level number and questions
}- Question Format: Use multiple choice questions (MCQ)
- Difficulty Progression: Increase complexity with each level
- Hints: Provide helpful but not obvious hints
- Checkpoint Levels: Levels 1, 5, 10, 15, 20, 25, 30, 35 auto-save progress
- Navigation Protection: Prevent accidental page reloads during gameplay
- Fork the Repository
- Create Feature Branch:
git checkout -b feature/level-X - Implement Changes: Follow existing patterns and conventions
- Test Thoroughly: Ensure scoring and navigation work correctly
- Submit Pull Request: Include description of changes
- Use TypeScript for type safety
- Follow existing component patterns
- Implement proper error handling
- Add loading states for async operations
- Maintain responsive design principles
- Create new level directory:
app/levels/level-X/ - Copy structure from existing level
- Update questions and level-specific logic
- Test scoring calculations
- Verify checkpoint functionality (if applicable)
- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically on push to main branch
npm run build
npm start- Admin Authentication: Uses bcrypt for password hashing
- Environment Variables: Keep Supabase keys secure
- Row Level Security: Enabled on database tables
- Session Management: HTTP-only cookies for admin sessions
teams (
team_name TEXT NOT NULL,
team_code TEXT PRIMARY KEY,
score INTEGER DEFAULT 0,
game_loaded BOOLEAN DEFAULT FALSE,
checkpoint_score INTEGER DEFAULT 0,
checkpoint_level INTEGER DEFAULT 1,
current_level INTEGER DEFAULT 1,
correct_questions INTEGER DEFAULT 0,
incorrect_questions INTEGER DEFAULT 0,
skipped_questions INTEGER DEFAULT 0,
hint_count INTEGER DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
)admin_users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
username TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
)- Supabase Connection: Verify URL and API keys in environment variables
- Admin Login: Default credentials are admin/admin123
- Team Code Issues: Ensure team exists in database
- Timer Problems: Check browser timezone settings
- Score Calculation: Verify all API endpoints are responding
- Use browser dev tools to monitor API calls
- Check Supabase logs for database errors
- Test with multiple teams for concurrent gameplay
- Verify checkpoint system with intentional failures
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Next.js
- UI components from shadcn/ui
- Database powered by Supabase
- Icons from Lucide React
Ready to challenge your teams? Let the games begin! ๐ฎ