CP Duel is a modern, competitive programming duel platform where users can challenge each other to real-time coding battles, view live leaderboards, and experience a LeetCode-like problem-solving interface.
- 1v1 Coding Duels with real-time status tracking
- Tournament Bracket Playoffs with bracket visualization
- Multi-tier Leaderboards (Round, Semi-final, Final, and Winner)
- LeetCode-style Problem Solving UI with integrated code editor
- Real-time Timer and opponent status monitoring
- Firebase Authentication with protected routes
- Practice Sheets for different algorithmic topics (DP, Graphs, Trees, Range Queries)
- Contest Management with create/join functionality
- Statistics Dashboard for performance tracking
- Responsive, dark-themed UI optimized for all devices
cp-duel/
βββ π README.md # Project documentation
βββ π package.json # Node.js dependencies and scripts
βββ π vite.config.js # Vite build configuration
βββ π eslint.config.js # ESLint linting configuration
βββ π vercel.json # Vercel deployment configuration
βββ π index.html # Main HTML entry point
β
βββ π public/ # Static assets served directly
β βββ πΌοΈ images.png # Platform images/screenshots
β βββ πΌοΈ react.svg # React logo
β βββ πΌοΈ vite.svg # Vite logo
β
βββ π src/ # Source code directory
βββ π App.jsx # Main application component with routing
βββ π main.jsx # React application entry point
βββ π index.css # Global CSS styles and Tailwind imports
β
βββ π assets/ # Static assets used in components
β βββ πΌοΈ gfg.svg # GeeksforGeeks logo
β βββ πΌοΈ lc.svg # LeetCode logo
β
βββ π components/ # Reusable React components
β βββ π login.jsx # User login form component
β βββ π Signup.jsx # User registration form component
β βββ π‘οΈ ProtectedRoute.jsx # Route protection wrapper component
β βββ π§ Navbar.jsx # Navigation header component
β βββ π¦Ά Footer.jsx # Site footer component
β βββ π ContestList.jsx # Display list of available contests
β βββ π― ContestCard.jsx # Individual contest display card
β βββ π ContestBracket.jsx # Tournament bracket visualization
β βββ π LeaderboardCard.jsx # Individual leaderboard entry
β βββ β CreateContest.jsx # Contest creation form
β βββ π CreateProblem.jsx # Problem creation form
β βββ π ProblemForm.jsx # Problem input/editing form
β βββ π ProblemList.jsx # List of problems display
β βββ β FavoriteList.jsx # User's favorite problems
β βββ ποΈ ViewQuestionComponent.tsx # Problem viewing interface
β βββ π ui/ # UI component library (Radix UI components)
β
βββ π pages/ # Page-level components (route destinations)
β βββ π HomePage.jsx # Landing page with platform overview
β βββ π ContestPage.jsx # Contest lobby and management
β βββ π₯ ContestStartPage.tsx # Live contest interface with code editor
β βββ π ContestBracketPage.jsx # Tournament bracket view
β βββ π ContestLeaderboardPage.jsx # Contest-specific leaderboards
β βββ π
LeaderboardPage.jsx # Global platform leaderboards
β βββ π SheetsPage.jsx # Practice sheets overview
β βββ π§ DPSheetPage.jsx # Dynamic Programming practice sheet
β βββ πΈοΈ GraphSheetPage.jsx # Graph algorithms practice sheet
β βββ π³ TreeSheetPage.jsx # Tree algorithms practice sheet
β βββ π RangeQuerySheetPage.jsx # Range query algorithms practice sheet
β βββ π StatsPage.jsx # User statistics and analytics
β βββ π» ProblemSolvingPage.tsx # Individual problem solving interface
β
βββ π contexts/ # React Context providers
β βββ π AuthContext.jsx # Authentication state management
β
βββ π hooks/ # Custom React hooks
β βββ π useApi.js # API interaction custom hook
β
βββ π config/ # Configuration files
β βββ π server.js # Server configuration settings
β
βββ π utils/ # Utility functions and helpers
β βββ π apiClient.js # HTTP client for API requests
β βββ π contestLeaderboardData.js # Contest leaderboard data handlers
β βββ π§ dpSections.js # Dynamic Programming section data
β βββ π
leaderboardData.js # Global leaderboard data handlers
β βββ π problemData.js # Problem data management
β βββ π οΈ utils.jsx # General utility functions
β βββ π firebase/ # Firebase integration
β βββ π₯ firebase.js # Firebase configuration and initialization
β
βββ π styles/ # Component-specific stylesheets
β βββ π¨ login.css # Login component specific styles
β
βββ π data/ # Static data files and mock data
βββ π lib/ # Third-party library configurations
- React 19.1.0 with functional components and hooks
- Vite 6.3.5 for fast development and optimized builds
- React Router DOM 7.6.0 for client-side routing and navigation
- React Context API for global authentication state
- Custom hooks for API interactions and data fetching
- Local storage for token persistence
- Tailwind CSS 4.1.6 for utility-first styling
- Radix UI components for accessible, unstyled UI primitives
- React Icons for consistent iconography
- Responsive design with mobile-first approach
- Monaco Editor (VS Code editor) for in-browser code editing
- React Monaco Editor wrapper for React integration
- Syntax highlighting and IntelliSense support
- Firebase Authentication for user management
- Protected routes with authentication guards
- token management with automatic refresh
- Secure API communication with token-based auth
- Recharts for statistics and performance charts
- React Circular Progressbar for timer and progress indicators
- Custom tournament brackets with SVG-based visualization
- ESLint for code quality and consistency
- TypeScript support for select components
- Hot Module Replacement for fast development
- Environment variables for configuration management
AuthContext.jsx: Centralized authentication state with Firebase integrationlogin.jsx&Signup.jsx: User authentication forms with validationProtectedRoute.jsx: Route guard component for authenticated access
ContestPage.jsx: Main contest interface with lobby functionalityContestStartPage.tsx: Live contest environment with real-time featuresCreateContest.jsx: Contest creation with customizable parametersContestBracket.jsx: Tournament bracket visualization and progression
ProblemSolvingPage.tsx: Full-featured coding environmentViewQuestionComponent.tsx: Problem statement renderer with LaTeX support- Monaco Editor integration for code editing with syntax highlighting
- Topic-specific practice sheets (DP, Graphs, Trees, Range Queries)
- Curated problem sets for algorithmic learning
- Progress tracking and difficulty progression
- Global and contest-specific leaderboards
- Real-time ranking updates during contests
- Performance statistics and user analytics
Navbar.jsx: Adaptive navigation with authentication stateFooter.jsx: Site-wide footer with links and information
- React 19.1.0 - Modern UI library with latest features
- Vite 6.3.5 - Next-generation frontend tooling
- Tailwind CSS 4.1.6 - Utility-first CSS framework
- React Router DOM 7.6.0 - Declarative routing
- ESLint - Code linting and quality assurance
- TypeScript - Type safety for critical components
- Vercel - Deployment and hosting platform
- Firebase Auth - User authentication and management
- Socket.io Client - Real-time communication
- Axios - HTTP client for API requests
- Monaco Editor - In-browser code editor
- Radix UI - Primitive UI components
- Recharts - Data visualization and charts
- React Icons - Icon library
- React Toastify - Toast notifications
- KaTeX & React KaTeX - Mathematical notation rendering
- Node.js (v18 or higher)
- npm or yarn package manager
- Firebase account for authentication setup
# Clone the repository
git clone <repository-url>
cd cp-duel
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Configure Firebase credentials in .env
# Start development server
npm run devnpm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint