Skip to content

Mavdii/code-canvas

Repository files navigation

🚀 Code Playground

A Professional Online Code Editor & Live Preview Environment

Made with React TypeScript Tailwind CSS Monaco Editor Vite

Build, Preview, and Share code instantly in your browser

FeaturesDemoInstallationUsageShortcutsContact


✨ Features

🎨 Professional Code Editor

  • Monaco Editor Integration - The same editor that powers VS Code
  • Syntax Highlighting - Support for 20+ programming languages
  • IntelliSense & Auto-completion - Smart code suggestions
  • Multi-cursor Editing - Edit multiple lines simultaneously
  • Code Folding & Minimap - Navigate large files with ease
  • Multiple Themes - Dark+, Light+, High Contrast

👁️ Live Preview System

  • Real-time Preview - See changes instantly as you type
  • Multiple View Modes - Browser, Console, or Split view
  • Responsive Testing - Desktop, Laptop, Tablet, Mobile viewports
  • Console Output - Capture and display console.log, errors, and warnings
  • Open in New Window - Preview your work in a separate tab
  • Closable Preview Panel - Focus on code when needed

⚛️ React/JSX Support

  • Babel Transpilation - Write modern JSX/TSX in the browser
  • React 18 - Full support for latest React features
  • Hot Reload - Auto-refresh on code changes
  • React Templates - Quick-start with pre-built templates

📁 Virtual File System

  • File Tree Explorer - Organize files and folders
  • Create, Rename, Delete - Full file management
  • Context Menu - Right-click for quick actions
  • Language Detection - Automatic syntax highlighting based on file extension

🔍 Command Palette

  • Quick Actions - Access any command instantly with Ctrl+Shift+P
  • Fuzzy Search - Find commands, files, and settings
  • Keyboard Shortcuts - Displayed alongside commands

📦 Import/Export

  • ZIP Export - Download your entire project as a ZIP file
  • ZIP Import - Import existing projects from ZIP
  • Preserve Structure - Maintains folder hierarchy

🔄 Version Control (Git-like)

  • Create Commits - Save snapshots of your work
  • Commit History - View all previous commits with timestamps
  • Checkout - Restore any previous version
  • Delete Commits - Remove unwanted snapshots

⚙️ Customizable Settings

  • Font Size - Adjust editor font size (10-24px)
  • Tab Size - Configure indentation (2-8 spaces)
  • Word Wrap - Toggle line wrapping
  • Minimap - Show/hide code overview
  • Auto-refresh - Toggle live preview updates

🖼️ Screenshots

Editor View Split View
Editor Split
Command Palette Git History
Command Git

🛠️ Tech Stack

Category Technologies
Frontend React 18, TypeScript, Vite
Styling Tailwind CSS, shadcn/ui
Editor Monaco Editor (@monaco-editor/react)
State Management Zustand with Immer
Transpilation Babel Standalone
Animations Framer Motion
Icons Lucide React
Search Fuse.js (Fuzzy Search)
Compression JSZip
Backend Supabase (optional)

📦 Installation

Prerequisites

  • Node.js >= 18.0.0
  • npm or bun package manager

Quick Start

# Clone the repository
git clone https://github.com/Mavdii/code-canvas.git

# Navigate to project directory
cd code-canvas

# Install dependencies
npm install
# or
bun install

# Start development server
npm run dev
# or
bun dev

The application will be available at http://localhost:8080

Build for Production

# Create production build
npm run build

# Preview production build
npm run preview

🚀 Usage

Getting Started

  1. Open the Editor - Navigate to the application in your browser
  2. Start Coding - Edit the default files or create new ones
  3. See Live Preview - Watch your changes appear in real-time
  4. Switch Templates - Click "React Template" for React development

Working with Files

  • Create File/Folder - Right-click in the file explorer
  • Rename - Right-click → Rename
  • Delete - Right-click → Delete
  • Open File - Click on any file to open in editor

Using the Preview

  • Browser Mode - View rendered HTML output
  • Console Mode - See JavaScript console output
  • Split Mode - View both simultaneously
  • Viewport Selection - Test responsive designs
  • Close Preview - Click ✕ to close and focus on code

Version Control

  1. Go to Source Control tab (Git icon in sidebar)
  2. Enter a commit message
  3. Click Create Commit
  4. Use Checkout to restore previous versions

⌨️ Keyboard Shortcuts

Shortcut Action
Ctrl + Shift + P Open Command Palette
Ctrl + P Quick File Open
Ctrl + B Toggle Sidebar
Ctrl + S Save Changes
Ctrl + Shift + E Show Explorer
Ctrl + Shift + F Show Search
Ctrl + Shift + G Show Source Control

📁 Project Structure

code-playground/
├── src/
│   ├── components/
│   │   ├── CommandPalette/     # Command palette with fuzzy search
│   │   ├── Editor/             # Monaco editor components
│   │   ├── FileExplorer/       # File tree component
│   │   ├── Git/                # Version control panel
│   │   ├── ImportExport/       # ZIP import/export
│   │   ├── Layout/             # Main layout & sidebar
│   │   ├── Preview/            # Live preview panel
│   │   └── ui/                 # shadcn/ui components
│   ├── hooks/                  # Custom React hooks
│   ├── lib/                    # Utilities & helpers
│   │   ├── babelTranspiler.ts  # JSX/TSX transpilation
│   │   ├── previewBuilder.ts   # Preview HTML builder
│   │   ├── projectExport.ts    # ZIP export/import
│   │   └── utils.ts            # General utilities
│   ├── store/                  # Zustand state stores
│   │   ├── editorStore.ts      # Editor state
│   │   ├── filesStore.ts       # File system state
│   │   └── gitStore.ts         # Version control state
│   ├── types/                  # TypeScript types
│   └── pages/                  # Page components
├── public/                     # Static assets
├── index.html                  # Entry HTML
└── package.json                # Dependencies

🎯 Roadmap

  • Real Terminal - Full bash/shell terminal support
  • Collaborative Editing - Real-time multi-user collaboration
  • User Authentication - Save projects to cloud
  • More Templates - Vue, Svelte, Angular starters
  • Package Manager - Install npm packages in browser
  • Custom Themes - Create and share editor themes
  • Code Sharing - Generate shareable links
  • Embeddable - Embed playgrounds in websites

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


👨‍💻 Developer

Umar

Full-Stack Developer

Telegram WhatsApp Email Discord


⭐ Star this repo if you find it useful!

Made with ❤️ by Umar

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages