Skip to content
yashthorat7Public

About

WhileCode is an elite, AI-powered competitive programming IDE featuring an intelligent algorithm mentor, instant C++ execution, and LeetCode-style structure injection, all built into a blazing-fast, visually stunning React workspace.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

πŸš€ WhileCode: The Ultimate Competitive Programming IDE

WhileCode Dashboard

WhileCode is an elite, AI-powered competitive programming workspace engineered specifically for high-performance algorithm solving and logic mastery. Designed around instant execution, strict memory limits, and seamless test-case management, it transforms standard algorithmic grinding into a lightning-fast premium experience with deep C++ runtime support.

Next.js React TailwindCSS Editor AI


✨ Features & Highlights

⚑ Professional CP Runtime

  • LeetCode Template Injection: An industrial-strength C++ wrapper that transparently parses and processes notoriously tricky structs like ListNode and TreeNode out of the box.
  • Contest-Ready I/O: Custom read<T> helpers inherently resolve arrays, matrices, and tightly-packed complex delimiters automatically.
  • Object-Oriented Harness: Smartly detects standalone function questions versus stateful class queries (e.g., LRU Cache) and dynamically mocks the respective sequence of commands.

πŸ€– Ultra-Fast Algorithm Mentor (Powered by Groq LPUs)

  • Sub-Second Problem & Code Generation: Integrated with Groq's LPU Inference Engine (qwen/qwen3.8-27b and openai/gpt-oss-120b), delivering responses in 700ms – 1.6s at 500+ tokens/sec.
  • Generous Free-Tier Quota: Operates on Groq's high-throughput free tier offering 1,000 requests/day and 30 requests/minute with zero 503 traffic-spike timeouts.
  • Complexity Focus: Actively breaks down your algorithmic code into absolute Big-O metrics, analyzing operations against $T: O(N)$ limits and space against $S: O(1)$ boundaries.
  • JSON-Synchronized Test Cases: The AI seamlessly pushes corner-case arrays directly into your IDE's internal stateβ€”catching bounds errors before you even hit run.
  • Clean Editor-Ready Formatting: Outputs structured problem specifications free of markdown asterisks and emojis, designed specifically for clean display in competitive programming plain-text notes.

πŸ’» Rapid Algorithm Implementation

  • Full Monaco Support: Leverage VS Code's core with blistering fast autocomplete, snippet injection, and multi-line cursors.
  • Contest Tab Management: Handle up to 12 simultaneous algorithmic solutions internally without losing focus.
  • Intelligent Naming: Tabs magically update to reflect your function names or first-line algorithm descriptions, saving raw seconds during intense debugging.
  • Session Persistence: Complete persistence via LocalStorage guarantees your recursive trees won't be lost on accidental reloads.

πŸ“± Adaptive Mobile Execution

  • Responsive Split-Screen: Custom-built touch-native ResizeHandle allows real-time execution outputs alongside your solution buffers.
  • Tabbed Analytics: Instantly pivot between algorithmic hints, constraints, and test outputs without wasting pixel space on mobile.

πŸ›  Tech Stack

Frontend

  • Framework: React 19
  • Styling: Tailwind CSS v4 (Premium Dark/Light competitive themes)
  • Editor Core: Monaco Editor (@monaco-editor/react)
  • State Management: Custom React Hooks optimized for zero-latency DOM updates
  • Interactions: @dnd-kit for seamless drag-and-drop tab manipulation
  • Icons: Lucide React

Backend

  • Framework: Next.js 15 (App Router & API Routes)
  • AI Inference Engine: Groq Cloud LPU API (qwen/qwen3.8-27b / openai/gpt-oss-120b)
  • Execution Pipeline: Custom C++ compiler orchestration logic
  • Data Parsing: Advanced internal abstractions and regex logic for standard output streams

πŸ“‚ Project Structure

whilecode/
β”œβ”€β”€ app/                  # Next.js App Router
β”‚   β”œβ”€β”€ api/              # API Routes
β”‚   β”‚   β”œβ”€β”€ ai/           # Groq Algorithm Mentor proxy routes
β”‚   β”‚   └── compile/      # Remote execution environments
β”‚   β”œβ”€β”€ components/       # UI Directory
β”‚   β”‚   β”œβ”€β”€ ide/          # Workspace structure (EditorPanel, Output, etc.)
β”‚   β”‚   └── ui/           # Drag blocks and boundary elements
β”‚   β”œβ”€β”€ hooks/            # Core Memory & Event Logic
β”‚   β”‚   β”œβ”€β”€ useAiAssistant.js # Complexity evaluation logic
β”‚   β”‚   β”œβ”€β”€ useTabs.js        # Scratchpad and algorithm persistence
β”‚   β”‚   β”œβ”€β”€ useTheme.js       # System layout toggles
β”‚   β”‚   └── useCodeExecution.js # Standard Execution Pipeline
β”‚   β”œβ”€β”€ utils/            # Configurations & CP Wrappers
β”‚   β”‚   β”œβ”€β”€ aiPrompts.js      # Structured constraints for the Mentor
β”‚   β”‚   β”œβ”€β”€ codeTemplate.js   # The transparent C++ I/O wrapper
β”‚   β”‚   β”œβ”€β”€ constants.js      # Global macros
β”‚   β”‚   └── languageMap.js    # Target environment mapping
β”‚   β”œβ”€β”€ globals.css       # Raw Tailwind styling
β”‚   └── page.js           # Launch environment
β”œβ”€β”€ public/               # Essential SVGs and Typographies
└── package.json          # Dependency Manifest

πŸš€ Getting Started

Prerequisites

  • Node.js: v18.0 or higher.
  • Git: For version tracking.
  • Groq API Key: Essential for the Algorithmic Mentor (obtain a free key from Groq Console).

Installation

  1. Clone the repository:

    git clone https://github.com/yashthorat7/whilecode.git
    cd whilecode
  2. Install dependencies:

    npm install
  3. Setup Environment Variables: Create a .env.local file in the root directory:

    GROQ_API_KEY=your_groq_api_key_here

Running the Environment

  1. Start the local host:

    npm run dev
  2. Access the workspace at http://localhost:3000.


🧩 Detailed System Overview

πŸ’‘ Competitive Analysis Layer

To ensure the AI operates as an advanced CP mentor rather than an answer-spitting bot, the system prompt aggressively structures output. It mandates:

  • Providing clean, distraction-free problem statements without asterisks (**) or emojis for optimal plain-text readability.
  • Supplying precisely curated arrays of test-case edge inputs (null checking, single-element vectors, maximum value integers).
  • Extracting Big-O complexity metrics explicitly ($T: O(N)$, $S: O(1)$) so users understand performance overhead before compilation.

⚑ Zero-Latency Workflow

To mirror local execution environments, WhileCode relies entirely on client-side memory handling combined with browser localStorage. This eradicates database latency when injecting custom test cases, copying snippets, or navigating deep file structures mid-submission.

πŸ“ How the Code Wrapper Excels

WhileCode doesn't just evaluate raw text; it builds a full compilation envelope around your C++ logic.

  • Automatic Helper Injection: Overrides native formatting via CPP_INPUT_HELPERS allowing you to drop [[1,2],[3,4]] straight into a vector without custom parsing.
  • Data Structure Mocking: Essential for graph navigation, ships pre-loaded with native implementations of ListNode and TreeNode.
  • Intelligent I/O Binding: Visual blocks in the UI are transparently serialized into standard inputs, allowing seamless parsing without #include bloat or int main() overhead.

πŸ— Component Breakdown

Core Subsystems

  • TabBar & Tabs: Powered by @dnd-kit. Manages aggressive context switching and intelligent naming extraction to keep workspaces clean.
  • EditorPanel: Suspends the Monaco dependency in an optimized <Panel> tag, guaranteeing 60FPS scrolling and deep syntactic intellisense.
  • ResizeHandle: Provides native split-screen manipulation for touch displays by executing pointer-events: none optimizations to stop accidental DOM highlights during intense refactors.
  • SidePanels: Groups Notes, Test Cases, and the AI Mentor interface together for rapid comparison and testing feedback loops.

πŸ“‘ API Reference

πŸ€– Mentor Endpoint

Method Endpoint Description
POST /api/ai Resolves problem parameters, inspects edge logic, or supplies hints via Groq (qwen/qwen3.8-27b).

πŸ”¨ Compilation Endpoint

Method Endpoint Description
POST /api/compile Encapsulates solution logic into a C++ execution envelope and fires it against target containers.

πŸ”’ License & Usage

This project is Proprietary and Confidential. All rights reserved. Unauthorized copying, distribution, or use of this codebase is strictly prohibited. For access or inquiries, please contact the repository owner.


❀️ Developed By

πŸ‘¨β€πŸ’» Yash Thorat

Feel free to suggest improvements, or report issues!

⭐ Don't forget to star this repository if you find it useful!

About

WhileCode is an elite, AI-powered competitive programming IDE featuring an intelligent algorithm mentor, instant C++ execution, and LeetCode-style structure injection, all built into a blazing-fast, visually stunning React workspace.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages