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.
- LeetCode Template Injection: An industrial-strength C++ wrapper that transparently parses and processes notoriously tricky structs like
ListNodeandTreeNodeout 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.
-
Sub-Second Problem & Code Generation: Integrated with Groq's LPU Inference Engine (
qwen/qwen3.8-27bandopenai/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.
- 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.
- Responsive Split-Screen: Custom-built touch-native
ResizeHandleallows 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.
- 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
- 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
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
- 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).
-
Clone the repository:
git clone https://github.com/yashthorat7/whilecode.git cd whilecode -
Install dependencies:
npm install
-
Setup Environment Variables: Create a
.env.localfile in the root directory:GROQ_API_KEY=your_groq_api_key_here
-
Start the local host:
npm run dev
-
Access the workspace at
http://localhost:3000.
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 (
nullchecking, 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.
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.
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_HELPERSallowing 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
ListNodeandTreeNode. - Intelligent I/O Binding: Visual blocks in the UI are transparently serialized into standard inputs, allowing seamless parsing without
#includebloat orint main()overhead.
- 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: noneoptimizations 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.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/ai |
Resolves problem parameters, inspects edge logic, or supplies hints via Groq (qwen/qwen3.8-27b). |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/compile |
Encapsulates solution logic into a C++ execution envelope and fires it against target containers. |
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.
Feel free to suggest improvements, or report issues!
β Don't forget to star this repository if you find it useful!
