Skip to content

kKrishGupta/DECAPSULE

Repository files navigation

πŸš€ DECAPSULE (Frontend)

AI-Powered Code Debugging & Algorithm Visualization Engine

React Vite Tailwind CSS License

Smart Β· Fast Β· Interactive Β· Built for Developers


🧠 What does DECAPSULE mean?

DECAPSULE = De + Capsule

To break open a capsule and reveal what’s happening inside. In programming terms, Decapsule breaks open your code and exposes:

  • Hidden execution flow
  • Call stacks & Recursion depth
  • Dynamic Programming tables
  • Logical bugs & Algorithmic behavior

Instead of treating code as a black box, Decapsule opens it step-by-step.


πŸ“‹ Table of Contents


πŸ” Overview

This is the Frontend Client for Decapsule. It is a highly interactive React application that serves as the interface for developers to write code, visualize algorithms, and receive AI-driven explanations.

It connects to the Decapsule Backend to receive real-time execution streams and renders complex data structures (Trees, Graphs, DP Tables) into beautiful, animated visualizations.


πŸ”₯ Why Decapsule is Different

Unlike typical code runners or AI chat tools, Decapsule combines the best of all worlds:

Feature Standard Runners AI Chatbots Decapsule
Interactive Visuals ❌ ❌ βœ…
Real-time Streaming ❌ ❌ βœ…
Live Algo Tracing ❌ ❌ βœ…
Teacher-Mode Explanations ❌ βœ… βœ…
Instant Auto-Fix ❌ βœ… βœ…

✨ Core Features

🎨 1. Interactive Visualization Pane

Automatically renders the correct data structure based on the code analysis:

  • Recursion Trees: visualizes function calls and return paths.
  • DP Tables: Animate grid updates for dynamic programming.
  • Graph Maps: Shows node traversal and connections.

πŸ“ 2. Intelligent Code Editor

A robust editor environment (CodeEditor.jsx) that supports:

  • Syntax highlighting
  • Line numbers
  • Real-time error feedback

⚑ 3. Live Debugging Stream (SSE)

Consumes Server-Sent Events from the backend to update the UI incrementally. You see the logic unfold step-by-step, rather than waiting for the whole process to finish.

πŸ€– 4. AI Assistant Integration

  • Auto-Fix Modal: Pop-up interface to view and apply AI-suggested code fixes.
  • Explanation Panel: Reads out teacher-style logic breakdowns.

πŸŽ›οΈ 5. Playback Controls

  • Timeline Slider: Scrub through the execution history.
  • Step-by-Step Navigation: Move forward or backward through the code execution flow.

πŸ› οΈ Tech Stack

Core Framework

  • React 18: Component-based UI.
  • Vite: Next-generation frontend tooling.

Styling & UI

  • Tailwind CSS: Utility-first styling.
  • Framer Motion: For smooth animations (Trees/Graphs).
  • Lucide React: Beautiful icons.

State & API

  • Axios: HTTP requests.
  • React Hooks: Custom hooks for state management.
  • EventSource API: For handling SSE streams.

πŸ“ Project Structure

DECAPSULE/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ api/                    # API connection logic
β”‚   β”‚
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ ui/                 # Reusable UI elements (Buttons, Cards)
β”‚   β”‚   β”œβ”€β”€ views/              # Specialized Visualization Views
β”‚   β”‚   β”‚   β”œβ”€β”€ DPTable.jsx     # Dynamic Programming Grid
β”‚   β”‚   β”‚   β”œβ”€β”€ GraphMap.jsx    # Graph Algo Visualization
β”‚   β”‚   β”‚   └── RecursionTree.jsx # Tree Visualization
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ AutoFixModal.jsx    # AI Fix Popup
β”‚   β”‚   β”œβ”€β”€ BottomPanels.jsx    # Console & Output Logs
β”‚   β”‚   β”œβ”€β”€ CodeEditor.jsx      # Main Editor Window
β”‚   β”‚   β”œβ”€β”€ FileExplorer.jsx    # Sidebar File Tree
β”‚   β”‚   β”œβ”€β”€ Navbar.jsx          # Top Navigation
β”‚   β”‚   β”œβ”€β”€ ProfileModal.jsx    # User Settings
β”‚   β”‚   β”œβ”€β”€ Sidebar.jsx         # App Sidebar
β”‚   β”‚   β”œβ”€β”€ TimelineSlider.jsx  # Execution Playback Control
β”‚   β”‚   └── VisualizerPane.jsx  # Main Display Area
β”‚   β”‚
β”‚   β”œβ”€β”€ hooks/                  # Custom React Hooks
β”‚   β”œβ”€β”€ lib/                    # Utility functions
β”‚   β”‚
β”‚   β”œβ”€β”€ App.jsx                 # Main App Component
β”‚   β”œβ”€β”€ auth.jsx                # Authentication Context
β”‚   β”œβ”€β”€ index.css               # Global Styles (Tailwind)
β”‚   └── index.jsx               # Entry Point
β”‚
β”œβ”€β”€ .env                        # Environment Variables
β”œβ”€β”€ .gitignore
β”œβ”€β”€ eslint.config.js            # Linting Rules
β”œβ”€β”€ index.html                  # HTML Root
β”œβ”€β”€ package.json                # Dependencies
└── vite.config.js              # Vite Configuration

πŸš€ Installation & Setup

  1. Clone the repository

    git clone [https://github.com/yourusername/decapsule-frontend.git](https://github.com/yourusername/decapsule-frontend.git)
    cd decapsule-frontend
  2. Install dependencies

    npm install
    # or
    yarn install
  3. Configure Environment Create a .env file in the root directory:

    VITE_API_BASE_URL=http://localhost:8000
  4. Run the Development Server

    npm run dev

    Open Live Preview to view it in the browser.


❀️ Contributing

Contributions are welcome! We are actively looking for help with:

  • Enhancing the Graph visualization engine.
  • Adding more themes to the Code Editor.
  • Improving mobile responsiveness.
  • Adding support for Tree DP visualizations.

Feel free to open an issue or submit a PR πŸš€


πŸ“„ License

MIT License β€” Free to use, modify, and extend.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages